Classes | Functions
Collaboration diagram for Implementation of UDC:

Classes

struct  udc_string_desc_t
 USB device string descriptor Structure used to transfer ASCII strings to USB String descriptor structure. More...
 

Functions

static usb_conf_desc_t UDC_DESC_STORAGEudc_get_eof_conf (void)
 Returns a value to check the end of USB Configuration descriptor. More...
 
usb_iface_desc_t UDC_DESC_STORAGEudc_get_interface_desc (void)
 Returns a pointer on the current interface descriptor. More...
 
static bool udc_iface_disable (uint8_t iface_num)
 Disables an usb device interface (UDI) This routine call the UDI corresponding to interface number. More...
 
static bool udc_iface_enable (uint8_t iface_num, uint8_t setting_num)
 Enables an usb device interface (UDI) This routine calls the UDI corresponding to the interface and setting number. More...
 
bool udc_process_setup (void)
 Main routine to manage the USB SETUP request. More...
 
static bool udc_req_ep (void)
 Send the SETUP interface request to UDI. More...
 
static bool udc_req_iface (void)
 Send the SETUP interface request to UDI. More...
 
static bool udc_req_std_dev_clear_feature (void)
 Standard device request to change device status. More...
 
static bool udc_req_std_dev_get_configuration (void)
 Standard device request to get configuration number. More...
 
static bool udc_req_std_dev_get_descriptor (void)
 Standard device request to get descriptors about USB device. More...
 
static bool udc_req_std_dev_get_status (void)
 Standard device request to get device status. More...
 
static bool udc_req_std_dev_get_str_desc (void)
 Standard device request to get device string descriptor. More...
 
static bool udc_req_std_dev_set_address (void)
 Standard device request to set device address. More...
 
static bool udc_req_std_dev_set_configuration (void)
 Standard device request to enable a configuration. More...
 
static bool udc_req_std_dev_set_feature (void)
 Standard device request to set a feature. More...
 
static bool udc_req_std_iface_get_setting (void)
 Standard interface request to get the alternate setting number of an interface. More...
 
static bool udc_req_std_iface_set_setting (void)
 Standard interface request to set an alternate setting of an interface. More...
 
static bool udc_reqstd (void)
 Main routine to manage the standard USB SETUP request. More...
 
void udc_reset (void)
 Reset the current configuration of the USB device, This routines can be called by UDD when a RESET on the USB line occurs. More...
 
void udc_sof_notify (void)
 To signal that a SOF is occurred. More...
 
void udc_start (void)
 Start the USB Device stack. More...
 
void udc_stop (void)
 Stop the USB Device stack. More...
 
static bool udc_update_iface_desc (uint8_t iface_num, uint8_t setting_num)
 Search an interface descriptor This routine updates the internal pointer udc_ptr_iface. More...
 
static void udc_valid_address (void)
 Standard endpoint request to halt an endpoint. More...
 

Internal variables to manage the USB device

static le16_t udc_device_status
 Device status state (see enum usb_device_status in usb_protocol.h) More...
 
static COMPILER_WORD_ALIGNED uint8_t udc_iface_setting = 0
 Device interface setting value. More...
 
static COMPILER_WORD_ALIGNED uint8_t udc_num_configuration = 0
 Device Configuration number selected by the USB host. More...
 
static udc_config_speed_t UDC_DESC_STORAGEudc_ptr_conf
 Pointer on the selected speed device configuration. More...
 
static usb_iface_desc_t UDC_DESC_STORAGEudc_ptr_iface
 Pointer on interface descriptor used by SETUP request. More...
 

Internal structure to store the USB device main strings

static COMPILER_WORD_ALIGNED UDC_DESC_STORAGE usb_str_lgid_desc_t udc_string_desc_languageid
 Language ID of USB device (US ID by default) More...
 
static COMPILER_WORD_ALIGNED UDC_DESC_STORAGE struct udc_string_desc_t udc_string_desc
 
#define USB_DEVICE_MANUFACTURE_NAME_SIZE   0
 USB device manufacture name storage String is allocated only if USB_DEVICE_MANUFACTURE_NAME is declared by usb application configuration. More...
 
#define USB_DEVICE_PRODUCT_NAME_SIZE   0
 USB device product name storage String is allocated only if USB_DEVICE_PRODUCT_NAME is declared by usb application configuration. More...
 
#define USB_DEVICE_SERIAL_NAME_SIZE   0
 Get USB device serial number. More...
 

