Functions | |
cy_en_usb_dev_status_t | Cy_USB_Dev_StartReadEp (uint32_t endpoint, cy_stc_usb_dev_context_t *context) |
Start a reading on a certain endpoint. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_ReadEpBlocking (uint32_t endpoint, uint8_t *buffer, uint32_t size, uint32_t *actSize, int32_t timeout, cy_stc_usb_dev_context_t *context) |
Read data received from USB Host from a certain endpoint. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_ReadEpNonBlocking (uint32_t endpoint, uint8_t *buffer, uint32_t size, uint32_t *actSize, cy_stc_usb_dev_context_t *context) |
Read data received from USB Host from a certain endpoint. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_AbortEpTransfer (uint32_t endpoint, cy_stc_usb_dev_context_t *context) |
Aborts pending read or write endpoint operation. More... | |
__STATIC_INLINE uint32_t | Cy_USB_Dev_GetEpNumToRead (uint32_t endpoint, cy_stc_usb_dev_context_t const *context) |
Returns the number of bytes that available to be read from a certain endpoint buffer. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_WriteEpBlocking (uint32_t endpoint, uint8_t const *buffer, uint32_t size, int32_t timeout, cy_stc_usb_dev_context_t *context) |
Write data to be transferred to USB Host from a certain endpoint. More... | |
cy_en_usb_dev_status_t | Cy_USB_Dev_WriteEpNonBlocking (uint32_t endpoint, uint8_t const *buffer, uint32_t size, cy_stc_usb_dev_context_t *context) |
Write data to be transferred to USB Host from a certain endpoint. More... | |
__STATIC_INLINE void | Cy_USB_Dev_OverwriteHandleTimeout (cy_fn_usb_dev_handle_timeout_ptr_t handleTimeout, cy_stc_usb_dev_context_t *context) |
Overwrite the handle timeout function that is implemented internally. More... | |
cy_en_usb_dev_status_t Cy_USB_Dev_StartReadEp | ( | uint32_t | endpoint, |
cy_stc_usb_dev_context_t * | context | ||
) |
Start a reading on a certain endpoint.
endpoint | The OUT data endpoint number. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device 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_ReadEpBlocking | ( | uint32_t | endpoint, |
uint8_t * | buffer, | ||
uint32_t | size, | ||
uint32_t * | actSize, | ||
int32_t | timeout, | ||
cy_stc_usb_dev_context_t * | context | ||
) |
Read data received from USB Host from a certain endpoint.
Before calling this function, Cy_USB_Dev_StartReadEp must be called. This function is blocking and returns after successful USB Host transfer, or an error or timeout occurred.
endpoint | The OUT data endpoint number. |
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. This value must be less or equal to endpoint maximum packet size. |
actSize | The number of bytes that were actually read. |
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_context_t allocated by the user. The structure is used during the USB Device 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_ReadEpNonBlocking | ( | uint32_t | endpoint, |
uint8_t * | buffer, | ||
uint32_t | size, | ||
uint32_t * | actSize, | ||
cy_stc_usb_dev_context_t * | context | ||
) |
Read data received from USB Host from a certain endpoint.
Before calling this function, Cy_USB_Dev_StartReadEp must be called.
endpoint | The OUT data endpoint number. |
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. This value must be less than or equal to endpoint maximum packet size. |
actSize | The number of bytes that were actually read. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device 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_AbortEpTransfer | ( | uint32_t | endpoint, |
cy_stc_usb_dev_context_t * | context | ||
) |
Aborts pending read or write endpoint operation.
If there is any bus activity after abort operation requested the function waits for its completion or timeout. The timeout is time to transfer bulk or interrupt packet of maximum playload size. If this bus activity is a transfer to the aborting endpoint the received data is lost and endpoint transfer completion callbacks is not invoked. After function returns new read or write endpoint operation can be submitted.
endpoint | The data endpoint number. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE uint32_t Cy_USB_Dev_GetEpNumToRead | ( | uint32_t | endpoint, |
cy_stc_usb_dev_context_t const * | context | ||
) |
Returns the number of bytes that available to be read from a certain endpoint buffer.
Before calling this function ensure that the Host wrote data into the endpoint. The returned value is updated after the Host access to the endpoint but remains unchanged after data has been read from the endpoint buffer.
endpoint | The OUT data endpoint number. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device 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_WriteEpBlocking | ( | uint32_t | endpoint, |
uint8_t const * | buffer, | ||
uint32_t | size, | ||
int32_t | timeout, | ||
cy_stc_usb_dev_context_t * | context | ||
) |
Write data to be transferred to USB Host from a certain endpoint.
This function is blocking and returns after successful USB Host transfer, or an error or timeout occurred.
endpoint | The IN data endpoint number. |
buffer | The pointer to the buffer containing data bytes to write. 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 write. This value must be less than or equal to endpoint maximum packet size. |
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_context_t allocated by the user. The structure is used during the USB Device 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_WriteEpNonBlocking | ( | uint32_t | endpoint, |
uint8_t const * | buffer, | ||
uint32_t | size, | ||
cy_stc_usb_dev_context_t * | context | ||
) |
Write data to be transferred to USB Host from a certain endpoint.
endpoint | The IN data endpoint number. |
buffer | The pointer to the buffer containing data bytes to write. 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 write. This value must be less than or equal to endpoint maximum packet size. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
__STATIC_INLINE void Cy_USB_Dev_OverwriteHandleTimeout | ( | cy_fn_usb_dev_handle_timeout_ptr_t | handleTimeout, |
cy_stc_usb_dev_context_t * | context | ||
) |
Overwrite the handle timeout function that is implemented internally.
The internal implementation converts one timeout unit to milliseconds.
handleTimeout | The pointer to function to be executed to handle timeout for blocking operations. |
context | The pointer to the context structure cy_stc_usb_dev_context_t allocated by the user. The structure is used during the USB Device operation for internal configuration and data retention. The user must not modify anything in this structure. |