IceCube display
LED display to show IceCube event data
Endpoint management

USB endpoint configuration and status reporting. More...

Data Structures

struct  ep_config_t
 Endpoint configuration struct. More...
 

Endpoint configuration

enum  ep_type_t { EP_TYPE_CONTROL = 0, EP_TYPE_BULK = 2, EP_TYPE_INTERRUPT = 3, EP_TYPE_ISOCHRONOUS = 1 }
 List of endpoint types. More...
 
enum  ep_direction_t { EP_DIRECTION_OUT = (1 << 0), EP_DIRECTION_IN = (1 << 1), EP_DIRECTION_BIDIR = EP_DIRECTION_IN | EP_DIRECTION_OUT }
 Endpoint directions. More...
 
bool endpoint_configure (const struct ep_config_t *config)
 Initialise the USB endpoint described by config. More...
 
void endpoint_init_default (const uint8_t ep_num)
 Default endpoint initialisation function.
 
void endpoint_deconfigure (const uint8_t ep_num)
 Releases hardware and memory associated with the endpoint memory.
 
uint16_t endpoint_get_size (const uint8_t ep_num)
 Return the maximum endpoint packet size.
 

Endpoint stall

bool endpoint_stall (const uint8_t ep_num)
 Stall an endpoint.
 
bool endpoint_clear_stall (const uint8_t ep_num)
 Clear an endpoint stall.
 
bool endpoint_is_stalled (const uint8_t ep_num)
 Get endpoint stall status.
 

Endpoint DATAx toggle

void endpoint_reset_data_toggle (const uint8_t ep_num)
 Reset the DATAx toggle to DATA0.
 

Detailed Description

USB endpoint configuration and status reporting.

Enumeration Type Documentation

◆ ep_direction_t

Endpoint directions.

Enumerator
EP_DIRECTION_OUT 

OUT endpoint, for data from host to device.

EP_DIRECTION_IN 

IN endpoint, for data from device to host.

EP_DIRECTION_BIDIR 

Bidirectional endpoint.

◆ ep_type_t

enum ep_type_t

List of endpoint types.

Values of these constants corresponds to the bit values used in the USB endpoint descriptors. See Table 9-13 of the USB 2.0 standard.

Enumerator
EP_TYPE_CONTROL 

Control endpoint.

EP_TYPE_BULK 

Bulk endpoint.

EP_TYPE_INTERRUPT 

Interrupt endoint.

EP_TYPE_ISOCHRONOUS 

Isochronous endpoint.

Function Documentation

◆ endpoint_configure()

bool endpoint_configure ( const struct ep_config_t config)

Initialise the USB endpoint described by config.

This will allocate the hardware and memory as described by the microcontroller's manual and enable the required interrupts.

Note
Not all platforms support random endpoint allocation, so endpoints should be allocated starting from endpoint 0 up to the last endpoint. Failing to do so may result in endpoint memory corruption.
Returns
true if the endpoint configuration was succesful, false otherwise.