27#if (HAL_USE_SERIAL_USB == TRUE) || defined(__DOXYGEN__) 
   45  {0x00, 0x96, 0x00, 0x00},             
 
 
   85static size_t _write(
void *ip, 
const uint8_t *bp, 
size_t n) {
 
 
   91static size_t _read(
void *ip, uint8_t *bp, 
size_t n) {
 
 
  117static size_t _writet(
void *ip, 
const uint8_t *bp, 
size_t n,
 
 
  123static size_t _readt(
void *ip, uint8_t *bp, 
size_t n,
 
 
  129static msg_t _ctl(
void *ip, 
unsigned int operation, 
void *arg) {
 
  142#if defined(SDU_LLD_IMPLEMENTS_CTL) 
  146                                 unsigned int operation,
 
  148    return sdu_lld_control(sdup, operation, arg);
 
 
  255  if (config->
int_in > 0U) {
 
  258  sdup->config = config;
 
 
  286  usbp->
in_params[sdup->config->bulk_in - 1U]   = NULL;
 
  287  usbp->
out_params[sdup->config->bulk_out - 1U] = NULL;
 
  288  if (sdup->config->int_in > 0U) {
 
  289    usbp->
in_params[sdup->config->int_in - 1U]  = NULL;
 
 
  380    switch (usbp->
setup[1]) {
 
 
  506                                       sdup->config->bulk_out);
 
  507  if (size > (
size_t)0) {
 
 
  553  return _ctl((
void *)usbp, operation, arg);
 
 
uint8_t * ibqGetEmptyBufferI(input_buffers_queue_t *ibqp)
Gets the next empty buffer from the queue.
 
void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size)
Posts a new filled buffer to the queue.
 
uint8_t * obqGetFullBufferI(output_buffers_queue_t *obqp, size_t *sizep)
Gets the next filled buffer from the queue.
 
bool obqTryFlushI(output_buffers_queue_t *obqp)
Flushes the current, partially filled, buffer to the queue.
 
void obqObjectInit(output_buffers_queue_t *obqp, bool suspended, uint8_t *bp, size_t size, size_t n, bqnotify_t onfy, void *link)
Initializes an output buffers queue object.
 
size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp, size_t n, sysinterval_t timeout)
Output queue write with timeout.
 
#define bqSuspendI(bqp)
Puts the queue in suspended state.
 
void obqReleaseEmptyBufferI(output_buffers_queue_t *obqp)
Releases the next filled buffer back in the queue.
 
struct io_buffers_queue io_buffers_queue_t
Type of a generic queue of buffers.
 
void ibqObjectInit(input_buffers_queue_t *ibqp, bool suspended, uint8_t *bp, size_t size, size_t n, bqnotify_t infy, void *link)
Initializes an input buffers queue object.
 
msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Input queue read with timeout.
 
size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp, size_t n, sysinterval_t timeout)
Input queue read with timeout.
 
#define bqIsSuspendedX(bqp)
Return the suspended state of the queue.
 
void ibqResetI(input_buffers_queue_t *ibqp)
Resets an input buffers queue.
 
#define bqResumeX(bqp)
Resumes normal queue operations.
 
void obqResetI(output_buffers_queue_t *obqp)
Resets an output buffers queue.
 
msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b, sysinterval_t timeout)
Output queue write with timeout.
 
#define bqGetLinkX(bqp)
Returns the queue application-defined link.
 
static const struct EFlashDriverVMT vmt
 
#define CHN_OUTPUT_EMPTY
Output queue empty.
 
#define CHN_CTL_INVALID
Invalid operation code.
 
#define CHN_INPUT_AVAILABLE
Data available in the input queue.
 
#define CHN_CTL_NOP
Does nothing.
 
#define chnAddFlagsI(ip, flags)
Adds status flags to the listeners's flags mask.
 
#define CHN_CONNECTED
Connection happened.
 
#define CHN_DISCONNECTED
Disconnection happened.
 
static void osalSysLock(void)
Enters a critical zone from thread context.
 
static void osalSysUnlock(void)
Leaves a critical zone from thread context.
 
static void osalSysLockFromISR(void)
Enters a critical zone from ISR context.
 
void osalOsRescheduleS(void)
Checks if a reschedule is required and performs it.
 
static void osalSysUnlockFromISR(void)
Leaves a critical zone from ISR context.
 
static void osalEventObjectInit(event_source_t *esp)
Initializes an event source object.
 
#define osalDbgAssert(c, remark)
Condition assertion.
 
#define osalDbgCheck(c)
Function parameters check.
 
static size_t _writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout)
 
bool sduRequestsHook(USBDriver *usbp)
Default requests hook.
 
#define SERIAL_USB_BUFFERS_NUMBER
Serial over USB number of buffers.
 
static msg_t _get(void *ip)
 
void sduSuspendHookI(SerialUSBDriver *sdup)
USB device suspend handler.
 
static msg_t _gett(void *ip, sysinterval_t timeout)
 
static msg_t _ctl(void *ip, unsigned int operation, void *arg)
 
static msg_t _put(void *ip, uint8_t b)
 
#define SERIAL_USB_BUFFERS_SIZE
Serial over USB buffers size.
 
static void ibnotify(io_buffers_queue_t *bqp)
Notification of empty buffer released into the input buffers queue.
 
void sduInterruptTransmitted(USBDriver *usbp, usbep_t ep)
Default data received callback.
 
void sduObjectInit(SerialUSBDriver *sdup)
Initializes a generic full duplex driver object.
 
static bool sdu_start_receive(SerialUSBDriver *sdup)
 
void sduInit(void)
Serial Driver initialization.
 
static size_t _write(void *ip, const uint8_t *bp, size_t n)
 
msg_t sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config)
Configures and starts the driver.
 
static msg_t _putt(void *ip, uint8_t b, sysinterval_t timeout)
 
void sduDataReceived(USBDriver *usbp, usbep_t ep)
Default data received callback.
 
void sduWakeupHookI(SerialUSBDriver *sdup)
USB device wakeup handler.
 
msg_t sduControl(USBDriver *usbp, unsigned int operation, void *arg)
Control operation on a serial USB port.
 
static size_t _readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout)
 
void sduStop(SerialUSBDriver *sdup)
Stops the driver.
 
void sduSOFHookI(SerialUSBDriver *sdup)
SOF handler.
 
static size_t _read(void *ip, uint8_t *bp, size_t n)
 
static cdc_linecoding_t linecoding
 
void sduDataTransmitted(USBDriver *usbp, usbep_t ep)
Default data transmitted callback.
 
static void obnotify(io_buffers_queue_t *bqp)
Notification of filled buffer inserted into the output buffers queue.
 
void sduConfigureHookI(SerialUSBDriver *sdup)
USB device configured handler.
 
static size_t _writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout)
 
