Modules | Classes | Typedefs | Functions | Variables
Usbd_cdc
Collaboration diagram for Usbd_cdc:

Modules

 USB Device CDC Serial Interface IDs
 
 USB Device Serial Port Descriptor Values
 
 USB Device Serial Port Events
 

Classes

struct  _CDCDParseData
 
struct  _CDCDSerialDriverConfigurationDescriptors
 
struct  _CDCDSerialDriverConfigurationDescriptorsOTG
 
struct  _CDCDSerialPort
 

Typedefs

typedef struct _CDCDParseData CDCDParseData
 
typedef struct _CDCDSerialPort CDCDSerialPort
 
typedef uint32_t(* CDCDSerialPortEventHandler) (uint32_t dwEvent, uint32_t dwParam, void *pArguments)
 

Functions

struct _CDCDSerialDriverConfigurationDescriptors __attribute__ ((__packed__)) CDCDSerialDriverConfigurationDescriptors
 
static void _GetLineCoding (CDCDSerialPort *pCdcd)
 
static uint32_t _Interfaces_Parse (USBGenericDescriptor *pDesc, CDCDParseData *pArg)
 
static void _SetControlLineState (CDCDSerialPort *pCdcd, const USBGenericRequest *request)
 
static void _SetLineCoding (CDCDSerialPort *pCdcd)
 
static void _SetLineCodingCallback (CDCDSerialPort *pCdcd)
 
static void _UsbDataSent_ZLP (CDCDSerialPort *pCdcd)
 
void CDCDSerial_ConfigureFunction (USBGenericDescriptor *pDescriptors, uint16_t wLength)
 
void CDCDSerial_ControlLineStateChanged (uint8_t DTR, uint8_t RTS)
 
static uint32_t CDCDSerial_EventHandler (uint32_t event, uint32_t param)
 
uint8_t CDCDSerial_GetControlLineState (void)
 
void CDCDSerial_GetLineCoding (CDCLineCoding *pLineCoding)
 
uint16_t CDCDSerial_GetSerialState (void)
 
void CDCDSerial_Initialize (USBDDriver *pUsbd, uint8_t bInterfaceNb)
 
uint8_t CDCDSerial_LineCodingIsToChange (CDCLineCoding *pLineCoding)
 
uint32_t CDCDSerial_Read (void *data, uint32_t size, TransferCallback callback, void *argument)
 
uint32_t CDCDSerial_RequestHandler (const USBGenericRequest *request)
 
void CDCDSerial_SetSerialState (uint16_t serialState)
 
uint32_t CDCDSerial_Write (void *data, uint32_t size, TransferCallback callback, void *argument)
 
void CDCDSerialDriver_ConfigurationChangedHandler (uint8_t cfgnum)
 
static uint8_t CDCDSerialDriver_GetControlLineState (void)
 
static void CDCDSerialDriver_GetLineCoding (CDCLineCoding *pLineCoding)
 
static uint16_t CDCDSerialDriver_GetSerialState (void)
 
void CDCDSerialDriver_Initialize (const USBDDriverDescriptors *pDescriptors)
 
static uint32_t CDCDSerialDriver_Read (void *data, uint32_t size, TransferCallback callback, void *argument)
 
void CDCDSerialDriver_RequestHandler (const USBGenericRequest *request)
 
static void CDCDSerialDriver_SetSerialState (uint16_t serialState)
 
static uint32_t CDCDSerialDriver_Write (void *data, uint32_t size, TransferCallback callback, void *argument)
 
uint8_t CDCDSerialPort_GetControlLineState (const CDCDSerialPort *pCdcd)
 
void CDCDSerialPort_GetLineCoding (const CDCDSerialPort *pCdcd, CDCLineCoding *pLineCoding)
 
uint16_t CDCDSerialPort_GetSerialState (const CDCDSerialPort *pCdcd)
 
void CDCDSerialPort_Initialize (CDCDSerialPort *pCdcd, USBDDriver *pUsbd, CDCDSerialPortEventHandler fEventHandler, void *pArg, uint8_t firstInterface, uint8_t numInterface)
 
