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 |
typedef struct _CDCDParseData CDCDParseData |
Parse data extention for descriptor parsing
typedef struct _CDCDSerialPort CDCDSerialPort |
Struct for USB CDC virtual COM serial port function.
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.
struct _CDCDSerialDriverConfigurationDescriptors __attribute__ | ( | (__packed__) | ) |
|
static |
Sends the current line coding information to the host through Control endpoint 0.
pCdcd | Pointer to CDCDSerialPort instance. |
Definition at line 191 of file CDCDSerialPort.c.
|
static |
Parse descriptors: Interface, Bulk IN/OUT, Interrupt IN.
desc | Pointer to descriptor list. |
arg | Argument, pointer to AUDDParseData instance. |
Definition at line 75 of file CDCDSerialPort.c.
|
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.
pCdcd | Pointer to CDCDSerialPort instance. |
request | Pointer to a USBGenericRequest instance. |
Definition at line 209 of file CDCDSerialPort.c.
|
static |
Receives new line coding information from the USB host.
pCdcd | Pointer to CDCDSerialPort instance. |
Definition at line 175 of file CDCDSerialPort.c.
|
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.
pCdcd | Pointer to CDCDSerialPort instance. |
Definition at line 146 of file CDCDSerialPort.c.
|
static |
Callback function for USBD_Write to send a zero-length packet.
Definition at line 380 of file CDCDSerialPort.c.
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.
void CDCDSerial_ControlLineStateChanged | ( | uint8_t | DTR, |
uint8_t | RTS | ||
) |
Invoked when the CDC ControlLineState is changed
port | Port number. |
DTR | New DTR value. |
RTS | New RTS value. |
Definition at line 64 of file CDCDSerial_Callbacks.c.
|
static |
USB CDC Serial Port Event Handler.
event | Event code. |
param | Event parameter. |
Definition at line 68 of file CDCDSerial.c.
uint8_t CDCDSerial_GetControlLineState | ( | void | ) |
Returns the current control line state of the RS-232 line.
Definition at line 197 of file CDCDSerial.c.
void CDCDSerial_GetLineCoding | ( | CDCLineCoding * | pLineCoding | ) |
Copy current line coding settings to pointered space.
pLineCoding | Pointer to CDCLineCoding instance. |
Definition at line 208 of file CDCDSerial.c.
uint16_t CDCDSerial_GetSerialState | ( | void | ) |
Returns the current status of the RS-232 line.
Definition at line 218 of file CDCDSerial.c.
void CDCDSerial_Initialize | ( | USBDDriver * | pUsbd, |
uint8_t | bInterfaceNb | ||
) |
Initializes the USB Device CDC serial driver & USBD Driver.
pUsbd | Pointer to USBDDriver instance. |
bInterfaceNb | Interface number for the function. |
Definition at line 108 of file CDCDSerial.c.
uint8_t CDCDSerial_LineCodingIsToChange | ( | CDCLineCoding * | pLineCoding | ) |
Invoked when the CDC LineCoding is requested to changed
port | Port number. |
pLineCoding | Pointer to new LineCoding settings. |
Definition at line 50 of file CDCDSerial_Callbacks.c.
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.
data | Pointer to the data buffer to put received data. |
size | Size of the data buffer in bytes. |
callback | Optional callback function to invoke when the transfer finishes. |
argument | Optional argument to the callback function. |
Definition at line 163 of file CDCDSerial.c.
uint32_t CDCDSerial_RequestHandler | ( | const USBGenericRequest * | request | ) |
Handles CDC-specific SETUP requests. Should be called from a re-implementation of USBDCallbacks_RequestReceived() method.
request | Pointer to a USBGenericRequest instance. |
Definition at line 144 of file CDCDSerial.c.
void CDCDSerial_SetSerialState | ( | uint16_t | serialState | ) |
Sets the current serial state of the device to the given value.
serialState | New device state. |
Definition at line 229 of file CDCDSerial.c.
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.
data | Pointer to the data buffer to send. |
size | Size of the data buffer in bytes. |
callback | Optional callback function to invoke when the transfer finishes. |
argument | Optional argument to the callback function. |
Definition at line 184 of file CDCDSerial.c.
void CDCDSerialDriver_ConfigurationChangedHandler | ( | uint8_t | cfgnum | ) |
Invoked whenever the active configuration of device is changed by the host.
cfgnum | Configuration number. |
Definition at line 91 of file CDCDSerialDriver.c.
|
inlinestatic |
Returns the current control line state of the RS-232 line.
Definition at line 224 of file CDCDSerialDriver.h.
|
inlinestatic |
Copy current line coding settings to pointed space.
pLineCoding | Pointer to CDCLineCoding instance. |
Definition at line 216 of file CDCDSerialDriver.h.
|
inlinestatic |
Returns the current status of the RS-232 line.
Definition at line 232 of file CDCDSerialDriver.h.
void CDCDSerialDriver_Initialize | ( | const USBDDriverDescriptors * | pDescriptors | ) |
Initializes the USB Device CDC serial driver & USBD Driver.
pDescriptors | Pointer to Descriptors list for CDC Serial Device. |
Definition at line 71 of file CDCDSerialDriver.c.
|
inlinestatic |
Receives data from the host through the virtual COM port created by the CDC device serial driver. This function behaves like USBD_Read.
data | Pointer to the data buffer to put received data. |
size | Size of the data buffer in bytes. |
callback | Optional callback function to invoke when the transfer finishes. |
argument | Optional argument to the callback function. |
Definition at line 203 of file CDCDSerialDriver.h.
void CDCDSerialDriver_RequestHandler | ( | const USBGenericRequest * | request | ) |
Handles CDC-specific SETUP requests. Should be called from a re-implementation of USBDCallbacks_RequestReceived() method.
request | Pointer to a USBGenericRequest instance. |
Definition at line 108 of file CDCDSerialDriver.c.
|
inlinestatic |
Sets the current serial state of the device to the given value.
serialState | New device state. |
Definition at line 241 of file CDCDSerialDriver.h.
|
inlinestatic |
Sends a data buffer through the virtual COM port created by the CDC device serial driver. This function behaves exactly like USBD_Write.
data | Pointer to the data buffer to send. |
size | Size of the data buffer in bytes. |
callback | Optional callback function to invoke when the transfer finishes. |
argument | Optional argument to the callback function. |
Definition at line 183 of file CDCDSerialDriver.h.
uint8_t CDCDSerialPort_GetControlLineState | ( | const CDCDSerialPort * | pCdcd | ) |
Returns the current control line state of the RS-232 line.
pCdcd | Pointer to CDCDSerialPort instance. |
Definition at line 432 of file CDCDSerialPort.c.
void CDCDSerialPort_GetLineCoding | ( | const CDCDSerialPort * | pCdcd, |
CDCLineCoding * | pLineCoding | ||
) |
Copy current line coding settings to appointed space.
pCdcd | Pointer to CDCDSerialPort instance. |
pLineCoding | Pointer to CDCLineCoding instance. |
Definition at line 442 of file CDCDSerialPort.c.
uint16_t CDCDSerialPort_GetSerialState | ( | const CDCDSerialPort * | pCdcd | ) |
Returns the current status of the RS-232 line.
pCdcd | Pointer to CDCDSerialPort instance. |
Definition at line 457 of file CDCDSerialPort.c.
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.
pCdcd | Pointer to CDCDSerialPort instance. |
pUsbd | Pointer to USBDDriver instance. |
fEventHandler | Pointer to event handler function. |
firstInterface | First interface index for the function (0xFF to parse from descriptors). |
numInterface | Number of interfaces for the function. |
Definition at line 243 of file CDCDSerialPort.c.
USBGenericDescriptor * CDCDSerialPort_ParseInterfaces | ( | CDCDSerialPort * | pCdcd, |
USBGenericDescriptor * | pDescriptors, | ||
uint32_t | dwLength | ||
) |
Parse CDC Serial Port information for CDCDSerialPort instance. Accepted interfaces:
pCdcd | Pointer to CDCDSerialPort instance. |
pDescriptors | Pointer to descriptor list. |
dwLength | Descriptor list size in bytes. |
Definition at line 286 of file CDCDSerialPort.c.
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.
pCdcd | Pointer to CDCDSerialPort instance. |
pData | Pointer to the data buffer to put received data. |
dwSize | Size of the data buffer in bytes. |
fCallback | Optional callback function to invoke when the transfer finishes. |
pArg | Optional argument to the callback function. |
Definition at line 363 of file CDCDSerialPort.c.
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.
pCdcd | Pointer to CDCDSerialPort instance. |
request | Pointer to a USBGenericRequest instance. |
Definition at line 310 of file CDCDSerialPort.c.
void CDCDSerialPort_SetSerialState | ( | CDCDSerialPort * | pCdcd, |
uint16_t | wSerialState | ||
) |
Sets the current serial state of the device to the given value.
pCdcd | Pointer to CDCDSerialPort instance. |
wSerialState | New device state. |
Definition at line 467 of file CDCDSerialPort.c.
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.
pCdcd | Pointer to CDCDSerialPort instance. |
pData | Pointer to the data buffer to send. |
dwSize | Size of the data buffer in bytes. |
fCallback | Optional callback function to invoke when the transfer finishes. |
pArg | Optional argument to the callback function. |
Definition at line 399 of file CDCDSerialPort.c.
|
static |
Serial Port instance list
Definition at line 57 of file CDCDSerial.c.
|
static |
Line coding values
Definition at line 65 of file CDCDSerialPort.c.