static msg_t _get(void *ip)
 
static msg_t _gett(void *ip, sysinterval_t timeout)
 
static msg_t _ctl(void *ip, unsigned int operation, void *arg)
 
static msg_t _put(void *ip, uint8_t b)
 
static size_t _write(void *ip, const uint8_t *bp, size_t n)
 
static msg_t _putt(void *ip, uint8_t b, sysinterval_t timeout)
 
static size_t _readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout)
 
static size_t _read(void *ip, uint8_t *bp, size_t n)
 
#define CDC_GET_LINE_CODING
 
#define CDC_SET_CONTROL_LINE_STATE
 
#define CDC_SET_LINE_CODING
 
#define usbGetDriverStateI(usbp)
Returns the driver state.
 
uint8_t usbep_t
Type of an endpoint identifier.
 
void usbStartReceiveI(USBDriver *usbp, usbep_t ep, uint8_t *buf, size_t n)
Starts a receive transaction on an OUT endpoint.
 
#define usbGetReceiveTransactionSizeX(usbp, ep)
Returns the exact size of a receive transaction.
 
void usbStartTransmitI(USBDriver *usbp, usbep_t ep, const uint8_t *buf, size_t n)
Starts a transmit transaction on an IN endpoint.
 
#define USB_RTYPE_TYPE_CLASS
 
#define usbGetReceiveStatusI(usbp, ep)
Returns the status of an OUT endpoint.
 
#define usbSetupTransfer(usbp, buf, n, endcb)
Request transfer setup.
 
#define usbGetTransmitStatusI(usbp, ep)
Returns the status of an IN endpoint.
 
#define USB_RTYPE_TYPE_MASK
 
#define MSG_OK
Normal wakeup message.
 
uint64_t sysinterval_t
Type of time interval.
 
#define TIME_INFINITE
Infinite interval specification for all functions with a timeout specification.
 
Serial over USB Driver configuration structure.
 
usbep_t bulk_in
Bulk IN endpoint used for outgoing data transfer.
 
usbep_t bulk_out
Bulk OUT endpoint used for incoming data transfer.
 
usbep_t int_in
Interrupt IN endpoint used for notifications.
 
USBDriver * usbp
USB driver to use.
 
Full duplex serial driver class.
 
const struct SerialUSBDriverVMT * vmt
Virtual Methods Table.
 
SerialDriver virtual methods table.
 
Structure representing an USB driver.
 
uint8_t setup[8]
Setup packet buffer.
 
void * out_params[USB_MAX_ENDPOINTS]
Fields available to user, it can be used to associate an application-defined handler to an OUT endpoi...
 
void * in_params[USB_MAX_ENDPOINTS]
Fields available to user, it can be used to associate an application-defined handler to an IN endpoin...
 
const USBEndpointConfig * epc[USB_MAX_ENDPOINTS+1]
Active endpoints configurations.
 
uint16_t in_maxsize
IN endpoint maximum packet size.
 
USBInEndpointState * in_state
USBEndpointState associated to the IN endpoint.
 
size_t txsize
Requested transmit transfer size.
 
Type of Line Coding structure.