USBGenericDescriptor * CDCDSerialPort_ParseInterfaces (CDCDSerialPort *pCdcd, USBGenericDescriptor *pDescriptors, uint32_t dwLength)
 
uint32_t CDCDSerialPort_Read (const CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)
 
uint32_t CDCDSerialPort_RequestHandler (CDCDSerialPort *pCdcd, const USBGenericRequest *request)
 
void CDCDSerialPort_SetSerialState (CDCDSerialPort *pCdcd, uint16_t wSerialState)
 
uint32_t CDCDSerialPort_Write (CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)
 

Variables

static CDCDSerialPort cdcdSerial
 
static CDCLineCoding lineCoding
 

Detailed Description

Typedef Documentation

◆ CDCDParseData

typedef struct _CDCDParseData CDCDParseData

Parse data extention for descriptor parsing

◆ CDCDSerialPort

Struct for USB CDC virtual COM serial port function.

◆ CDCDSerialPortEventHandler

typedef uint32_t(* CDCDSerialPortEventHandler) (uint32_t dwEvent, uint32_t dwParam, void *pArguments)

Callback function for serial port events

Definition at line 88 of file CDCDSerialPort.h.

Function Documentation

◆ __attribute__()

◆ _GetLineCoding()

static void _GetLineCoding ( CDCDSerialPort pCdcd)
static

Sends the current line coding information to the host through Control endpoint 0.

Parameters
pCdcdPointer to CDCDSerialPort instance.

Definition at line 191 of file CDCDSerialPort.c.

◆ _Interfaces_Parse()

static uint32_t _Interfaces_Parse ( USBGenericDescriptor *  pDesc,
CDCDParseData pArg 
)
static

Parse descriptors: Interface, Bulk IN/OUT, Interrupt IN.

Parameters
descPointer to descriptor list.
argArgument, pointer to AUDDParseData instance.

Definition at line 75 of file CDCDSerialPort.c.

◆ _SetControlLineState()

static void _SetControlLineState ( CDCDSerialPort pCdcd,
const USBGenericRequest request 
)
static

Changes the state of the serial driver according to the information sent by the host via a SetControlLineState request, and acknowledges the request with a zero-length packet.

Parameters
pCdcdPointer to CDCDSerialPort instance.
requestPointer to a USBGenericRequest instance.

Definition at line 209 of file CDCDSerialPort.c.

◆ _SetLineCoding()

static void _SetLineCoding ( CDCDSerialPort pCdcd)
static

Receives new line coding information from the USB host.

Parameters
pCdcdPointer to CDCDSerialPort instance.

Definition at line 175 of file CDCDSerialPort.c.

◆ _SetLineCodingCallback()

static void _SetLineCodingCallback ( CDCDSerialPort pCdcd)
static

Callback function which should be invoked after the data of a SetLineCoding request has been retrieved. Sends a zero-length packet to the host for acknowledging the request.

Parameters
pCdcdPointer to CDCDSerialPort instance.

Definition at line 146 of file CDCDSerialPort.c.

◆ _UsbDataSent_ZLP()

static void _UsbDataSent_ZLP ( CDCDSerialPort pCdcd)
static

Callback function for USBD_Write to send a zero-length packet.

Definition at line 380 of file CDCDSerialPort.c.

◆ CDCDSerial_ConfigureFunction()

void CDCDSerial_ConfigureFunction ( USBGenericDescriptor *  pDescriptors,
uint16_t  wLength 
)

Invoked whenever the device is changed by the host. Pointer to the descriptors for function configure. Length of descriptors in number of bytes.

Definition at line 129 of file CDCDSerial.c.

◆ CDCDSerial_ControlLineStateChanged()

void CDCDSerial_ControlLineStateChanged ( uint8_t  DTR,
uint8_t  RTS 
)

Invoked when the CDC ControlLineState is changed

Parameters
portPort number.
DTRNew DTR value.
RTSNew RTS value.

