Functions | |
cy_en_usb_dev_status_t | Cy_USB_Dev_CDC_Init (cy_stc_usb_dev_cdc_config_t const *config, cy_stc_usb_dev_cdc_context_t *context, cy_stc_usb_dev_context_t *devContext) |
Initializes the CDC class. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_CDC_PutData (uint32_t port, uint8_t const *buffer, uint32_t size, cy_stc_usb_dev_cdc_context_t *context) |
Sends a specified number of bytes to USB Host. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_CDC_PutString (uint32_t port, char_t const *string, int32_t timeout, cy_stc_usb_dev_cdc_context_t *context) |
Sends a null terminated string to the USB Host. More... | |
__STATIC_INLINE cy_en_usb_dev_status_t | Cy_USB_Dev_CDC_PutChar (uint32_t port, char_t ch, cy_stc_usb_dev_cdc_context_t *context) |
Sends a single character to the USB Host. More... | |
uint32_t | Cy_USB_Dev_CDC_GetCount (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns the number of bytes that were received from the USB Host and can be read using Cy_USB_Dev_CDC_GetData or Cy_USB_Dev_CDC_GetChar functions. More... | |
bool | Cy_USB_Dev_CDC_IsDataReady (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns status if the COM port (CDC Data interface) received data from the USB Host (including zero-length packet). More... | |
bool | Cy_USB_Dev_CDC_IsReady (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns status if the COM port (CDC Data interface) is ready for sending new data. More... | |
uint32_t | Cy_USB_Dev_CDC_GetData (uint32_t port, uint8_t *buffer, uint32_t size, cy_stc_usb_dev_cdc_context_t *context) |
Read a specified number of data bytes received from USB Host by the COM port (CDC Data interface). More... | |
uint32_t | Cy_USB_Dev_CDC_GetAll (uint32_t port, uint8_t *buffer, uint32_t maxSize, cy_stc_usb_dev_cdc_context_t *context) |
Read all data received from USB Host by the COM port (CDC Data interface). More... | |
char_t | Cy_USB_Dev_CDC_GetChar (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Reads one byte of received data. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_CDC_IsLineChanged (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns the clear-on-read status of the COM port. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_CDC_GetLineControl (uint32_t port, cy_stc_usb_dev_cdc_context_t const *context) |
Returns the line control bitmap for the COM port. More... | |
uint32_t | Cy_USB_Dev_CDC_GetDTERate (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns the data terminal rate set for this port in bits per second. More... | |
__STATIC_INLINE cy_en_usb_dev_cdc_stop_bit_t | Cy_USB_Dev_CDC_GetCharFormat (uint32_t port, cy_stc_usb_dev_cdc_context_t const *context) |
Returns the number of stop bits for the COM port. More... | |
__STATIC_INLINE cy_en_usb_dev_cdc_parity_type_t | Cy_USB_Dev_CDC_GetParity (uint32_t port, cy_stc_usb_dev_cdc_context_t const *context) |
Returns the parity type for the COM port. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_CDC_GetDataBits (uint32_t port, cy_stc_usb_dev_cdc_context_t const *context) |
Returns the number of data bits for the COM port. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_CDC_SendSerialState (uint32_t port, uint32_t serialState, cy_stc_usb_dev_cdc_context_t *context) |
Sends the serial state notification to the host using the COM port (CDC interface) IN interrupt endpoint. More... | |
bool | Cy_USB_Dev_CDC_IsNotificationReady (uint32_t port, cy_stc_usb_dev_cdc_context_t *context) |
Returns if the COM port (CDC interface) is ready to send notification to the USB Host. More... | |
__STATIC_INLINE void | Cy_USB_Dev_CDC_RegisterUserCallbacks (cy_cb_usb_dev_request_received_t requestReceivedHandle, cy_cb_usb_dev_request_cmplt_t requestCompletedHandle, cy_stc_usb_dev_cdc_context_t *context) |
Registering user callback to handle CDC class requests that are not supported by provided CDC request handler. More... | |
__STATIC_INLINE cy_stc_usb_dev_class_t * | Cy_USB_Dev_CDC_GetClass (cy_stc_usb_dev_cdc_context_t *context) |
Returns pointer to the CDC class structure. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_CDC_GetSerialState (uint32_t port, cy_stc_usb_dev_cdc_context_t const *context) |
Returns the current serial state value for the COM port. More... | |
cy_en_usb_dev_status_t Cy_USB_Dev_CDC_Init | ( | cy_stc_usb_dev_cdc_config_t const * | config, |
cy_stc_usb_dev_cdc_context_t * | context, | ||
cy_stc_usb_dev_context_t * | devContext | ||
) |
Initializes the CDC class.
This function must be called to enable USB Device CDC functionality.
config | The pointer to the CDC configuration structure cy_stc_usb_dev_cdc_config_t. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
devContext | The pointer to the USB Device context structure cy_stc_usb_dev_context_t. |
cy_en_usb_dev_status_t Cy_USB_Dev_CDC_PutData | ( | uint32_t | port, |
uint8_t const * | buffer, | ||
uint32_t | size, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Sends a specified number of bytes to USB Host.
Call Cy_USB_Dev_CDC_IsReady function to ensure that the COM port (CDC Data interface) is ready for sending data to the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
buffer | The pointer to the buffer containing data bytes to be sent. Allocate buffer using CY_USB_DEV_ALLOC_ENDPOINT_BUFFER macro to make it USBFS driver configuration independent (See Allocate Data Endpoint Buffer for more information). |
size | The number of bytes to send. This value must be less than or equal to the maximum packet size of the CDC Data interface IN endpoint that belongs to the specified COM port. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
cy_en_usb_dev_status_t Cy_USB_Dev_CDC_PutString | ( | uint32_t | port, |
char_t const * | string, | ||
int32_t | timeout, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Sends a null terminated string to the USB Host.
This function is blocking and returns after successful USB Host transfer, or an error or timeout occurred. Call Cy_USB_Dev_CDC_IsReady function to ensure that the COM port (CDC Data interface) is ready for sending data to the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
string | The pointer to the string to be sent. The string must be allocated following rules in the section Allocate Data Endpoint Buffer to be USBFS driver configuration independent. |
timeout | Defines in milliseconds the time for which this function can block. If that time expires, the function returns. To wait forever, pass CY_USB_DEV_WAIT_FOREVER. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE cy_en_usb_dev_status_t Cy_USB_Dev_CDC_PutChar | ( | uint32_t | port, |
char_t | ch, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Sends a single character to the USB Host.
Call Cy_USB_Dev_CDC_IsReady function to ensure that the COM port (CDC Data interface) is ready for sending data to the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
ch | Character to be sent. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint32_t Cy_USB_Dev_CDC_GetCount | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns the number of bytes that were received from the USB Host and can be read using Cy_USB_Dev_CDC_GetData or Cy_USB_Dev_CDC_GetChar functions.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USB_Dev_CDC_IsDataReady | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns status if the COM port (CDC Data interface) received data from the USB Host (including zero-length packet).
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USB_Dev_CDC_IsReady | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns status if the COM port (CDC Data interface) is ready for sending new data.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint32_t Cy_USB_Dev_CDC_GetData | ( | uint32_t | port, |
uint8_t * | buffer, | ||
uint32_t | size, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Read a specified number of data bytes received from USB Host by the COM port (CDC Data interface).
Call Cy_USB_Dev_CDC_IsDataReady function to ensure that data is received from the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
buffer | The pointer to buffer that stores data that was read. Allocate buffer using CY_USB_DEV_ALLOC_ENDPOINT_BUFFER macro to make it USBFS driver configuration independent (See Allocate Data Endpoint Buffer for more information). |
size | The number of bytes to read. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data keeping. The user must not modify anything in this structure. |
uint32_t Cy_USB_Dev_CDC_GetAll | ( | uint32_t | port, |
uint8_t * | buffer, | ||
uint32_t | maxSize, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Read all data received from USB Host by the COM port (CDC Data interface).
Call Cy_USB_Dev_CDC_IsDataReady function to ensure that data is received from the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
buffer | The pointer to buffer that stores data that was read. Allocate buffer using CY_USB_DEV_ALLOC_ENDPOINT_BUFFER macro to make it USBFS driver configuration independent (See Allocate Data Endpoint Buffer for more information). |
maxSize | The size of buffer to read data into. This value must be not be less then CDC Data interface OUT endpoint maximum packet size that belongs to specified COM port. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
char_t Cy_USB_Dev_CDC_GetChar | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Reads one byte of received data.
Call Cy_USB_Dev_CDC_IsDataReady function to ensure that data is received from the USB Host before calling this function.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_CDC_IsLineChanged | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns the clear-on-read status of the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_CDC_GetLineControl | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t const * | context | ||
) |
Returns the line control bitmap for the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint32_t Cy_USB_Dev_CDC_GetDTERate | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns the data terminal rate set for this port in bits per second.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE cy_en_usb_dev_cdc_stop_bit_t Cy_USB_Dev_CDC_GetCharFormat | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t const * | context | ||
) |
Returns the number of stop bits for the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE cy_en_usb_dev_cdc_parity_type_t Cy_USB_Dev_CDC_GetParity | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t const * | context | ||
) |
Returns the parity type for the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_CDC_GetDataBits | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t const * | context | ||
) |
Returns the number of data bits for the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data keeping. The user must not modify anything in this structure. |
cy_en_usb_dev_status_t Cy_USB_Dev_CDC_SendSerialState | ( | uint32_t | port, |
uint32_t | serialState, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Sends the serial state notification to the host using the COM port (CDC interface) IN interrupt endpoint.
Call Cy_USB_Dev_CDC_IsNotificationReady function to ensure that COM port (CDC interface) is ready send notification before calling this function.
port | COM port number. Valid ports are 0 and 1. |
serialState | 16-bit value that will be sent from the USB Device to the USB Host as SERIAL_STATE notification using the CDC interface IN interrupt endpoint. Refer to revision 1.2 of the CDC PSTN Subclass specification for bit field definitions of the 16-bit serial state value. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
bool Cy_USB_Dev_CDC_IsNotificationReady | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Returns if the COM port (CDC interface) is ready to send notification to the USB Host.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE void Cy_USB_Dev_CDC_RegisterUserCallbacks | ( | cy_cb_usb_dev_request_received_t | requestReceivedHandle, |
cy_cb_usb_dev_request_cmplt_t | requestCompletedHandle, | ||
cy_stc_usb_dev_cdc_context_t * | context | ||
) |
Registering user callback to handle CDC class requests that are not supported by provided CDC request handler.
requestReceivedHandle | The pointer to a callback function. This function is called when setup packet was received from USB Host but was not recognized, therefore might require the user class processing. To remove callback function pass NULL as function pointer. |
requestCompletedHandle | The pointer to a callback function. This function is called when USB Device received data from the USB Host as part of current request processing. The requestReceivedHandle function must enable notification to trigger this event. This makes sense only when CDC request processing requires a data stage. To remove callback function pass NULL as function pointer. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the Audio Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE cy_stc_usb_dev_class_t * Cy_USB_Dev_CDC_GetClass | ( | cy_stc_usb_dev_cdc_context_t * | context | ) |
Returns pointer to the CDC class structure.
This function is useful to override class event handlers using Class Support Functions.
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_CDC_GetSerialState | ( | uint32_t | port, |
cy_stc_usb_dev_cdc_context_t const * | context | ||
) |
Returns the current serial state value for the COM port.
port | COM port number. Valid ports are 0 and 1. |
context | The pointer to the context structure cy_stc_usb_dev_cdc_context_t allocated by the user. The structure is used during the CDC Class operation for internal configuration and data retention. The user must not modify anything in this structure. |