RA Flexible Software Package Documentation
Release v5.7.0
|
|
Interface for USB functions.
The USB interface provides USB functionality.
Data Structures | |
struct | usb_cfg_t |
struct | usb_api_t |
struct | usb_instance_t |
Macros | |
#define | USB_BREQUEST |
b15-8 | |
#define | USB_GET_STATUS |
USB Standard request Get Status. | |
#define | USB_CLEAR_FEATURE |
USB Standard request Clear Feature. | |
#define | USB_REQRESERVED |
USB Standard request Reqreserved. | |
#define | USB_SET_FEATURE |
USB Standard request Set Feature. | |
#define | USB_REQRESERVED1 |
USB Standard request Reqreserved1. | |
#define | USB_SET_ADDRESS |
USB Standard request Set Address. | |
#define | USB_GET_DESCRIPTOR |
USB Standard request Get Descriptor. | |
#define | USB_SET_DESCRIPTOR |
USB Standard request Set Descriptor. | |
#define | USB_GET_CONFIGURATION |
USB Standard request Get Configuration. | |
#define | USB_SET_CONFIGURATION |
USB Standard request Set Configuration. | |
#define | USB_GET_INTERFACE |
USB Standard request Get Interface. | |
#define | USB_SET_INTERFACE |
USB Standard request Set Interface. | |
#define | USB_SYNCH_FRAME |
USB Standard request Synch Frame. | |
#define | USB_HOST_TO_DEV |
From host to device. | |
#define | USB_DEV_TO_HOST |
From device to host. | |
#define | USB_STANDARD |
Standard Request. | |
#define | USB_CLASS |
Class Request. | |
#define | USB_VENDOR |
Vendor Request. | |
#define | USB_DEVICE |
Device. | |
#define | USB_INTERFACE |
Interface. | |
#define | USB_ENDPOINT |
End Point. | |
#define | USB_OTHER |
Other. | |
#define | USB_NULL |
NULL pointer. | |
#define | USB_IP0 |
USB0 module. | |
#define | USB_IP1 |
USB1 module. | |
#define | USB_PIPE0 |
Pipe Number0. | |
#define | USB_PIPE1 |
Pipe Number1. | |
#define | USB_PIPE2 |
Pipe Number2. | |
#define | USB_PIPE3 |
Pipe Number3. | |
#define | USB_PIPE4 |
Pipe Number4. | |
#define | USB_PIPE5 |
Pipe Number5. | |
#define | USB_PIPE6 |
Pipe Number6. | |
#define | USB_PIPE7 |
Pipe Number7. | |
#define | USB_PIPE8 |
Pipe Number8. | |
#define | USB_PIPE9 |
Pipe Number9. | |
#define | USB_EP0 |
End Point Number0. | |
#define | USB_EP1 |
End Point Number1. | |
#define | USB_EP2 |
End Point Number2. | |
#define | USB_EP3 |
End Point Number3. | |
#define | USB_EP4 |
End Point Number4. | |
#define | USB_EP5 |
End Point Number5. | |
#define | USB_EP6 |
End Point Number6. | |
#define | USB_EP7 |
End Point Number7. | |
#define | USB_EP8 |
End Point Number8. | |
#define | USB_EP9 |
End Point Number9. | |
#define | USB_EP10 |
End Point Number10. | |
#define | USB_EP11 |
End Point Number11. | |
#define | USB_EP12 |
End Point Number12. | |
#define | USB_EP13 |
End Point Number13. | |
#define | USB_EP14 |
End Point Number14. | |
#define | USB_EP15 |
End Point Number15. | |
#define | USB_EP_DIR |
b7: Endpoint Direction | |
#define | USB_EP_DIR_IN |
b7: Endpoint Direction In | |
#define | USB_EP_DIR_OUT |
b7: Endpoint Direction Out | |
#define | USB_DT_DEVICE |
Device Descriptor. | |
#define | USB_DT_CONFIGURATION |
Configuration Descriptor. | |
#define | USB_DT_STRING |
String Descriptor. | |
#define | USB_DT_INTERFACE |
Interface Descriptor. | |
#define | USB_DT_ENDPOINT |
Endpoint Descriptor. | |
#define | USB_DT_DEVICE_QUALIFIER |
Device Qualifier Descriptor. | |
#define | USB_DT_OTHER_SPEED_CONF |
Other Speed Configuration Descriptor. | |
#define | USB_DT_INTERFACE_POWER |
Interface Power Descriptor. | |
#define | USB_DT_OTGDESCRIPTOR |
OTG Descriptor. | |
#define | USB_DT_HUBDESCRIPTOR |
HUB descriptor. | |
#define | USB_IFCLS_NOT |
Un corresponding Class. | |
#define | USB_IFCLS_AUD |
Audio Class. | |
#define | USB_IFCLS_CDC |
CDC Class. | |
#define | USB_IFCLS_CDCC |
CDC-Control Class. | |
#define | USB_IFCLS_HID |
HID Class. | |
#define | USB_IFCLS_PHY |
Physical Class. | |
#define | USB_IFCLS_IMG |
Image Class. | |
#define | USB_IFCLS_PRN |
Printer Class. | |
#define | USB_IFCLS_MAS |
Mass Storage Class. | |
#define | USB_IFCLS_HUB |
HUB Class. | |
#define | USB_IFCLS_CDCD |
CDC-Data Class. | |
#define | USB_IFCLS_CHIP |
Chip/Smart Card Class. | |
#define | USB_IFCLS_CNT |
Content-Security Class. | |
#define | USB_IFCLS_VID |
Video Class. | |
#define | USB_IFCLS_DIAG |
Diagnostic Device. | |
#define | USB_IFCLS_WIRE |
Wireless Controller. | |
#define | USB_IFCLS_APL |
Application-Specific. | |
#define | USB_IFCLS_VEN |
Vendor-Specific Class. | |
#define | USB_EP_IN |
In Endpoint. | |
#define | USB_EP_OUT |
Out Endpoint. | |
#define | USB_EP_ISO |
Isochronous Transfer. | |
#define | USB_EP_BULK |
Bulk Transfer. | |
#define | USB_EP_INT |
Interrupt Transfer. | |
#define | USB_CF_RESERVED |
Reserved(set to 1) | |
#define | USB_CF_SELFP |
Self Powered. | |
#define | USB_CF_BUSP |
Bus Powered. | |
#define | USB_CF_RWUPON |
Remote Wake up ON. | |
#define | USB_CF_RWUPOFF |
Remote Wake up OFF. | |
#define | USB_DD_BLENGTH |
Device Descriptor Length. | |
#define | USB_CD_BLENGTH |
Configuration Descriptor Length. | |
#define | USB_ID_BLENGTH |
Interface Descriptor Length. | |
#define | USB_ED_BLENGTH |
Endpoint Descriptor Length. | |
Typedefs | |
typedef void | usb_ctrl_t |
Enumerations | |
enum | usb_speed_t |
enum | usb_setup_status_t |
enum | usb_status_t |
enum | usb_class_t |
enum | usb_bcport_t |
enum | usb_onoff_t |
enum | usb_transfer_t |
enum | usb_transfer_type_t |
enum | usb_mode_t |
enum | usb_compliancetest_status_t |
enum | usb_typec_mode_t |
enum | usb_typec_plug_t |
enum | usb_typec_connection_status_t |
enum | usb_typec_vbus_status_t |
struct usb_cfg_t |
USB configuration.
Data Fields | ||
---|---|---|
usb_mode_t | usb_mode | USB_MODE_HOST/USB_MODE_PERI. |
usb_speed_t | usb_speed | USB speed (USB_HS/USB_FS/USB_LS) |
uint8_t | module_number | USB module number (USB_IP0/USB_IP1) |
usb_class_t | type | USB device class etc. |
usb_descriptor_t * | p_usb_reg | Pointer to the usb_decriptor_t structure area. |
usb_compliance_cb_t * | usb_complience_cb | |
IRQn_Type | irq | USBI dedicated interrupt number storage variable. |
IRQn_Type | irq_r | USBR dedicated interrupt number storage variable. |
IRQn_Type | irq_d0 | FS D0FIFO dedicated interrupt number storage variable. |
IRQn_Type | irq_d1 | FS D1FIFO dedicated interrupt number storage variable. |
IRQn_Type | hsirq | USBIR dedicated interrupt number storage variable. |
IRQn_Type | irq_typec | USB Type-C IR dedicated interrupt number storage variable. |
IRQn_Type | hsirq_d0 | HS D0FIFO dedicated interrupt number storage variable. |
IRQn_Type | hsirq_d1 | HS D1FIFO dedicated interrupt number storage variable. |
uint8_t | ipl | Variable to store the interrupt priority of USBI. |
uint8_t | ipl_r | Variable to store the interrupt priority of USBR. |
uint8_t | ipl_d0 | Variable to store the interrupt priority of FS D0FIFO. |
uint8_t | ipl_d1 | Variable to store the interrupt priority of FS D1FIFO. |
uint8_t | hsipl | Variable to store the interrupt priority of USBIR. |
uint8_t | ipl_typec | Variable to store the interrupt priority of USB Type-C IR. |
uint8_t | hsipl_d0 | Variable to store the interrupt priority of HS D0FIFO. |
uint8_t | hsipl_d1 | Variable to store the interrupt priority of HS D1FIFO. |
usb_callback_t * | p_usb_apl_callback | Application Callback. |
void const * | p_context | Other Context. |
const transfer_instance_t * | p_transfer_tx | Send context. |
const transfer_instance_t * | p_transfer_rx | Receive context. |
void const * | p_extend | Pointer to extended configuration by instance of interface. |
struct usb_api_t |
Functions implemented at the HAL layer will follow this API.
Data Fields | |
fsp_err_t(* | open )(usb_ctrl_t *const p_ctrl, usb_cfg_t const *const p_cfg) |
fsp_err_t(* | close )(usb_ctrl_t *const p_ctrl) |
fsp_err_t(* | read )(usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t destination) |
fsp_err_t(* | write )(usb_ctrl_t *const p_ctrl, uint8_t const *const p_buf, uint32_t size, uint8_t destination) |
fsp_err_t(* | stop )(usb_ctrl_t *const p_ctrl, usb_transfer_t direction, uint8_t destination) |
fsp_err_t(* | suspend )(usb_ctrl_t *const p_ctrl) |
fsp_err_t(* | resume )(usb_ctrl_t *const p_ctrl) |
fsp_err_t(* | vbusSet )(usb_ctrl_t *const p_ctrl, uint16_t state) |
fsp_err_t(* | infoGet )(usb_ctrl_t *const p_ctrl, usb_info_t *p_info, uint8_t destination) |
fsp_err_t(* | pipeRead )(usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
fsp_err_t(* | pipeWrite )(usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
fsp_err_t(* | pipeStop )(usb_ctrl_t *const p_ctrl, uint8_t pipe_number) |
fsp_err_t(* | usedPipesGet )(usb_ctrl_t *const p_ctrl, uint16_t *p_pipe, uint8_t destination) |
fsp_err_t(* | pipeInfoGet )(usb_ctrl_t *const p_ctrl, usb_pipe_t *p_info, uint8_t pipe_number) |
fsp_err_t(* | eventGet )(usb_ctrl_t *const p_ctrl, usb_status_t *event) |
fsp_err_t(* | callback )(usb_callback_t *p_callback) |
fsp_err_t(* | pullUp )(usb_ctrl_t *const p_ctrl, uint8_t state) |
fsp_err_t(* | hostControlTransfer )(usb_ctrl_t *const p_ctrl, usb_setup_t *p_setup, uint8_t *p_buf, uint8_t device_address) |
fsp_err_t(* | periControlDataGet )(usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
fsp_err_t(* | periControlDataSet )(usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
fsp_err_t(* | periControlStatusSet )(usb_ctrl_t *const p_ctrl, usb_setup_status_t status) |
fsp_err_t(* | remoteWakeup )(usb_ctrl_t *const p_ctrl) |
fsp_err_t(* | driverActivate )(usb_ctrl_t *const p_api_ctrl) |
fsp_err_t(* | callbackMemorySet )(usb_ctrl_t *const p_api_ctrl, usb_callback_args_t *p_callback_memory) |
fsp_err_t(* | moduleNumberGet )(usb_ctrl_t *const p_ctrl, uint8_t *module_number) |
fsp_err_t(* | classTypeGet )(usb_ctrl_t *const p_ctrl, usb_class_t *class_type) |
fsp_err_t(* | deviceAddressGet )(usb_ctrl_t *const p_ctrl, uint8_t *device_address) |
fsp_err_t(* | pipeNumberGet )(usb_ctrl_t *const p_ctrl, uint8_t *pipe_number) |
fsp_err_t(* | deviceStateGet )(usb_ctrl_t *const p_ctrl, uint16_t *state) |
fsp_err_t(* | dataSizeGet )(usb_ctrl_t *const p_ctrl, uint32_t *data_size) |
fsp_err_t(* | setupGet )(usb_ctrl_t *const p_ctrl, usb_setup_t *setup) |
fsp_err_t(* | otgCallbackSet )(usb_ctrl_t *const p_ctrl, usb_otg_callback_t *p_callback) |
fsp_err_t(* | otgSRP )(usb_ctrl_t *const p_ctrl) |
fsp_err_t(* | typecInfoGet )(usb_ctrl_t *const p_ctrl, usb_typec_info_t *p_info) |
fsp_err_t(* usb_api_t::open) (usb_ctrl_t *const p_ctrl, usb_cfg_t const *const p_cfg) |
Start the USB module
[in] | p_ctrl | Pointer to control structure. |
[in] | p_cfg | Pointer to configuration structure. |
fsp_err_t(* usb_api_t::close) (usb_ctrl_t *const p_ctrl) |
Stop the USB module
[in] | p_ctrl | Pointer to control structure. |
fsp_err_t(* usb_api_t::read) (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t destination) |
Request USB data read
[in] | p_ctrl | Pointer to control structure. |
[in] | p_buf | Pointer to area that stores read data. |
[in] | size | Read request size. |
[in] | destination | In Host mode, it represents the device address, and in Peripheral mode, it represents the device class. |
fsp_err_t(* usb_api_t::write) (usb_ctrl_t *const p_ctrl, uint8_t const *const p_buf, uint32_t size, uint8_t destination) |
Request USB data write
[in] | p_ctrl | Pointer to control structure. |
[in] | p_buf | Pointer to area that stores write data. |
[in] | size | Read request size. |
[in] | destination | In Host mode, it represents the device address, and in Peripheral mode, it represents the device class. |
fsp_err_t(* usb_api_t::stop) (usb_ctrl_t *const p_ctrl, usb_transfer_t direction, uint8_t destination) |
Stop USB data read/write processing
[in] | p_ctrl | Pointer to control structure. |
[in] | direction | Receive (USB_TRANSFER_READ) or send (USB_TRANSFER_WRITE). |
[in] | destination | In Host mode, it represents the device address, and in Peripheral mode, it represents the device class. |
fsp_err_t(* usb_api_t::suspend) (usb_ctrl_t *const p_ctrl) |
Request suspend
[in] | p_ctrl | Pointer to control structure. |
fsp_err_t(* usb_api_t::resume) (usb_ctrl_t *const p_ctrl) |
Request resume
[in] | p_ctrl | Pointer to control structure. |
fsp_err_t(* usb_api_t::vbusSet) (usb_ctrl_t *const p_ctrl, uint16_t state) |
Sets VBUS supply start/stop.
[in] | p_ctrl | Pointer to control structure. |
[in] | state | VBUS supply start/stop specification |
fsp_err_t(* usb_api_t::infoGet) (usb_ctrl_t *const p_ctrl, usb_info_t *p_info, uint8_t destination) |
Get information on USB device.
[in] | p_ctrl | Pointer to control structure. |
[in] | p_info | Pointer to usb_info_t structure area. |
[in] | destination | Device address for Host. |
fsp_err_t(* usb_api_t::pipeRead) (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
Request data read from specified pipe
[in] | p_ctrl | Pointer to control structure. |
[in] | p_buf | Pointer to area that stores read data. |
[in] | size | Read request size. |
[in] | pipe_number | Pipe Number. |
fsp_err_t(* usb_api_t::pipeWrite) (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
Request data write to specified pipe
[in] | p_ctrl | Pointer to control structure. |
[in] | p_buf | Pointer to area that stores write data. |
[in] | size | Read request size. |
[in] | pipe_number | Pipe Number. |
fsp_err_t(* usb_api_t::pipeStop) (usb_ctrl_t *const p_ctrl, uint8_t pipe_number) |
Stop USB data read/write processing to specified pipe
[in] | p_ctrl | Pointer to control structure. |
[in] | pipe_number | Pipe Number. |
fsp_err_t(* usb_api_t::usedPipesGet) (usb_ctrl_t *const p_ctrl, uint16_t *p_pipe, uint8_t destination) |
Get pipe number
[in] | p_ctrl | Pointer to control structure. |
[in] | p_pipe | Pointer to area that stores the selected pipe number (bit map information). |
[in] | destination | Device address for Host. |
fsp_err_t(* usb_api_t::pipeInfoGet) (usb_ctrl_t *const p_ctrl, usb_pipe_t *p_info, uint8_t pipe_number) |
Get pipe information
[in] | p_ctrl | Pointer to control structure. |
[in] | p_info | Pointer to usb_pipe_t structure area. |
[in] | pipe_number | Pipe Number. |
fsp_err_t(* usb_api_t::eventGet) (usb_ctrl_t *const p_ctrl, usb_status_t *event) |
Return USB-related completed events (OS less only)
[in] | p_ctrl | Pointer to control structure. |
[out] | event | Pointer to event. |
fsp_err_t(* usb_api_t::callback) (usb_callback_t *p_callback) |
Register a callback function to be called upon completion of a USB related event. (RTOS only)
[in] | p_callback | Pointer to Callback function. |
fsp_err_t(* usb_api_t::pullUp) (usb_ctrl_t *const p_ctrl, uint8_t state) |
Pull-up enable/disable setting of D+/D- line.
[in] | p_ctrl | Pointer to control structure. |
[in] | state | Pull-up enable/disable setting. |
fsp_err_t(* usb_api_t::hostControlTransfer) (usb_ctrl_t *const p_ctrl, usb_setup_t *p_setup, uint8_t *p_buf, uint8_t device_address) |
Performs settings and transmission processing when transmitting a setup packet.
[in] | p_ctrl | USB control structure. |
[in] | p_setup | Setup packet information. |
[in] | p_buf | Transfer area information. |
[in] | device_address | Device address information. |
fsp_err_t(* usb_api_t::periControlDataGet) (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
Receives data sent by control transfer.
[in] | p_ctrl | USB control structure. |
[in] | p_buf | Data reception area information. |
[in] | size | Data reception size information. |
fsp_err_t(* usb_api_t::periControlDataSet) (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
Performs transfer processing for control transfer.
[in] | p_ctrl | USB control structure. |
[in] | p_buf | Area information for data transfer. |
[in] | size | Transfer size information. |
fsp_err_t(* usb_api_t::periControlStatusSet) (usb_ctrl_t *const p_ctrl, usb_setup_status_t status) |
Set the response to the setup packet.
[in] | p_ctrl | USB control structure. |
[in] | status | USB port startup information. |
fsp_err_t(* usb_api_t::remoteWakeup) (usb_ctrl_t *const p_ctrl) |
Sends a remote wake-up signal to the connected Host.
[in] | p_ctrl | USB control structure. |
fsp_err_t(* usb_api_t::driverActivate) (usb_ctrl_t *const p_api_ctrl) |
Activate USB Driver
[in] | p_api_ctrl | USB control structure. |
fsp_err_t(* usb_api_t::callbackMemorySet) (usb_ctrl_t *const p_api_ctrl, usb_callback_args_t *p_callback_memory) |
Set callback memory to USB driver.
[in] | p_api_ctrl | USB control structure. |
[in] | p_callback_memory | Pointer to store USB event information. |
fsp_err_t(* usb_api_t::moduleNumberGet) (usb_ctrl_t *const p_ctrl, uint8_t *module_number) |
This API gets the module number.
[in] | p_ctrl | USB control structure. |
[out] | module_number | Module number to get. |
fsp_err_t(* usb_api_t::classTypeGet) (usb_ctrl_t *const p_ctrl, usb_class_t *class_type) |
This API gets the module number.
[in] | p_ctrl | USB control structure. |
[out] | class_type | Class type to get. |
fsp_err_t(* usb_api_t::deviceAddressGet) (usb_ctrl_t *const p_ctrl, uint8_t *device_address) |
This API gets the device address.
[in] | p_ctrl | USB control structure. |
[out] | device_address | Device address to get. |
fsp_err_t(* usb_api_t::pipeNumberGet) (usb_ctrl_t *const p_ctrl, uint8_t *pipe_number) |
This API gets the pipe number.
[in] | p_ctrl | USB control structure. |
[out] | pipe_number | Pipe number to get. |
fsp_err_t(* usb_api_t::deviceStateGet) (usb_ctrl_t *const p_ctrl, uint16_t *state) |
This API gets the state of the device.
[in] | p_ctrl | USB control structure. |
[out] | state | Device state to get. |
fsp_err_t(* usb_api_t::dataSizeGet) (usb_ctrl_t *const p_ctrl, uint32_t *data_size) |
This API gets the data size.
[in] | p_ctrl | USB control structure. |
[out] | data_size | Data size to get. |
fsp_err_t(* usb_api_t::setupGet) (usb_ctrl_t *const p_ctrl, usb_setup_t *setup) |
This API gets the setup type.
[in] | p_ctrl | USB control structure. |
[out] | setup | Setup type to get. |
fsp_err_t(* usb_api_t::otgCallbackSet) (usb_ctrl_t *const p_ctrl, usb_otg_callback_t *p_callback) |
This API sets the callback function for OTG.
[in] | p_ctrl | USB control structure. |
[in] | p_callback | Pointer to the callback function for OTG. |
fsp_err_t(* usb_api_t::otgSRP) (usb_ctrl_t *const p_ctrl) |
This API starts SRP processing for OTG.
[in] | p_ctrl | USB control structure. |
fsp_err_t(* usb_api_t::typecInfoGet) (usb_ctrl_t *const p_ctrl, usb_typec_info_t *p_info) |
Get information on USB Type-C Connection.
[in] | p_ctrl | Pointer to control structure. |
[in] | p_info | Pointer to usb_typec_info_t structure area. |
struct usb_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
Data Fields | ||
---|---|---|
usb_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
usb_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
usb_api_t const * | p_api | Pointer to the API structure for this instance. |
typedef void usb_ctrl_t |
USB control block. Allocate an instance specific control block to pass into the USB API calls.
enum usb_speed_t |
enum usb_setup_status_t |
enum usb_status_t |
USB driver status
enum usb_class_t |
USB class type
enum usb_bcport_t |
enum usb_onoff_t |
enum usb_transfer_t |
enum usb_transfer_type_t |
enum usb_mode_t |
enum usb_typec_mode_t |
enum usb_typec_plug_t |
USB TypeC Status of Connection State Machine