Definition at line 64 of file CDCDSerial_Callbacks.c.

◆ CDCDSerial_EventHandler()

static uint32_t CDCDSerial_EventHandler ( uint32_t  event,
uint32_t  param 
)
static

USB CDC Serial Port Event Handler.

Parameters
eventEvent code.
paramEvent parameter.

Definition at line 68 of file CDCDSerial.c.

◆ CDCDSerial_GetControlLineState()

uint8_t CDCDSerial_GetControlLineState ( void  )

Returns the current control line state of the RS-232 line.

Definition at line 197 of file CDCDSerial.c.

◆ CDCDSerial_GetLineCoding()

void CDCDSerial_GetLineCoding ( CDCLineCoding *  pLineCoding)

Copy current line coding settings to pointered space.

Parameters
pLineCodingPointer to CDCLineCoding instance.

Definition at line 208 of file CDCDSerial.c.

◆ CDCDSerial_GetSerialState()

uint16_t CDCDSerial_GetSerialState ( void  )

Returns the current status of the RS-232 line.

Definition at line 218 of file CDCDSerial.c.

◆ CDCDSerial_Initialize()

void CDCDSerial_Initialize ( USBDDriver pUsbd,
uint8_t  bInterfaceNb 
)

Initializes the USB Device CDC serial driver & USBD Driver.

Parameters
pUsbdPointer to USBDDriver instance.
bInterfaceNbInterface number for the function.

Definition at line 108 of file CDCDSerial.c.

◆ CDCDSerial_LineCodingIsToChange()

uint8_t CDCDSerial_LineCodingIsToChange ( CDCLineCoding *  pLineCoding)

Invoked when the CDC LineCoding is requested to changed

Parameters
portPort number.
pLineCodingPointer to new LineCoding settings.
Returns
USBRC_SUCCESS if ready to receive the line coding.

Definition at line 50 of file CDCDSerial_Callbacks.c.

◆ CDCDSerial_Read()

uint32_t CDCDSerial_Read ( void *  data,
uint32_t  size,
TransferCallback  callback,
void *  argument 
)

Receives data from the host through the virtual COM port created by the CDC device serial driver. This function behaves like USBD_Read.

Parameters
dataPointer to the data buffer to put received data.
sizeSize of the data buffer in bytes.
callbackOptional callback function to invoke when the transfer finishes.
argumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.

Definition at line 163 of file CDCDSerial.c.

◆ CDCDSerial_RequestHandler()

uint32_t CDCDSerial_RequestHandler ( const USBGenericRequest request)

Handles CDC-specific SETUP requests. Should be called from a re-implementation of USBDCallbacks_RequestReceived() method.

Parameters
requestPointer to a USBGenericRequest instance.

Definition at line 144 of file CDCDSerial.c.

◆ CDCDSerial_SetSerialState()

void CDCDSerial_SetSerialState ( uint16_t  serialState)

Sets the current serial state of the device to the given value.

Parameters
serialStateNew device state.

Definition at line 229 of file CDCDSerial.c.

◆ CDCDSerial_Write()

uint32_t CDCDSerial_Write ( void *  data,
uint32_t  size,
TransferCallback  callback,
void *  argument 
)

Sends a data buffer through the virtual COM port created by the CDC device serial driver. This function behaves exactly like USBD_Write.

Parameters
dataPointer to the data buffer to send.
sizeSize of the data buffer in bytes.
callbackOptional callback function to invoke when the transfer finishes.
argumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.

Definition at line 184 of file CDCDSerial.c.

◆ CDCDSerialDriver_ConfigurationChangedHandler()

void CDCDSerialDriver_ConfigurationChangedHandler ( uint8_t  cfgnum)

Invoked whenever the active configuration of device is changed by the host.

Parameters
cfgnumConfiguration number.

Definition at line 91 of file CDCDSerialDriver.c.

◆ CDCDSerialDriver_GetControlLineState()

static uint8_t CDCDSerialDriver_GetControlLineState ( void  )
inlinestatic

