Hardware Abstraction Layer (HAL)

General Description

APIs relating specifically to management of endpoint zero.

Functions

uint32_t cyhal_usb_dev_ep0_get_max_packet (cyhal_usb_dev_t *obj)
 Get wMaxPacketSize of endpoint 0. More...
 
void cyhal_usb_dev_ep0_setup_read_result (cyhal_usb_dev_t *obj, uint8_t *buffer, uint32_t size)
 Read the contents of the SETUP packet. More...
 
void cyhal_usb_dev_ep0_read (cyhal_usb_dev_t *obj, uint8_t *buffer, uint32_t size)
 Start receiving a packet of up to wMaxPacketSize on endpoint 0. More...
 
uint32_t cyhal_usb_dev_ep0_read_result (cyhal_usb_dev_t *obj)
 Read the contents of a received packet. More...
 
uint32_t cyhal_usb_dev_ep0_write (cyhal_usb_dev_t *obj, uint8_t *buffer, uint32_t size)
 Write a packet on endpoint 0. More...
 
void cyhal_usb_dev_ep0_stall (cyhal_usb_dev_t *obj)
 Protocol stall on endpoint 0. More...
 

Function Documentation

◆ cyhal_usb_dev_ep0_get_max_packet()

uint32_t cyhal_usb_dev_ep0_get_max_packet ( cyhal_usb_dev_t obj)

Get wMaxPacketSize of endpoint 0.

The endpoint 0 has dedicated buffer.

Parameters
[in,out]objThe USB device object
Returns
The size allocated for endpoint 0

◆ cyhal_usb_dev_ep0_setup_read_result()

void cyhal_usb_dev_ep0_setup_read_result ( cyhal_usb_dev_t obj,
uint8_t *  buffer,
uint32_t  size 
)

Read the contents of the SETUP packet.

Parameters
[in,out]objThe USB device object
[in]bufferBuffer to fill with data
[in]sizeSize of buffer passed in

◆ cyhal_usb_dev_ep0_read()

void cyhal_usb_dev_ep0_read ( cyhal_usb_dev_t obj,
uint8_t *  buffer,
uint32_t  size 
)

Start receiving a packet of up to wMaxPacketSize on endpoint 0.

Parameters
[in,out]objThe USB device object
[in]bufferBuffer to fill with the data read
[in]sizeSize of buffer

◆ cyhal_usb_dev_ep0_read_result()

uint32_t cyhal_usb_dev_ep0_read_result ( cyhal_usb_dev_t obj)

Read the contents of a received packet.

Parameters
[in,out]objThe USB device object
Returns
Actual number of bytes that was read

◆ cyhal_usb_dev_ep0_write()

uint32_t cyhal_usb_dev_ep0_write ( cyhal_usb_dev_t obj,
uint8_t *  buffer,
uint32_t  size 
)

Write a packet on endpoint 0.

Parameters
[in,out]objThe USB device object
[in]bufferBuffer fill with data to send
[in]sizeSize of data to send
Returns
The number of bytes that were written.

◆ cyhal_usb_dev_ep0_stall()

void cyhal_usb_dev_ep0_stall ( cyhal_usb_dev_t obj)

Protocol stall on endpoint 0.

Stall all IN and OUT packets on endpoint 0 until a SETUP packet is received.

Parameters
[in,out]objThe USB device object
Note
The stall is cleared automatically when a setup packet is received