The Endpoint 0 Service functions provide an API to establish communication with the USB Host using control endpoint 0.
◆ Cy_USBFS_Dev_Drv_Ep0GetSetup()
Reads the setup packed from the Endpoint 0 hardware buffer.
- Parameters
-
base | The pointer to the USBFS instance. |
buffer | The pointer to the buffer for data read from the Endpoint 0. |
context | The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
◆ Cy_USBFS_Dev_Drv_Ep0Write()
Writes data into Endpoint 0 hardware buffer and returns how many bytes were written.
- Parameters
-
base | The pointer to the USBFS instance. |
buffer | The pointer to the buffer containing data bytes to write. To switch a transfer from the data stage to status, pass NULL as a pointer. |
size | The number of bytes to write. Setting the size to zero sends to the bus zero-length data packet. |
context | The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
- Returns
- The number of bytes that were written.
◆ Cy_USBFS_Dev_Drv_Ep0Read()
Start receiving a packet into the Endpoint 0 hardware buffer.
- Parameters
-
base | The pointer to the USBFS instance. |
buffer | The pointer to buffer that stores data that was read. |
size | The number of bytes to read. Reading zero bytes switch control transfer to status stage. |
context | The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
◆ Cy_USBFS_Dev_Drv_Ep0ReadResult()
Reads data from the Endpoint 0 hardware and returns the number of read bytes.
- Parameters
-
base | The pointer to the USBFS instance. |
context | The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure. |
- Returns
- The number of read bytes.
◆ Cy_USBFS_Dev_Drv_Ep0Stall()
__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall |
( |
USBFS_Type * |
base | ) |
|
Stalls endpoint 0.
- Parameters
-
base | The pointer to the USBFS instance. |
◆ Cy_USBFS_Dev_Drv_GetEp0MaxPacket()
__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0MaxPacket |
( |
USBFS_Type const * |
base | ) |
|
Returns the endpoint 0 maximum packet size that can be for read or write from the endpoint 0 buffer.
- Parameters
-
base | The pointer to the USBFS instance. |
- Returns
- The endpoint 0 maximum packet size (endpoint 0 has a dedicated hardware buffer).