Returns the current control line state of the RS-232 line.

Definition at line 224 of file CDCDSerialDriver.h.

◆ CDCDSerialDriver_GetLineCoding()

static void CDCDSerialDriver_GetLineCoding ( CDCLineCoding *  pLineCoding)
inlinestatic

Copy current line coding settings to pointed space.

Parameters
pLineCodingPointer to CDCLineCoding instance.

Definition at line 216 of file CDCDSerialDriver.h.

◆ CDCDSerialDriver_GetSerialState()

static uint16_t CDCDSerialDriver_GetSerialState ( void  )
inlinestatic

Returns the current status of the RS-232 line.

Definition at line 232 of file CDCDSerialDriver.h.

◆ CDCDSerialDriver_Initialize()

void CDCDSerialDriver_Initialize ( const USBDDriverDescriptors pDescriptors)

Initializes the USB Device CDC serial driver & USBD Driver.

Parameters
pDescriptorsPointer to Descriptors list for CDC Serial Device.

Definition at line 71 of file CDCDSerialDriver.c.

◆ CDCDSerialDriver_Read()

static uint32_t CDCDSerialDriver_Read ( void *  data,
uint32_t  size,
TransferCallback  callback,
void *  argument 
)
inlinestatic

Receives data from the host through the virtual COM port created by the CDC device serial driver. This function behaves like USBD_Read.

Parameters
dataPointer to the data buffer to put received data.
sizeSize of the data buffer in bytes.
callbackOptional callback function to invoke when the transfer finishes.
argumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.

Definition at line 203 of file CDCDSerialDriver.h.

◆ CDCDSerialDriver_RequestHandler()

void CDCDSerialDriver_RequestHandler ( const USBGenericRequest request)

Handles CDC-specific SETUP requests. Should be called from a re-implementation of USBDCallbacks_RequestReceived() method.

Parameters
requestPointer to a USBGenericRequest instance.

Definition at line 108 of file CDCDSerialDriver.c.

◆ CDCDSerialDriver_SetSerialState()

static void CDCDSerialDriver_SetSerialState ( uint16_t  serialState)
inlinestatic

Sets the current serial state of the device to the given value.

Parameters
serialStateNew device state.

Definition at line 241 of file CDCDSerialDriver.h.

◆ CDCDSerialDriver_Write()

static uint32_t CDCDSerialDriver_Write ( void *  data,
uint32_t  size,
TransferCallback  callback,
void *  argument 
)
inlinestatic

Sends a data buffer through the virtual COM port created by the CDC device serial driver. This function behaves exactly like USBD_Write.

Parameters
dataPointer to the data buffer to send.
sizeSize of the data buffer in bytes.
callbackOptional callback function to invoke when the transfer finishes.
argumentOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.

Definition at line 183 of file CDCDSerialDriver.h.

◆ CDCDSerialPort_GetControlLineState()

uint8_t CDCDSerialPort_GetControlLineState ( const CDCDSerialPort pCdcd)

Returns the current control line state of the RS-232 line.

Parameters
pCdcdPointer to CDCDSerialPort instance.

Definition at line 432 of file CDCDSerialPort.c.

◆ CDCDSerialPort_GetLineCoding()

void CDCDSerialPort_GetLineCoding ( const CDCDSerialPort pCdcd,
CDCLineCoding *  pLineCoding 
)

Copy current line coding settings to appointed space.

Parameters
pCdcdPointer to CDCDSerialPort instance.
pLineCodingPointer to CDCLineCoding instance.

Definition at line 442 of file CDCDSerialPort.c.

◆ CDCDSerialPort_GetSerialState()

uint16_t CDCDSerialPort_GetSerialState ( const CDCDSerialPort pCdcd)

Returns the current status of the RS-232 line.

Parameters
pCdcdPointer to CDCDSerialPort instance.

Definition at line 457 of file CDCDSerialPort.c.

◆ CDCDSerialPort_Initialize()