Detailed Description

Internal implementation

Macro Definition Documentation

◆ USB_DEVICE_MANUFACTURE_NAME_SIZE

#define USB_DEVICE_MANUFACTURE_NAME_SIZE   0

USB device manufacture name storage String is allocated only if USB_DEVICE_MANUFACTURE_NAME is declared by usb application configuration.

Definition at line 98 of file udc.c.

◆ USB_DEVICE_PRODUCT_NAME_SIZE

#define USB_DEVICE_PRODUCT_NAME_SIZE   0

USB device product name storage String is allocated only if USB_DEVICE_PRODUCT_NAME is declared by usb application configuration.

Definition at line 110 of file udc.c.

◆ USB_DEVICE_SERIAL_NAME_SIZE

#define USB_DEVICE_SERIAL_NAME_SIZE   0

Get USB device serial number.

Use the define USB_DEVICE_SERIAL_NAME to set static serial number.

For dynamic serial number set the define USB_DEVICE_GET_SERIAL_NAME_POINTER to a suitable pointer. This will also require the serial number length define USB_DEVICE_GET_SERIAL_NAME_LENGTH.

Definition at line 137 of file udc.c.

Function Documentation

◆ udc_get_eof_conf()

static usb_conf_desc_t UDC_DESC_STORAGE* udc_get_eof_conf ( void  )
static

Returns a value to check the end of USB Configuration descriptor.

Returns
address after the last byte of USB Configuration descriptor

Definition at line 165 of file udc.c.

◆ udc_get_interface_desc()

usb_iface_desc_t UDC_DESC_STORAGE* udc_get_interface_desc ( void  )

Returns a pointer on the current interface descriptor.

Returns
pointer on the current interface descriptor.

Definition at line 155 of file udc.c.

◆ udc_iface_disable()

static bool udc_iface_disable ( uint8_t  iface_num)
static

Disables an usb device interface (UDI) This routine call the UDI corresponding to interface number.

Parameters
iface_numInterface number to disable
Returns
1 if it is done or 0 if interface is not found

Definition at line 264 of file udc.c.

◆ udc_iface_enable()

static bool udc_iface_enable ( uint8_t  iface_num,
uint8_t  setting_num 
)
static

Enables an usb device interface (UDI) This routine calls the UDI corresponding to the interface and setting number.

Parameters
iface_numInterface number to enable
setting_numSetting number to enable
Returns
1 if it is done or 0 if interface is not found

Definition at line 316 of file udc.c.

◆ udc_process_setup()

bool udc_process_setup ( void  )

Main routine to manage the USB SETUP request.

Decodes and manages a setup request.

This function parses a USB SETUP request and submits an appropriate response back to the host or, in the case of SETUP OUT requests with data, sets up a buffer for receiving the data payload.

The main standard requests defined by the USB 2.0 standard are handled internally. The interface requests are sent to UDI, and the specific request sent to a specific application callback.

Returns
true if the request is supported, else the request is stalled by UDD

Definition at line 1092 of file udc.c.

◆ udc_req_ep()

static bool udc_req_ep ( void  )
static

Send the SETUP interface request to UDI.

Returns
true if the request is supported

Definition at line 1053 of file udc.c.

◆ udc_req_iface()

static bool udc_req_iface ( void  )
static

Send the SETUP interface request to UDI.

Returns
true if the request is supported

Definition at line 1018 of file udc.c.

◆ udc_req_std_dev_clear_feature()

static bool udc_req_std_dev_clear_feature ( void  )
static

Standard device request to change device status.

Returns
true if success

Definition at line 454 of file udc.c.

◆ udc_req_std_dev_get_configuration()

static bool udc_req_std_dev_get_configuration ( void  )
static

Standard device request to get configuration number.

Returns
true if success

Definition at line 778 of file udc.c.

◆ udc_req_std_dev_get_descriptor()

static bool udc_req_std_dev_get_descriptor ( void  )
static

Standard device request to get descriptors about USB device.

Returns
true if success

Definition at line 661 of file udc.c.

◆ udc_req_std_dev_get_status()

static bool udc_req_std_dev_get_status ( void  )
static

Standard device request to get device status.

Returns
true if success

Definition at line 415 of file udc.c.

◆ udc_req_std_dev_get_str_desc()

static bool udc_req_std_dev_get_str_desc ( void  )
static

Standard device request to get device string descriptor.

