MTB CAT1 Peripheral driver library
Endpoint 0 Service Functions

General Description

The Endpoint 0 Service functions provide an API to establish communication with the USB Host using control endpoint 0.

Functions

void Cy_USBFS_Dev_Drv_Ep0GetSetup (USBFS_Type const *base, uint8_t *buffer, cy_stc_usbfs_dev_drv_context_t const *context)
 Reads the setup packed from the Endpoint 0 hardware buffer. More...
 
uint32_t Cy_USBFS_Dev_Drv_Ep0Write (USBFS_Type *base, uint8_t const *buffer, uint32_t size, cy_stc_usbfs_dev_drv_context_t *context)
 Writes data into Endpoint 0 hardware buffer and returns how many bytes were written. More...
 
void Cy_USBFS_Dev_Drv_Ep0Read (USBFS_Type *base, uint8_t *buffer, uint32_t size, cy_stc_usbfs_dev_drv_context_t *context)
 Start receiving a packet into the Endpoint 0 hardware buffer. More...
 
uint32_t Cy_USBFS_Dev_Drv_Ep0ReadResult (USBFS_Type const *base, cy_stc_usbfs_dev_drv_context_t *context)
 Reads data from the Endpoint 0 hardware and returns the number of read bytes. More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall (USBFS_Type *base)
 Stalls endpoint 0. More...
 
__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. More...
 

Function Documentation

◆ Cy_USBFS_Dev_Drv_Ep0GetSetup()

void Cy_USBFS_Dev_Drv_Ep0GetSetup ( USBFS_Type const *  base,
uint8_t *  buffer,
cy_stc_usbfs_dev_drv_context_t const *  context 
)

Reads the setup packed from the Endpoint 0 hardware buffer.

Parameters
baseThe pointer to the USBFS instance.
bufferThe pointer to the buffer for data read from the Endpoint 0.
contextThe 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()

uint32_t Cy_USBFS_Dev_Drv_Ep0Write ( USBFS_Type *  base,
uint8_t const *  buffer,
uint32_t  size,
cy_stc_usbfs_dev_drv_context_t context 
)

Writes data into Endpoint 0 hardware buffer and returns how many bytes were written.

Parameters
baseThe pointer to the USBFS instance.
bufferThe pointer to the buffer containing data bytes to write. To switch a transfer from the data stage to status, pass NULL as a pointer.
sizeThe number of bytes to write. Setting the size to zero sends to the bus zero-length data packet.
contextThe 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()

void Cy_USBFS_Dev_Drv_Ep0Read ( USBFS_Type *  base,
uint8_t *  buffer,
uint32_t  size,
cy_stc_usbfs_dev_drv_context_t context 
)

Start receiving a packet into the Endpoint 0 hardware buffer.

Parameters
baseThe pointer to the USBFS instance.
bufferThe pointer to buffer that stores data that was read.
sizeThe number of bytes to read. Reading zero bytes switch control transfer to status stage.
contextThe 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()

uint32_t Cy_USBFS_Dev_Drv_Ep0ReadResult ( USBFS_Type const *  base,
cy_stc_usbfs_dev_drv_context_t context 
)

Reads data from the Endpoint 0 hardware and returns the number of read bytes.

Parameters
baseThe pointer to the USBFS instance.
contextThe 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
baseThe 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
baseThe pointer to the USBFS instance.
Returns
The endpoint 0 maximum packet size (endpoint 0 has a dedicated hardware buffer).