USB low-level driver for USB device mode.
Macros | |
#define | dbg_print(...) |
#define | UDC_REMOTEWAKEUP_LPM_DISABLE() |
#define | UDC_REMOTEWAKEUP_LPM_ENABLE() |
#define | UDC_SUSPEND_LPM_EVENT() |
#define | UDD_ENDPOINT_MAX_TRANS ((8*1024)-1) |
Maximum size of a transfer in multi-packet mode. More... | |
Functions | |
static void | _usb_device_lpm_suspend (struct usb_module *module_inst, void *pointer) |
static void | _usb_ep0_on_setup (struct usb_module *module_inst, void *pointer) |
Endpoint 0 (control) SETUP received callback. More... | |
static void | _usb_ep0_on_tansfer_fail (struct usb_module *module_inst, void *pointer) |
Control endpoint transfer fail callback function. More... | |
static void | _usb_ep0_on_tansfer_ok (struct usb_module *module_inst, void *pointer) |
Control endpoint transfer complete callback function. More... | |
static void | _usb_on_bus_reset (struct usb_module *module_inst, void *pointer) |
Control endpoint Reset callback function. More... | |
static void | _usb_on_sof_notify (struct usb_module *module_inst, void *pointer) |
Control endpoint SOF callback function. More... | |
static void | _usb_on_suspend (struct usb_module *module_inst, void *pointer) |
Control endpoint Suspend callback function. More... | |
static void | _usb_on_wakeup (struct usb_module *module_inst, void *pointer) |
Control endpoint Wakeup callback function. More... | |
void | udd_attach (void) |
Attach device to the bus when possible. More... | |
static void | udd_ctrl_ep_enable (struct usb_module *module_inst) |
Enable Control Endpoint. More... | |
static void | udd_ctrl_fetch_ram (void) |
Control Endpoint translate the data in buffer into Device Request Struct. More... | |
static void | udd_ctrl_in_sent (void) |
Process control endpoint IN transaction. More... | |
static void | udd_ctrl_out_received (void *pointer) |
Process control endpoint OUT transaction. More... | |
static void | udd_ctrl_overflow (void *pointer) |
Control Endpoint Process when overflow condition has occurred. More... | |
static void | udd_ctrl_send_zlp_in (void) |
Control Endpoint send out zero length packet. More... | |
static void | udd_ctrl_stall_data (void) |
Control Endpoint stall sending data. More... | |
static void | udd_ctrl_underflow (void *pointer) |
Control Endpoint Process when underflow condition has occurred. More... | |
void | udd_detach (void) |
Detaches the device from the bus. More... | |
void | udd_disable (void) |
Disables the USB Device mode. More... | |
void | udd_enable (void) |
Enables the USB Device mode. More... | |
void | udd_ep_abort (udd_ep_id_t ep) |
bool | udd_ep_alloc (udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize) |
bool | udd_ep_clear_halt (udd_ep_id_t ep) |
void | udd_ep_free (udd_ep_id_t ep) |
static udd_ep_job_t * | udd_ep_get_job (udd_ep_id_t ep) |
Get the detailed job by endpoint number. More... | |
bool | udd_ep_is_halted (udd_ep_id_t ep) |
bool | udd_ep_run (udd_ep_id_t ep, bool b_shortpacket, uint8_t *buf, iram_size_t buf_size, udd_callback_trans_t callback) |
bool | udd_ep_set_halt (udd_ep_id_t ep) |
static void | udd_ep_trans_in_next (void *pointer) |
Endpoint IN process, continue to send packets or zero length packet. More... | |
static void | udd_ep_trans_out_next (void *pointer) |
Endpoint OUT process, continue to receive packets or zero length packet. More... | |
static void | udd_ep_transfer_process (struct usb_module *module_inst, void *pointer) |
Endpoint Transfer Complete callback function, to do the next transfer depends on the direction(IN or OUT) More... | |
bool | udd_ep_wait_stall_clear (udd_ep_id_t ep, udd_callback_halt_cleared_t callback) |
uint16_t | udd_get_frame_number (void) |
Returns the current start of frame number. More... | |
uint16_t | udd_get_micro_frame_number (void) |
Returns the current micro start of frame number. More... | |
uint8_t | udd_getaddress (void) |
Returns the USB address of device. More... | |
bool | udd_include_vbus_monitoring (void) |
Authorizes the VBUS event. More... | |
bool | udd_is_high_speed (void) |
Test whether the USB Device Controller is running at high speed or not. More... | |
void | udd_send_remotewakeup (void) |
The USB driver sends a resume signal called Upstream Resume. More... | |
void | udd_set_address (uint8_t address) |
Changes the USB address of device. More... | |
void | udd_set_setup_payload (uint8_t *payload, uint16_t payload_size) |
Load setup payload. More... | |
Variables | |
struct usb_module | usb_device |
USB software device instance structure. More... | |
Clock management | |
static void | udd_wait_clock_ready (void) |
#define | UDD_CLOCK_GEN GCLK_GENERATOR_0 |
#define | UDD_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_DFLL |
Power management | |
enum | udd_usb_state_enum { UDD_STATE_OFF, UDD_STATE_SUSPEND, UDD_STATE_SUSPEND_LPM, UDD_STATE_IDLE } |
States of USB interface. More... | |
static void | udd_sleep_mode (enum udd_usb_state_enum new_state) |
Manages the sleep mode following the USB state. More... | |
Control endpoint low level management routine. | |
This function performs control endpoint management. It handles the SETUP/DATA/HANDSHAKE phases of a control transaction. | |
enum | udd_ctrl_ep_state_t { UDD_EPCTRL_SETUP = 0, UDD_EPCTRL_DATA_OUT = 1, UDD_EPCTRL_DATA_IN = 2, UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP = 3, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP = 4, UDD_EPCTRL_STALL_REQ = 5 } |
Bit definitions about endpoint control state machine for udd_ep_control_state. More... | |
uint8_t | udd_ctrl_buffer [USB_DEVICE_EP_CTRL_SIZE] |
Buffer to store the data received on control endpoint (SETUP/OUT endpoint 0) More... | |
udd_ctrl_request_t | udd_g_ctrlreq |
Global variable to give and record information of the set up request management. More... | |
static udd_ctrl_ep_state_t | udd_ep_control_state |
State of the endpoint control management. More... | |
static uint16_t | udd_ctrl_prev_payload_nb_trans |
Total number of data received/sent during data packet phase with previous payload buffers. More... | |
static uint16_t | udd_ctrl_payload_nb_trans |
Number of data received/sent to/from udd_g_ctrlreq.payload buffer. More... | |
Management of bulk/interrupt/isochronous endpoints | |
The UDD manages the data transfer on endpoints:
| |
udd_ep_job_t | |
static udd_ep_job_t | udd_ep_job [2 *USB_DEVICE_MAX_EP] |
Array to register a job on bulk/interrupt/isochronous endpoint. More... | |
UDC_BSS (4) | |
Buffer to store the data received on bulk/interrupt endpoints. More... | |
USB VBUS PAD management | |
static void | _uhd_vbus_handler (void) |
USB VBUS pin change handler. More... | |
static void | _usb_vbus_config (void) |
USB VBUS pin configuration. More... | |
#define | is_usb_vbus_high() port_pin_get_input_level(USB_VBUS_PIN) |
Check if USB VBus is available. More... | |
#define dbg_print | ( | ... | ) |
Referenced by _usb_device_lpm_suspend().
#define is_usb_vbus_high | ( | ) | port_pin_get_input_level(USB_VBUS_PIN) |
Check if USB VBus is available.
Referenced by _uhd_vbus_handler(), udd_enable(), and uhd_enable().
#define UDC_REMOTEWAKEUP_LPM_DISABLE | ( | ) |
Referenced by _usb_device_lpm_suspend().
#define UDC_REMOTEWAKEUP_LPM_ENABLE | ( | ) |
Referenced by _usb_device_lpm_suspend().
#define UDC_SUSPEND_LPM_EVENT | ( | ) |
Referenced by _usb_device_lpm_suspend().
#define UDD_CLOCK_GEN GCLK_GENERATOR_0 |
Referenced by udd_enable().
#define UDD_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_DFLL |
Referenced by udd_wait_clock_ready().
#define UDD_ENDPOINT_MAX_TRANS ((8*1024)-1) |
Maximum size of a transfer in multi-packet mode.
Referenced by udd_ep_run(), udd_ep_trans_in_next(), and udd_ep_trans_out_next().
enum udd_ctrl_ep_state_t |
Bit definitions about endpoint control state machine for udd_ep_control_state.
enum udd_usb_state_enum |
|
static |
USB VBUS pin change handler.
References EXTINT_CALLBACK_TYPE_DETECT, extint_chan_disable_callback(), extint_chan_enable_callback(), is_usb_vbus_high, UDC_VBUS_EVENT, udd_attach(), and udd_detach().
Referenced by _usb_vbus_config(), udd_enable(), and uhd_enable().
|
static |
References dbg_print, UDC_REMOTEWAKEUP_LPM_DISABLE, UDC_REMOTEWAKEUP_LPM_ENABLE, UDC_SUSPEND_LPM_EVENT, udd_sleep_mode(), UDD_STATE_SUSPEND_LPM, usb_device, USB_DEVICE_CALLBACK_LPMSUSP, USB_DEVICE_CALLBACK_SUSPEND, USB_DEVICE_CALLBACK_WAKEUP, usb_device_disable_callback(), and usb_device_enable_callback().
Referenced by _usb_on_wakeup(), and udd_attach().
|
static |
Endpoint 0 (control) SETUP received callback.
[in] | module_inst | pointer to USB module instance |
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References udd_ctrl_request_t::callback, ep_callback_para, NULL, usb_endpoint_callback_parameter::received_bytes, udd_ctrl_request_t::req, udc_process_setup(), udd_ctrl_buffer, udd_ctrl_fetch_ram(), udd_ctrl_in_sent(), udd_ctrl_send_zlp_in(), udd_ctrl_stall_data(), UDD_EPCTRL_DATA_IN, UDD_EPCTRL_DATA_OUT, UDD_EPCTRL_SETUP, Udd_setup_is_in, usb_device, usb_device_endpoint_read_buffer_job(), USB_DEVICE_EP_CTRL_SIZE, and usb_setup_req_t::wLength.
Referenced by udd_ctrl_ep_enable().
|
static |
Control endpoint transfer fail callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, udd_ctrl_overflow(), udd_ctrl_underflow(), and USB_EP_DIR_IN.
Referenced by udd_ctrl_ep_enable().
|
static |
Control endpoint transfer complete callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References udd_ctrl_request_t::callback, NULL, udd_ctrl_in_sent(), udd_ctrl_out_received(), UDD_EPCTRL_DATA_IN, UDD_EPCTRL_DATA_OUT, and UDD_EPCTRL_SETUP.
Referenced by udd_ctrl_ep_enable().
|
static |
Control endpoint Reset callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the callback parameter from driver layer. |
References udc_reset(), udd_ctrl_ep_enable(), and usb_device_set_address().
Referenced by udd_attach().
|
static |
Control endpoint SOF callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the callback parameter from driver layer. |
References UDC_SOF_EVENT, and udc_sof_notify().
Referenced by udd_attach().
|
static |
Control endpoint Suspend callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the callback parameter from driver layer. |
References UDC_SUSPEND_EVENT, udd_sleep_mode(), UDD_STATE_SUSPEND, usb_device, USB_DEVICE_CALLBACK_SUSPEND, USB_DEVICE_CALLBACK_WAKEUP, usb_device_disable_callback(), and usb_device_enable_callback().
Referenced by udd_attach().
|
static |
Control endpoint Wakeup callback function.
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the callback parameter from driver layer. |
References _usb_device_lpm_suspend(), UDC_RESUME_EVENT, udd_sleep_mode(), UDD_STATE_IDLE, udd_wait_clock_ready(), usb_device, USB_DEVICE_CALLBACK_LPMSUSP, USB_DEVICE_CALLBACK_SUSPEND, USB_DEVICE_CALLBACK_WAKEUP, usb_device_disable_callback(), usb_device_enable_callback(), and usb_device_register_callback().
Referenced by udd_attach().
|
static |
USB VBUS pin configuration.
References _uhd_vbus_handler(), extint_chan_conf::detection_criteria, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_disable_callback(), extint_chan_enable_callback(), extint_chan_get_config_defaults(), extint_chan_set_config(), EXTINT_DETECT_BOTH, EXTINT_PULL_NONE, extint_register_callback(), extint_chan_conf::filter_input_signal, extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, and extint_chan_conf::gpio_pin_pull.
Referenced by udd_enable(), and uhd_enable().
UDC_BSS | ( | 4 | ) |
Buffer to store the data received on bulk/interrupt endpoints.
Used to avoid a RAM buffer overflow in case of the user buffer is smaller than endpoint size
Callback to call at the end of transfer
Callback to call when the endpoint halt is cleared
Buffer located in internal RAM to send or fill during job
Size of buffer to send or fill
Total number of data transferred on endpoint
Endpoint size
A job is registered on this endpoint
A short packet is requested for this job on endpoint IN
The cache buffer is currently used on endpoint OUT
void udd_attach | ( | void | ) |
Attach device to the bus when possible.
References _usb_device_lpm_suspend(), _usb_on_bus_reset(), _usb_on_sof_notify(), _usb_on_suspend(), _usb_on_wakeup(), udd_sleep_mode(), UDD_STATE_IDLE, usb_device, usb_device_attach(), USB_DEVICE_CALLBACK_LPMSUSP, USB_DEVICE_CALLBACK_RESET, USB_DEVICE_CALLBACK_SOF, USB_DEVICE_CALLBACK_SUSPEND, USB_DEVICE_CALLBACK_WAKEUP, usb_device_enable_callback(), and usb_device_register_callback().
Referenced by _uhd_vbus_handler(), udc_attach(), and udd_enable().
|
static |
Enable Control Endpoint.
[in] | module_inst | Pointer to USB module instance |
References _usb_ep0_on_setup(), _usb_ep0_on_tansfer_fail(), _usb_ep0_on_tansfer_ok(), clz, usb_device_endpoint_config::ep_size, Max, Min, udd_ctrl_buffer, UDD_EPCTRL_SETUP, USB_DEVICE_ENDPOINT_CALLBACK_RXSTP, USB_DEVICE_ENDPOINT_CALLBACK_TRCPT, USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL, usb_device_endpoint_enable_callback(), usb_device_endpoint_get_config_defaults(), usb_device_endpoint_register_callback(), usb_device_endpoint_set_config(), usb_device_endpoint_setup_buffer_job(), USB_DEVICE_EP_CTRL_SIZE, USB_DEVICE_LPM_ACK, and usb_device_set_lpm_mode().
Referenced by _usb_on_bus_reset().
|
static |
Control Endpoint translate the data in buffer into Device Request Struct.
References usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, udd_ctrl_request_t::req, udd_ctrl_buffer, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by _usb_ep0_on_setup().
|
static |
Process control endpoint IN transaction.
References udd_ctrl_request_t::over_under_run, udd_ctrl_request_t::payload, udd_ctrl_request_t::payload_size, udd_ctrl_request_t::req, udd_ctrl_buffer, udd_ctrl_payload_nb_trans, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP, usb_device, usb_device_endpoint_setup_buffer_job(), usb_device_endpoint_write_buffer_job(), USB_DEVICE_EP_CTRL_SIZE, and usb_setup_req_t::wLength.
Referenced by _usb_ep0_on_setup(), and _usb_ep0_on_tansfer_ok().
|
static |
Process control endpoint OUT transaction.
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References ep_callback_para, NULL, udd_ctrl_request_t::over_under_run, udd_ctrl_request_t::payload, udd_ctrl_request_t::payload_size, usb_endpoint_callback_parameter::received_bytes, udd_ctrl_request_t::req, udd_ctrl_buffer, udd_ctrl_payload_nb_trans, udd_ctrl_send_zlp_in(), udd_ep_set_halt(), UDD_EPCTRL_STALL_REQ, usb_device, usb_device_endpoint_read_buffer_job(), USB_DEVICE_EP_CTRL_SIZE, and usb_setup_req_t::wLength.
Referenced by _usb_ep0_on_tansfer_ok().
|
static |
Control Endpoint Process when overflow condition has occurred.
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, UDD_EPCTRL_DATA_IN, UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP, usb_device, and usb_device_endpoint_set_halt().
Referenced by _usb_ep0_on_tansfer_fail().
|
static |
Control Endpoint send out zero length packet.
References udd_ctrl_request_t::payload, udd_ctrl_buffer, UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP, usb_device, usb_device_endpoint_setup_buffer_job(), and usb_device_endpoint_write_buffer_job().
Referenced by _usb_ep0_on_setup(), udd_ctrl_out_received(), and udd_ctrl_underflow().
|
static |
Control Endpoint stall sending data.
References UDD_EPCTRL_STALL_REQ, usb_device, usb_device_endpoint_clear_halt(), usb_device_endpoint_set_halt(), USB_EP_DIR_IN, and USB_EP_DIR_OUT.
Referenced by _usb_ep0_on_setup().
|
static |
Control Endpoint Process when underflow condition has occurred.
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, udd_ctrl_send_zlp_in(), UDD_EPCTRL_DATA_OUT, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP, usb_device, and usb_device_endpoint_set_halt().
Referenced by _usb_ep0_on_tansfer_fail().
void udd_detach | ( | void | ) |
Detaches the device from the bus.
The driver must remove pull-up on USB line D- or D+.
References udd_sleep_mode(), UDD_STATE_SUSPEND, usb_device, and usb_device_detach().
Referenced by _uhd_vbus_handler(), udc_detach(), and udd_disable().
void udd_disable | ( | void | ) |
Disables the USB Device mode.
References cpu_irq_restore(), cpu_irq_save(), udd_detach(), udd_sleep_mode(), UDD_STATE_OFF, and usb_dual_disable().
Referenced by udc_stop().
void udd_enable | ( | void | ) |
Enables the USB Device mode.
References _uhd_vbus_handler(), _usb_vbus_config(), cpu_irq_restore(), cpu_irq_save(), is_usb_vbus_high, usb_config::source_generator, udd_attach(), UDD_CLOCK_GEN, udd_sleep_mode(), UDD_STATE_SUSPEND, udd_wait_clock_ready(), usb_device, usb_dual_enable(), usb_enable(), usb_get_config_defaults(), and usb_init().
Referenced by udc_start().
void udd_ep_abort | ( | udd_ep_id_t | ep | ) |
References NULL, udd_ep_get_job(), udd_ep_job_t, UDD_EP_TRANSFER_ABORT, usb_device, and usb_device_endpoint_abort_job().
Referenced by udd_ep_free(), udd_ep_set_halt(), udi_msc_setup(), udi_phdc_abort_all_transfers_ongoing(), and udi_phdc_senddata_abort().
bool udd_ep_alloc | ( | udd_ep_id_t | ep, |
uint8_t | bmAttributes, | ||
uint16_t | MaxEndpointSize | ||
) |
References usb_device_endpoint_config::ep_address, usb_device_endpoint_config::ep_size, usb_device_endpoint_config::ep_type, STATUS_OK, udd_ep_get_job(), udd_ep_job_t, udd_ep_transfer_process(), usb_device, USB_DEVICE_ENDPOINT_CALLBACK_TRCPT, USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL, usb_device_endpoint_enable_callback(), usb_device_endpoint_get_config_defaults(), usb_device_endpoint_register_callback(), usb_device_endpoint_set_config(), USB_DEVICE_ENDPOINT_TYPE_BULK, USB_DEVICE_ENDPOINT_TYPE_INTERRUPT, USB_DEVICE_ENDPOINT_TYPE_ISOCHRONOUS, USB_ENDPOINT_1023_BYTE, USB_ENDPOINT_128_BYTE, USB_ENDPOINT_16_BYTE, USB_ENDPOINT_256_BYTE, USB_ENDPOINT_32_BYTE, USB_ENDPOINT_512_BYTE, USB_ENDPOINT_64_BYTE, USB_ENDPOINT_8_BYTE, USB_EP_ADDR_MASK, USB_EP_TYPE_BULK, USB_EP_TYPE_INTERRUPT, USB_EP_TYPE_ISOCHRONOUS, and USB_EP_TYPE_MASK.
Referenced by udc_iface_enable().
bool udd_ep_clear_halt | ( | udd_ep_id_t | ep | ) |
References udd_ep_get_job(), udd_ep_job_t, usb_device, usb_device_endpoint_clear_halt(), and USB_EP_ADDR_MASK.
void udd_ep_free | ( | udd_ep_id_t | ep | ) |
References usb_device_endpoint_config::ep_address, usb_device_endpoint_config::ep_type, udd_ep_abort(), usb_device, USB_DEVICE_ENDPOINT_CALLBACK_TRCPT, usb_device_endpoint_disable_callback(), usb_device_endpoint_get_config_defaults(), usb_device_endpoint_set_config(), USB_DEVICE_ENDPOINT_TYPE_DISABLE, usb_device_endpoint_unregister_callback(), and USB_EP_ADDR_MASK.
Referenced by udc_iface_disable().
|
static |
Get the detailed job by endpoint number.
[in] | ep | Endpoint Address |
pointer | to an udd_ep_job_t structure instance |
References NULL, USB_EP_ADDR_MASK, and USB_EP_DIR_IN.
Referenced by udd_ep_abort(), udd_ep_alloc(), udd_ep_clear_halt(), udd_ep_run(), udd_ep_trans_in_next(), udd_ep_trans_out_next(), and udd_ep_wait_stall_clear().
bool udd_ep_is_halted | ( | udd_ep_id_t | ep | ) |
References usb_device, and usb_device_endpoint_is_halted().
Referenced by udd_ep_run().
bool udd_ep_run | ( | udd_ep_id_t | ep, |
bool | b_shortpacket, | ||
uint8_t * | buf, | ||
iram_size_t | buf_size, | ||
udd_callback_trans_t | callback | ||
) |
References callback, cpu_irq_restore(), cpu_irq_save(), usb_device_endpoint_config::ep_size, NULL, STATUS_OK, UDD_ENDPOINT_MAX_TRANS, udd_ep_get_job(), udd_ep_is_halted(), udd_ep_job_t, UDD_EP_TRANSFER_OK, usb_device, usb_device_endpoint_read_buffer_job(), usb_device_endpoint_write_buffer_job(), USB_EP_ADDR_MASK, and USB_EP_DIR_IN.
Referenced by udi_cdc_ctrl_state_notify(), udi_cdc_data_received(), udi_cdc_rx_start(), udi_cdc_tx_send(), udi_hid_generic_report_out_enable(), udi_hid_generic_send_report_in(), udi_hid_kbd_send_report(), udi_hid_mouse_send_report(), udi_hid_multi_touch_send_report_in(), udi_msc_cbw_wait(), udi_msc_csw_send(), udi_msc_data_send(), udi_msc_trans_block(), udi_phdc_send_metadata(), udi_phdc_send_preamplemsg(), udi_phdc_wait_metadata(), and udi_phdc_wait_preamplemsg().
bool udd_ep_set_halt | ( | udd_ep_id_t | ep | ) |
References udd_ep_abort(), usb_device, usb_device_endpoint_set_halt(), and USB_EP_ADDR_MASK.
Referenced by udd_ctrl_out_received(), udi_msc_cbw_invalid(), udi_msc_csw_invalid(), udi_msc_csw_process(), and udi_phdc_received_preample().
|
static |
Endpoint IN process, continue to send packets or zero length packet.
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, NULL, usb_endpoint_callback_parameter::sent_bytes, UDD_ENDPOINT_MAX_TRANS, udd_ep_get_job(), udd_ep_job_t, UDD_EP_TRANSFER_OK, usb_device, usb_device_endpoint_write_buffer_job(), and USB_EP_ADDR_MASK.
Referenced by udd_ep_transfer_process().
|
static |
Endpoint OUT process, continue to receive packets or zero length packet.
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, NULL, usb_endpoint_callback_parameter::out_buffer_size, usb_endpoint_callback_parameter::received_bytes, UDD_ENDPOINT_MAX_TRANS, udd_ep_get_job(), udd_ep_job_t, UDD_EP_TRANSFER_OK, usb_device, usb_device_endpoint_read_buffer_job(), and USB_EP_ADDR_MASK.
Referenced by udd_ep_transfer_process().
|
static |
Endpoint Transfer Complete callback function, to do the next transfer depends on the direction(IN or OUT)
[in] | module_inst | Pointer to USB module instance |
[in] | pointer | Pointer to the endpoint transfer status parameter struct from driver layer. |
References usb_endpoint_callback_parameter::endpoint_address, ep_callback_para, udd_ep_trans_in_next(), udd_ep_trans_out_next(), and USB_EP_DIR_IN.
Referenced by udd_ep_alloc().
bool udd_ep_wait_stall_clear | ( | udd_ep_id_t | ep, |
udd_callback_halt_cleared_t | callback | ||
) |
References callback, udd_ep_get_job(), udd_ep_job_t, usb_device, usb_device_endpoint_is_configured(), usb_device_endpoint_is_halted(), and USB_EP_ADDR_MASK.
Referenced by udi_msc_cbw_invalid(), udi_msc_cbw_wait(), udi_msc_csw_invalid(), and udi_msc_csw_send().
uint16_t udd_get_frame_number | ( | void | ) |
Returns the current start of frame number.
References usb_device, and usb_device_get_frame_number().
Referenced by main_sof_action(), and udi_cdc_tx_send().
uint16_t udd_get_micro_frame_number | ( | void | ) |
Returns the current micro start of frame number.
References usb_device, and usb_device_get_micro_frame_number().
Referenced by udi_cdc_tx_send().
uint8_t udd_getaddress | ( | void | ) |
Returns the USB address of device.
References usb_device, and usb_device_get_address().
Referenced by udc_req_std_dev_set_configuration().
bool udd_include_vbus_monitoring | ( | void | ) |
Authorizes the VBUS event.
Referenced by udc_include_vbus_monitoring().
bool udd_is_high_speed | ( | void | ) |
Test whether the USB Device Controller is running at high speed or not.
true
if the Device is running at high speed mode, otherwise false
. Referenced by main_vendor_iso_out_received(), udc_req_std_dev_get_descriptor(), udc_req_std_dev_set_configuration(), udc_req_std_dev_set_feature(), and udi_cdc_tx_send().
void udd_send_remotewakeup | ( | void | ) |
The USB driver sends a resume signal called Upstream Resume.
References udd_sleep_mode(), UDD_STATE_IDLE, udd_wait_clock_ready(), usb_device, usb_device_send_remote_wake_up(), and usb_get_state_machine_status().
Referenced by udc_remotewakeup().
void udd_set_address | ( | uint8_t | address | ) |
Changes the USB address of device.
address | New USB address |
References usb_device, and usb_device_set_address().
Referenced by udc_valid_address().
void udd_set_setup_payload | ( | uint8_t * | payload, |
uint16_t | payload_size | ||
) |
Load setup payload.
payload | Pointer on payload |
payload_size | Size of payload |
References udd_ctrl_request_t::payload, and udd_ctrl_request_t::payload_size.
Referenced by udc_req_std_dev_get_configuration(), udc_req_std_dev_get_descriptor(), udc_req_std_dev_get_status(), udc_req_std_dev_get_str_desc(), and udc_req_std_iface_get_setting().
|
static |
Manages the sleep mode following the USB state.
new_state | New USB state |
References new_state, sleep_mode, SLEEPMGR_ACTIVE, SLEEPMGR_IDLE, sleepmgr_lock_mode(), sleepmgr_unlock_mode(), and UDD_STATE_OFF.
Referenced by _usb_device_lpm_suspend(), _usb_on_suspend(), _usb_on_wakeup(), udd_attach(), udd_detach(), udd_disable(), udd_enable(), and udd_send_remotewakeup().
|
inlinestatic |
References DPLL_READY_FLAG, SYSTEM_CLOCK_SOURCE_DPLL, and UDD_CLOCK_SOURCE.
Referenced by _usb_on_wakeup(), udd_enable(), and udd_send_remotewakeup().
uint8_t udd_ctrl_buffer[USB_DEVICE_EP_CTRL_SIZE] |
Buffer to store the data received on control endpoint (SETUP/OUT endpoint 0)
Used to avoid a RAM buffer overflow in case of the payload buffer is smaller than control endpoint size
Referenced by _usb_ep0_on_setup(), udd_ctrl_ep_enable(), udd_ctrl_fetch_ram(), udd_ctrl_in_sent(), udd_ctrl_out_received(), and udd_ctrl_send_zlp_in().
|
static |
Number of data received/sent to/from udd_g_ctrlreq.payload buffer.
Referenced by udd_ctrl_in_sent(), and udd_ctrl_out_received().
|
static |
Total number of data received/sent during data packet phase with previous payload buffers.
|
static |
State of the endpoint control management.
|
static |
Array to register a job on bulk/interrupt/isochronous endpoint.
udd_ep_job_t |
udd_ctrl_request_t udd_g_ctrlreq |
Global variable to give and record information of the set up request management.
Referenced by main_extra_string(), main_setup_in_received(), main_setup_out_received(), udc_process_setup(), udc_req_ep(), udc_req_iface(), udc_req_std_dev_clear_feature(), udc_req_std_dev_get_configuration(), udc_req_std_dev_get_descriptor(), udc_req_std_dev_get_status(), udc_req_std_dev_get_str_desc(), udc_req_std_dev_set_address(), udc_req_std_dev_set_configuration(), udc_req_std_dev_set_feature(), udc_req_std_iface_get_setting(), udc_req_std_iface_set_setting(), udc_reqstd(), udc_valid_address(), udi_cdc_comm_setup(), udi_cdc_setup_to_port(), udi_hid_generic_setfeature_valid(), udi_hid_generic_setreport(), udi_hid_kbd_setreport(), udi_hid_multi_touch_setupreport(), udi_hid_reqstdifaceget_descriptor(), udi_hid_setup(), udi_msc_setup(), udi_phdc_setup(), and udi_vendor_setup().
struct usb_module usb_device |
USB software device instance structure.
Referenced by _usb_device_lpm_suspend(), _usb_ep0_on_setup(), _usb_on_suspend(), _usb_on_wakeup(), udd_attach(), udd_ctrl_in_sent(), udd_ctrl_out_received(), udd_ctrl_overflow(), udd_ctrl_send_zlp_in(), udd_ctrl_stall_data(), udd_ctrl_underflow(), udd_detach(), udd_enable(), udd_ep_abort(), udd_ep_alloc(), udd_ep_clear_halt(), udd_ep_free(), udd_ep_is_halted(), udd_ep_run(), udd_ep_set_halt(), udd_ep_trans_in_next(), udd_ep_trans_out_next(), udd_ep_wait_stall_clear(), udd_get_frame_number(), udd_get_micro_frame_number(), udd_getaddress(), udd_send_remotewakeup(), and udd_set_address().