void CDCDSerialPort_Initialize ( CDCDSerialPort pCdcd,
USBDDriver pUsbd,
CDCDSerialPortEventHandler  fEventHandler,
void *  pArg,
uint8_t  firstInterface,
uint8_t  numInterface 
)

Initializes the USB Device CDC serial port function.

Parameters
pCdcdPointer to CDCDSerialPort instance.
pUsbdPointer to USBDDriver instance.
fEventHandlerPointer to event handler function.
firstInterfaceFirst interface index for the function (0xFF to parse from descriptors).
numInterfaceNumber of interfaces for the function.

Definition at line 243 of file CDCDSerialPort.c.

◆ CDCDSerialPort_ParseInterfaces()

USBGenericDescriptor * CDCDSerialPort_ParseInterfaces ( CDCDSerialPort pCdcd,
USBGenericDescriptor *  pDescriptors,
uint32_t  dwLength 
)

Parse CDC Serial Port information for CDCDSerialPort instance. Accepted interfaces:

  • Communication Interface + Data Interface
  • Data Interface ONLY
    Parameters
    pCdcdPointer to CDCDSerialPort instance.
    pDescriptorsPointer to descriptor list.
    dwLengthDescriptor list size in bytes.

Definition at line 286 of file CDCDSerialPort.c.

◆ CDCDSerialPort_Read()

uint32_t CDCDSerialPort_Read ( const CDCDSerialPort pCdcd,
void *  pData,
uint32_t  dwSize,
TransferCallback  fCallback,
void *  pArg 
)

Receives data from the host through the virtual COM port created by the CDC device serial driver. This function behaves like USBD_Read.

Parameters
pCdcdPointer to CDCDSerialPort instance.
pDataPointer to the data buffer to put received data.
dwSizeSize of the data buffer in bytes.
fCallbackOptional callback function to invoke when the transfer finishes.
pArgOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.

Definition at line 363 of file CDCDSerialPort.c.

◆ CDCDSerialPort_RequestHandler()

uint32_t CDCDSerialPort_RequestHandler ( CDCDSerialPort pCdcd,
const USBGenericRequest request 
)

Handles CDC-specific SETUP requests. Should be called from a re-implementation of USBDCallbacks_RequestReceived() method.

Parameters
pCdcdPointer to CDCDSerialPort instance.
requestPointer to a USBGenericRequest instance.
Returns
USBRC_SUCCESS if request handled, otherwise error.

Definition at line 310 of file CDCDSerialPort.c.

◆ CDCDSerialPort_SetSerialState()

void CDCDSerialPort_SetSerialState ( CDCDSerialPort pCdcd,
uint16_t  wSerialState 
)

Sets the current serial state of the device to the given value.

Parameters
pCdcdPointer to CDCDSerialPort instance.
wSerialStateNew device state.

Definition at line 467 of file CDCDSerialPort.c.

◆ CDCDSerialPort_Write()

uint32_t CDCDSerialPort_Write ( CDCDSerialPort pCdcd,
void *  pData,
uint32_t  dwSize,
TransferCallback  fCallback,
void *  pArg 
)

Sends a data buffer through the virtual COM port created by the CDC device serial driver. This function behaves exactly like USBD_Write.

Parameters
pCdcdPointer to CDCDSerialPort instance.
pDataPointer to the data buffer to send.
dwSizeSize of the data buffer in bytes.
fCallbackOptional callback function to invoke when the transfer finishes.
pArgOptional argument to the callback function.
Returns
USBD_STATUS_SUCCESS if the read operation has been started normally; otherwise, the corresponding error code.
Note
The user can ensure finishing transmission before next transmission through a flag in fCallback in application layer.

Definition at line 399 of file CDCDSerialPort.c.

Variable Documentation

◆ cdcdSerial

CDCDSerialPort cdcdSerial
static

Serial Port instance list

Definition at line 57 of file CDCDSerial.c.

◆ lineCoding

CDCLineCoding lineCoding
static

Line coding values

Definition at line 65 of file CDCDSerialPort.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:02