Returns
true if success

Definition at line 602 of file udc.c.

◆ udc_req_std_dev_set_address()

static bool udc_req_std_dev_set_address ( void  )
static

Standard device request to set device address.

Returns
true if success

Definition at line 585 of file udc.c.

◆ udc_req_std_dev_set_configuration()

static bool udc_req_std_dev_set_configuration ( void  )
static

Standard device request to enable a configuration.

Returns
true if success

Definition at line 793 of file udc.c.

◆ udc_req_std_dev_set_feature()

static bool udc_req_std_dev_set_feature ( void  )
static

Standard device request to set a feature.

Returns
true if success

Definition at line 495 of file udc.c.

◆ udc_req_std_iface_get_setting()

static bool udc_req_std_iface_get_setting ( void  )
static

Standard interface request to get the alternate setting number of an interface.

Returns
true if success

Definition at line 858 of file udc.c.

◆ udc_req_std_iface_set_setting()

static bool udc_req_std_iface_set_setting ( void  )
static

Standard interface request to set an alternate setting of an interface.

Returns
true if success

Definition at line 896 of file udc.c.

◆ udc_reqstd()

static bool udc_reqstd ( void  )
static

Main routine to manage the standard USB SETUP request.

Returns
true if the request is supported

Definition at line 924 of file udc.c.

◆ udc_reset()

void udc_reset ( void  )

Reset the current configuration of the USB device, This routines can be called by UDD when a RESET on the USB line occurs.

Reset the UDC.

Definition at line 368 of file udc.c.

◆ udc_sof_notify()

void udc_sof_notify ( void  )

To signal that a SOF is occurred.

The UDC must send the signal to all UDIs enabled

Definition at line 395 of file udc.c.

◆ udc_start()

void udc_start ( void  )

Start the USB Device stack.

Definition at line 351 of file udc.c.

◆ udc_stop()

void udc_stop ( void  )

Stop the USB Device stack.

Definition at line 358 of file udc.c.

◆ udc_update_iface_desc()

static bool udc_update_iface_desc ( uint8_t  iface_num,
uint8_t  setting_num 
)
static

Search an interface descriptor This routine updates the internal pointer udc_ptr_iface.

Parameters
iface_numInterface number to find in Configuration Descriptor
setting_numSetting number of interface to find
Returns
1 if found or 0 if not found

Definition at line 219 of file udc.c.

◆ udc_valid_address()

static void udc_valid_address ( void  )
static

Standard endpoint request to halt an endpoint.

Returns
true if success Change the address of device Callback called at the end of request set address

Definition at line 575 of file udc.c.

Variable Documentation

◆ udc_device_status

le16_t udc_device_status
static

Device status state (see enum usb_device_status in usb_protocol.h)

Definition at line 56 of file udc.c.

◆ udc_iface_setting

COMPILER_WORD_ALIGNED uint8_t udc_iface_setting = 0
static

Device interface setting value.

Definition at line 60 of file udc.c.

◆ udc_num_configuration

COMPILER_WORD_ALIGNED uint8_t udc_num_configuration = 0
static

Device Configuration number selected by the USB host.

Definition at line 64 of file udc.c.

◆ udc_ptr_conf

udc_config_speed_t UDC_DESC_STORAGE* udc_ptr_conf
static

Pointer on the selected speed device configuration.

Definition at line 67 of file udc.c.

◆ udc_ptr_iface

usb_iface_desc_t UDC_DESC_STORAGE* udc_ptr_iface
static

Pointer on interface descriptor used by SETUP request.

Definition at line 70 of file udc.c.

◆ udc_string_desc

COMPILER_WORD_ALIGNED UDC_DESC_STORAGE struct udc_string_desc_t udc_string_desc
static
Initial value:
= {
.header.bDescriptorType = USB_DT_STRING
}

Definition at line 150 of file udc.c.

◆ udc_string_desc_languageid

COMPILER_WORD_ALIGNED UDC_DESC_STORAGE usb_str_lgid_desc_t udc_string_desc_languageid
static
Initial value:
= {
.desc.bLength = sizeof(usb_str_lgid_desc_t),
.desc.bDescriptorType = USB_DT_STRING,
.string = {LE16(USB_LANGID_EN_US)}
}
English (United States)
Definition: usb_protocol.h:260
#define LE16(x)
Definition: compiler.h:890

Language ID of USB device (US ID by default)

Definition at line 82 of file udc.c.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07