USBHS low-level driver for USB device mode.
The following USBHS driver configuration must be included in the conf_usb.h file of the application.
UDD_USB_INT_LEVEL
Option to change the interrupt priority (0 to 15) by default 5 (recommended).
UDD_USB_INT_FUN
Option to fit interrupt function to what defined in exception table.
UDD_ISOCHRONOUS_NB_BANK(ep)
Feature to reduce or increase isochronous endpoints buffering (1 to 3). Default value 2.
UDD_BULK_NB_BANK(ep)
Feature to reduce or increase bulk endpoints buffering (1 to 2). Default value 2.
UDD_INTERRUPT_NB_BANK(ep)
Feature to reduce or increase interrupt endpoints buffering (1 to 2). Default value 1.
UDD_NO_SLEEP_MGR
Feature to work without sleep manager module. Default not defined. Note that with this feature defined sleep manager must not be used in application.
The USB driver is fully managed by interrupt and does not request periodique task. Thereby, the USB events use callbacks to transfer the information. The callbacks are declared in static during compilation or in variable during code execution.
Static declarations defined in conf_usb.h:
Dynamic callbacks, called "endpoint job" , are registered in udd_ep_job_t structure via the following functions:
The Sleep modes authorized :
Data Structures | |
struct | udd_ep_job_t |
Structure definition about job registered on an endpoint. More... | |
Macros | |
#define | UDD_BULK_NB_BANK(ep) 2 |
#define | UDD_BULK_NB_BANK_ERROR |
#define | UDD_EP_BULK_NB_BANK_ERROR(ep) (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define | UDD_EP_BULK_NBANK_ERROR(ep) ( (UDD_BULK_NB_BANK(ep) < 1) || (UDD_BULK_NB_BANK(ep) > 2) ) |
#define | UDD_EP_INT_NB_BANK_ERROR(ep) (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define | UDD_EP_INT_NBANK_ERROR(ep) ( (UDD_INTERRUPT_NB_BANK(ep) < 1) || (UDD_INTERRUPT_NB_BANK(ep) > 2) ) |
#define | UDD_EP_ISO_NB_BANK_ERROR(ep) (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define | UDD_EP_ISO_NBANK_ERROR(ep) |
#define | UDD_EP_NB_BANK_ERROR(ep, type) (ATPASTE3(UDD_EP_, type, _NB_BANK_ERROR(ep))) |
#define | UDD_INTERRUPT_NB_BANK(ep) 1 |
#define | UDD_INTERRUPT_NB_BANK_ERROR |
#define | UDD_ISO_NB_BANK_ERROR |
#define | USBHS_DEVEPTCFG_EPDIR_Pos 8 |
Functions | |
if (udd_ctrl_interrupt()) | |
Function called by USBHS interrupt to manage USB Device interrupts. More... | |
if (udd_ep_interrupt()) | |
if (Is_udd_reset()) | |
if (Is_udd_suspend_interrupt_enabled()&&Is_udd_suspend()) | |
if (Is_udd_wake_up_interrupt_enabled()&&Is_udd_wake_up()) | |
void | udd_attach (void) |
Attach device to the bus when possible. 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) |
Aborts transfer on going on endpoint. More... | |
bool | udd_ep_alloc (udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize) |
Configures and enables an endpoint. More... | |
bool | udd_ep_clear_halt (udd_ep_id_t ep) |
Clear the halted state of the endpoint ep. More... | |
void | udd_ep_free (udd_ep_id_t ep) |
Disables an endpoint. More... | |
bool | udd_ep_is_halted (udd_ep_id_t ep) |
Check if the endpoint ep is halted. More... | |
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) |
Allows to receive or send data on an endpoint. More... | |
bool | udd_ep_set_halt (udd_ep_id_t ep) |
Set the halted state of the endpoint ep. More... | |
bool | udd_ep_wait_stall_clear (udd_ep_id_t ep, udd_callback_halt_cleared_t callback) |
Registers a callback to call when endpoint halt is cleared. More... | |
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... | |
void | udd_test_mode_j (void) |
void | udd_test_mode_k (void) |
void | udd_test_mode_packet (void) |
void | udd_test_mode_se0_nak (void) |
Variables | |
udd_interrupt_end | __pad0__ |
udd_interrupt_sof_end | __pad1__ |
Power management routine. | |
static bool | udd_b_idle |
State of USB line. More... | |
static bool | udd_b_sleep_initialized = false |
State of sleep manager. More... | |
static void | udd_sleep_mode (bool b_idle) |
Authorize or not the CPU powerdown mode. More... | |
#define | USBHS_SLEEP_MODE_USB_SUSPEND SLEEPMGR_WAIT_FAST |
Definition of sleep levels. More... | |
#define | USBHS_SLEEP_MODE_USB_IDLE SLEEPMGR_SLEEP_WFI |
VBus monitor routine | |
static void | udd_vbus_handler (uint32_t id, uint32_t mask) |
USB VBus pin change handler. More... | |
#define | udd_vbus_monitor_sleep_mode(lock) |
Control endpoint low level management routine. | |
This function performs control endpoint mangement. It handle 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... | |
COMPILER_WORD_ALIGNED udd_ctrl_request_t | udd_g_ctrlreq |
Global variable to give and record information about setup 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_buf_cnt |
Total number of data received/sent during data packet phase with previous payload buffers. More... | |
static uint16_t | udd_ctrl_payload_buf_cnt |
Number of data received/sent to/from udd_g_ctrlreq.payload buffer. More... | |
static void | udd_reset_ep_ctrl (void) |
Reset control endpoint. More... | |
static void | udd_ctrl_init (void) |
Reset control endpoint management. More... | |
static void | udd_ctrl_setup_received (void) |
Managed reception of SETUP packet on control endpoint. More... | |
static void | udd_ctrl_in_sent (void) |
Managed reception of IN packet on control endpoint. More... | |
static void | udd_ctrl_out_received (void) |
Managed reception of OUT packet on control endpoint. More... | |
static void | udd_ctrl_underflow (void) |
Managed underflow event of IN packet on control endpoint. More... | |
static void | udd_ctrl_overflow (void) |
Managed overflow event of OUT packet on control endpoint. More... | |
static void | udd_ctrl_stall_data (void) |
Managed stall event of IN/OUT packet on control endpoint. More... | |
static void | udd_ctrl_send_zlp_in (void) |
Send a ZLP IN on control endpoint. More... | |
static void | udd_ctrl_send_zlp_out (void) |
Send a ZLP OUT on control endpoint. More... | |
static void | udd_ctrl_endofrequest (void) |
Call callback associated to setup request. More... | |
static bool | udd_ctrl_interrupt (void) |
Main interrupt routine for control endpoint. More... | |
Management of bulk/interrupt/isochronous endpoints | |
The UDD manages the data transfer on endpoints:
| |
static udd_ep_job_t | udd_ep_job [USB_DEVICE_MAX_EP] |
Array to register a job on bulk/interrupt/isochronous endpoint. More... | |
static void | udd_ep_job_table_reset (void) |
Reset all job table. More... | |
static void | udd_ep_job_table_kill (void) |
Abort all endpoint jobs on going. More... | |
static void | udd_ep_abort_job (udd_ep_id_t ep) |
Abort endpoint job on going. More... | |
static void | udd_ep_finish_job (udd_ep_job_t *ptr_job, bool b_abort, uint8_t ep_num) |
Call the callback associated to the job which is finished. More... | |
static void | udd_ep_trans_done (udd_ep_id_t ep) |
Start the next transfer if necessary or complet the job associated. More... | |
static bool | udd_ep_interrupt (void) |
Main interrupt routine for bulk/interrupt/isochronous endpoints. More... | |
USBHS Device IP properties | |
#define | udd_get_endpoint_max_nbr() (9) |
Get maximal number of endpoints. More... | |
#define | UDD_MAX_PEP_NB (udd_get_endpoint_max_nbr() + 1) |
#define | udd_get_endpoint_bank_max_nbr(ep) ((ep == 0) ? 1 : (( ep <= 2) ? 3 : 2)) |
Get maximal number of banks of endpoints. More... | |
#define | udd_get_endpoint_size_max(ep) (((ep) == 0) ? 64 : 1024) |
Get maximal size of endpoint (3X, 1024/64) More... | |
#define | Is_udd_endpoint_dma_supported(ep) ((((ep) >= 1) && ((ep) <= 7)) ? true : false) |
Get DMA support of endpoints. More... | |
#define | Is_udd_endpoint_high_bw_supported(ep) (((ep) >= 2) ? true : false) |
Get High Band Width support of endpoints. More... | |
USBHS Device speeds management | |
#define | udd_low_speed_enable() (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
Enable/disable device low-speed mode. More... | |
#define | udd_low_speed_disable() (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
#define | Is_udd_low_speed_enable() (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
Test if device low-speed mode is forced. More... | |
#define | udd_high_speed_enable() do { } while (0) |
#define | udd_high_speed_disable() do { } while (0) |
#define | Is_udd_full_speed_mode() true |
USBHS device attach control | |
#define | udd_detach_device() (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Detaches from USB bus. More... | |
#define | udd_attach_device() (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Attaches to USB bus. More... | |
#define | Is_udd_detached() (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Test if the device is detached. More... | |
USBHS device bus events control | |
#define | udd_initiate_remote_wake_up() (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP)) |
Initiates a remote wake-up event. More... | |
#define | Is_udd_pending_remote_wake_up() (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP)) |
#define | udd_enable_remote_wake_up_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_UPRSMES) |
Manage upstream resume event (=remote wakeup) The USB driver sends a resume signal called "Upstream Resume". More... | |
#define | udd_disable_remote_wake_up_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_UPRSMEC) |
#define | Is_udd_remote_wake_up_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_UPRSME)) |
#define | udd_ack_remote_wake_up_start() (USBHS->USBHS_DEVICR = USBHS_DEVICR_UPRSMC) |
#define | udd_raise_remote_wake_up_start() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_UPRSMS) |
#define | Is_udd_remote_wake_up_start() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_UPRSM)) |
#define | udd_enable_resume_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSMES) |
Manage downstream resume event (=remote wakeup from host) The USB controller detects a valid "End of Resume" signal initiated by the host. More... | |
#define | udd_disable_resume_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSMEC) |
#define | Is_udd_resume_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSME)) |
#define | udd_ack_resume() (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSMC) |
#define | udd_raise_resume() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSMS) |
#define | Is_udd_resume() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORSM)) |
#define | udd_enable_wake_up_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_WAKEUPES) |
Manage wake-up event (=usb line activity) The USB controller is reactivated by a filtered non-idle signal from the lines. More... | |
#define | udd_disable_wake_up_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_WAKEUPEC) |
#define | Is_udd_wake_up_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_WAKEUPE)) |
#define | udd_ack_wake_up() (USBHS->USBHS_DEVICR = USBHS_DEVICR_WAKEUPC) |
#define | udd_raise_wake_up() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_WAKEUPS) |
#define | Is_udd_wake_up() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_WAKEUP)) |
#define | udd_enable_reset_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSTES) |
Manage reset event Set when a USB "End of Reset" has been detected. More... | |
#define | udd_disable_reset_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSTEC) |
#define | Is_udd_reset_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSTE)) |
#define | udd_ack_reset() (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSTC) |
#define | udd_raise_reset() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSTS) |
#define | Is_udd_reset() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORST)) |
#define | udd_enable_sof_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_SOFES) |
Manage start of frame event. More... | |
#define | udd_disable_sof_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SOFEC) |
#define | Is_udd_sof_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SOFE)) |
#define | udd_ack_sof() (USBHS->USBHS_DEVICR = USBHS_DEVICR_SOFC) |
#define | udd_raise_sof() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SOFS) |
#define | Is_udd_sof() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SOF)) |
#define | udd_frame_number() (Rd_bitfield(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNUM_Msk)) |
#define | Is_udd_frame_number_crc_error() (Tst_bits(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNCERR)) |
#define | udd_enable_msof_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_MSOFES) |
Manage Micro start of frame event (High Speed Only) More... | |
#define | udd_disable_msof_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_MSOFEC) |
#define | Is_udd_msof_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_MSOFE)) |
#define | udd_ack_msof() (USBHS->USBHS_DEVICR = USBHS_DEVIMR_MSOFE) |
#define | udd_raise_msof() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_MSOFS) |
#define | Is_udd_msof() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_MSOF)) |
#define | udd_micro_frame_number() (Rd_bitfield(USBHS->USBHS_DEVFNUM, (USBHS_DEVFNUM_FNUM_Msk|USBHS_DEVFNUM_MFNUM_Msk))) |
#define | udd_enable_suspend_interrupt() (USBHS->USBHS_DEVIER = USBHS_DEVIER_SUSPES) |
Manage suspend event. More... | |
#define | udd_disable_suspend_interrupt() (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SUSPEC) |
#define | Is_udd_suspend_interrupt_enabled() (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SUSPE)) |
#define | udd_ack_suspend() (USBHS->USBHS_DEVICR = USBHS_DEVICR_SUSPC) |
#define | udd_raise_suspend() (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SUSPS) |
#define | Is_udd_suspend() (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SUSP)) |
#define Is_udd_detached | ( | ) | (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Test if the device is detached.
Get DMA support of endpoints.
Referenced by udd_ep_abort(), udd_ep_alloc(), udd_ep_interrupt(), and udd_ep_run().
Get High Band Width support of endpoints.
#define Is_udd_frame_number_crc_error | ( | ) | (Tst_bits(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNCERR)) |
#define Is_udd_full_speed_mode | ( | ) | true |
Referenced by udd_is_high_speed().
#define Is_udd_low_speed_enable | ( | ) | (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
Test if device low-speed mode is forced.
#define Is_udd_msof | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_MSOF)) |
#define Is_udd_msof_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_MSOFE)) |
#define Is_udd_pending_remote_wake_up | ( | ) | (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP)) |
#define Is_udd_remote_wake_up_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_UPRSME)) |
#define Is_udd_remote_wake_up_start | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_UPRSM)) |
#define Is_udd_reset | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORST)) |
#define Is_udd_reset_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSTE)) |
#define Is_udd_resume | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORSM)) |
#define Is_udd_resume_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSME)) |
#define Is_udd_sof | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SOF)) |
#define Is_udd_sof_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SOFE)) |
#define Is_udd_suspend_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SUSPE)) |
#define Is_udd_wake_up | ( | ) | (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_WAKEUP)) |
#define Is_udd_wake_up_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_WAKEUPE)) |
#define udd_ack_msof | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVIMR_MSOFE) |
Referenced by udd_attach().
#define udd_ack_remote_wake_up_start | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_UPRSMC) |
#define udd_ack_reset | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSTC) |
Referenced by if(), and udd_attach().
#define udd_ack_resume | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSMC) |
#define udd_ack_sof | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_SOFC) |
Referenced by udd_attach().
#define udd_ack_suspend | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_SUSPC) |
#define udd_ack_wake_up | ( | ) | (USBHS->USBHS_DEVICR = USBHS_DEVICR_WAKEUPC) |
Referenced by udd_attach().
#define udd_attach_device | ( | ) | (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Attaches to USB bus.
Referenced by udd_attach().
#define UDD_BULK_NB_BANK | ( | ep | ) | 2 |
Referenced by udd_ep_alloc().
#define UDD_BULK_NB_BANK_ERROR |
#define udd_detach_device | ( | ) | (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH)) |
Detaches from USB bus.
Referenced by udd_detach().
#define udd_disable_msof_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_MSOFEC) |
#define udd_disable_remote_wake_up_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_UPRSMEC) |
#define udd_disable_reset_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSTEC) |
#define udd_disable_resume_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSMEC) |
#define udd_disable_sof_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SOFEC) |
#define udd_disable_suspend_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SUSPEC) |
Referenced by if().
#define udd_disable_wake_up_interrupt | ( | ) | (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_WAKEUPEC) |
Referenced by if().
#define udd_enable_msof_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_MSOFES) |
Manage Micro start of frame event (High Speed Only)
Referenced by udd_attach().
#define udd_enable_remote_wake_up_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_UPRSMES) |
Manage upstream resume event (=remote wakeup) The USB driver sends a resume signal called "Upstream Resume".
#define udd_enable_reset_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSTES) |
Manage reset event Set when a USB "End of Reset" has been detected.
Referenced by udd_attach().
#define udd_enable_resume_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSMES) |
Manage downstream resume event (=remote wakeup from host) The USB controller detects a valid "End of Resume" signal initiated by the host.
#define udd_enable_sof_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_SOFES) |
Manage start of frame event.
Referenced by udd_attach().
#define udd_enable_suspend_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_SUSPES) |
Manage suspend event.
Referenced by if(), and udd_attach().
#define udd_enable_wake_up_interrupt | ( | ) | (USBHS->USBHS_DEVIER = USBHS_DEVIER_WAKEUPES) |
Manage wake-up event (=usb line activity) The USB controller is reactivated by a filtered non-idle signal from the lines.
Referenced by if(), and udd_attach().
#define UDD_EP_BULK_NB_BANK_ERROR | ( | ep | ) | (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define UDD_EP_BULK_NBANK_ERROR | ( | ep | ) | ( (UDD_BULK_NB_BANK(ep) < 1) || (UDD_BULK_NB_BANK(ep) > 2) ) |
#define UDD_EP_INT_NB_BANK_ERROR | ( | ep | ) | (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define UDD_EP_INT_NBANK_ERROR | ( | ep | ) | ( (UDD_INTERRUPT_NB_BANK(ep) < 1) || (UDD_INTERRUPT_NB_BANK(ep) > 2) ) |
#define UDD_EP_ISO_NB_BANK_ERROR | ( | ep | ) | (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep)) |
#define UDD_EP_ISO_NBANK_ERROR | ( | ep | ) |
#define UDD_EP_NB_BANK_ERROR | ( | ep, | |
type | |||
) | (ATPASTE3(UDD_EP_, type, _NB_BANK_ERROR(ep))) |
#define udd_frame_number | ( | ) | (Rd_bitfield(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNUM_Msk)) |
Referenced by udd_get_frame_number().
#define udd_get_endpoint_bank_max_nbr | ( | ep | ) | ((ep == 0) ? 1 : (( ep <= 2) ? 3 : 2)) |
Get maximal number of banks of endpoints.
#define udd_get_endpoint_max_nbr | ( | ) | (9) |
Get maximal number of endpoints.
#define udd_get_endpoint_size_max | ( | ep | ) | (((ep) == 0) ? 64 : 1024) |
Get maximal size of endpoint (3X, 1024/64)
#define udd_high_speed_disable | ( | ) | do { } while (0) |
Referenced by udd_enable().
#define udd_high_speed_enable | ( | ) | do { } while (0) |
Referenced by udd_enable().
#define udd_initiate_remote_wake_up | ( | ) | (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP)) |
Initiates a remote wake-up event.
Referenced by udd_send_remotewakeup().
#define UDD_INTERRUPT_NB_BANK | ( | ep | ) | 1 |
Referenced by udd_ep_alloc().
#define UDD_INTERRUPT_NB_BANK_ERROR |
#define UDD_ISO_NB_BANK_ERROR |
#define udd_low_speed_disable | ( | ) | (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
Referenced by udd_enable().
#define udd_low_speed_enable | ( | ) | (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS)) |
Enable/disable device low-speed mode.
Referenced by udd_enable().
#define UDD_MAX_PEP_NB (udd_get_endpoint_max_nbr() + 1) |
#define udd_micro_frame_number | ( | ) | (Rd_bitfield(USBHS->USBHS_DEVFNUM, (USBHS_DEVFNUM_FNUM_Msk|USBHS_DEVFNUM_MFNUM_Msk))) |
Referenced by udd_get_micro_frame_number().
#define udd_raise_msof | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_MSOFS) |
#define udd_raise_remote_wake_up_start | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_UPRSMS) |
#define udd_raise_reset | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSTS) |
#define udd_raise_resume | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSMS) |
#define udd_raise_sof | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SOFS) |
#define udd_raise_suspend | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SUSPS) |
Referenced by udd_attach().
#define udd_raise_wake_up | ( | ) | (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_WAKEUPS) |
#define udd_vbus_monitor_sleep_mode | ( | lock | ) |
Referenced by udd_enable(), and udd_vbus_handler().
#define USBHS_DEVEPTCFG_EPDIR_Pos 8 |
#define USBHS_SLEEP_MODE_USB_IDLE SLEEPMGR_SLEEP_WFI |
Referenced by udd_sleep_mode().
#define USBHS_SLEEP_MODE_USB_SUSPEND SLEEPMGR_WAIT_FAST |
Definition of sleep levels.
Referenced by udd_disable(), and udd_enable().
enum udd_ctrl_ep_state_t |
Bit definitions about endpoint control state machine for udd_ep_control_state.
if | ( | udd_ctrl_interrupt() | ) |
Function called by USBHS interrupt to manage USB Device interrupts.
USB Device interrupt events are splited in three parts:
Note: Here, the global interrupt mask is not clear when an USB interrupt is enabled because this one can not be occured during the USB ISR (=during INTX is masked). See Technical reference $3.8.3 Masking interrupt requests in peripheral modules.
if | ( | udd_ep_interrupt() | ) |
if | ( | Is_udd_reset() | ) |
References dbg_print, udc_reset(), udd_ack_reset, udd_ctrl_init(), udd_ep_job_table_kill(), and udd_reset_ep_ctrl().
if | ( | Is_udd_suspend_interrupt_enabled()&&Is_udd_suspend() | ) |
if | ( | Is_udd_wake_up_interrupt_enabled()&&Is_udd_wake_up() | ) |
void udd_attach | ( | void | ) |
Attach device to the bus when possible.
References cpu_irq_restore(), cpu_irq_save(), Is_otg_clock_usable, otg_freeze_clock, otg_unfreeze_clock, udd_ack_msof, udd_ack_reset, udd_ack_sof, udd_ack_wake_up, udd_attach_device, udd_enable_msof_interrupt, udd_enable_reset_interrupt, udd_enable_sof_interrupt, udd_enable_suspend_interrupt, udd_enable_wake_up_interrupt, udd_raise_suspend, and udd_sleep_mode().
Referenced by udc_attach(), udd_enable(), and udd_vbus_handler().
|
static |
Call callback associated to setup request.
Referenced by udd_ctrl_in_sent(), udd_ctrl_out_received(), and udd_ctrl_setup_received().
|
static |
Managed reception of IN packet on control endpoint.
References Assert, cpu_irq_restore(), cpu_irq_save(), Is_udd_out_received, udd_ack_in_send, udd_ctrl_endofrequest(), udd_ctrl_init(), udd_ctrl_payload_buf_cnt, udd_ctrl_send_zlp_out(), udd_disable_in_send_interrupt, udd_enable_in_send_interrupt, UDD_EPCTRL_DATA_IN, UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP, udd_get_endpoint_fifo_access, and USB_DEVICE_EP_CTRL_SIZE.
Referenced by udd_ctrl_interrupt(), and udd_ctrl_setup_received().
|
static |
Reset control endpoint management.
Called after a USB line reset or at the end of SETUP request (after ZLP)
References cpu_irq_restore(), cpu_irq_save(), udd_ack_out_received, udd_disable_in_send_interrupt, and UDD_EPCTRL_SETUP.
Referenced by if(), udd_ctrl_in_sent(), udd_ctrl_out_received(), and udd_ctrl_setup_received().
|
static |
Main interrupt routine for control endpoint.
This switchs control endpoint events to correct sub function.
1
if an event about control endpoint is occured, otherwise 0
. References dbg_print, Is_udd_endpoint_interrupt, Is_udd_in_send, Is_udd_in_send_interrupt_enabled, Is_udd_nak_in, Is_udd_nak_out, Is_udd_out_received, Is_udd_setup_received, udd_ack_nak_in, udd_ack_nak_out, udd_ctrl_in_sent(), udd_ctrl_out_received(), udd_ctrl_overflow(), udd_ctrl_setup_received(), udd_ctrl_underflow(), udd_disable_nak_in_interrupt, udd_disable_nak_out_interrupt, and USBHS_ARRAY.
|
static |
Managed reception of OUT packet on control endpoint.
References cpu_irq_restore(), cpu_irq_save(), udd_ack_nak_in, udd_ack_out_received, udd_byte_count, udd_ctrl_endofrequest(), udd_ctrl_init(), udd_ctrl_payload_buf_cnt, udd_ctrl_send_zlp_in(), udd_ctrl_stall_data(), udd_enable_nak_in_interrupt, UDD_EPCTRL_DATA_IN, UDD_EPCTRL_DATA_OUT, UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP, udd_get_endpoint_fifo_access, and USB_DEVICE_EP_CTRL_SIZE.
Referenced by udd_ctrl_interrupt().
|
static |
Managed overflow event of OUT packet on control endpoint.
References Is_udd_in_send, udd_enable_stall_handshake, and UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP.
Referenced by udd_ctrl_interrupt().
|
static |
Send a ZLP IN on control endpoint.
References cpu_irq_restore(), cpu_irq_save(), udd_ack_in_send, udd_ack_nak_out, udd_enable_in_send_interrupt, udd_enable_nak_out_interrupt, and UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP.
Referenced by udd_ctrl_out_received(), udd_ctrl_setup_received(), and udd_ctrl_underflow().
|
static |
Send a ZLP OUT on control endpoint.
References cpu_irq_restore(), cpu_irq_save(), udd_ack_nak_in, udd_enable_nak_in_interrupt, and UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP.
Referenced by udd_ctrl_in_sent().
|
static |
Managed reception of SETUP packet on control endpoint.
References cpu_irq_restore(), cpu_irq_save(), le16_to_cpu, udc_process_setup(), udd_ack_nak_in, udd_ack_setup_received, udd_byte_count, udd_ctrl_endofrequest(), udd_ctrl_in_sent(), udd_ctrl_init(), udd_ctrl_send_zlp_in(), udd_ctrl_stall_data(), udd_enable_nak_in_interrupt, UDD_EPCTRL_DATA_IN, UDD_EPCTRL_DATA_OUT, UDD_EPCTRL_SETUP, udd_get_endpoint_fifo_access, and Udd_setup_is_in.
Referenced by udd_ctrl_interrupt().
|
static |
Managed stall event of IN/OUT packet on control endpoint.
References udd_enable_stall_handshake, and UDD_EPCTRL_STALL_REQ.
Referenced by udd_ctrl_out_received(), and udd_ctrl_setup_received().
|
static |
Managed underflow event of IN packet on control endpoint.
References Is_udd_out_received, udd_ctrl_send_zlp_in(), udd_enable_stall_handshake, UDD_EPCTRL_DATA_OUT, and UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP.
Referenced by udd_ctrl_interrupt().
void udd_detach | ( | void | ) |
Detaches the device from the bus.
The driver must remove pull-up on USB line D- or D+.
References otg_freeze_clock, otg_unfreeze_clock, udd_detach_device, and udd_sleep_mode().
Referenced by udc_detach(), udd_disable(), and udd_vbus_handler().
void udd_disable | ( | void | ) |
Disables the USB Device mode.
References cpu_irq_restore(), cpu_irq_save(), Is_otg_host_mode_forced, Is_otg_id_host, otg_disable, otg_freeze_clock, otg_unfreeze_clock, pmc_disable_periph_clk(), sleepmgr_unlock_mode(), sysclk_disable_usb(), udd_b_sleep_initialized, udd_detach(), and USBHS_SLEEP_MODE_USB_SUSPEND.
Referenced by udc_stop().
void udd_enable | ( | void | ) |
Enables the USB Device mode.
References cpu_irq_restore(), cpu_irq_save(), Is_otg_clock_usable, Is_otg_id_device, Is_otg_vbus_high, otg_dual_enable(), otg_enable, otg_freeze_clock, otg_unfreeze_clock, otg_vbus_init, pmc_enable_periph_clk(), pmc_set_fast_startup_input(), sleepmgr_lock_mode(), sysclk_enable_usb(), udd_attach(), udd_b_idle, udd_b_sleep_initialized, udd_ep_job_table_reset(), udd_high_speed_disable, udd_high_speed_enable, udd_low_speed_disable, udd_low_speed_enable, udd_sleep_mode(), UDD_USB_INT_LEVEL, udd_vbus_handler(), udd_vbus_monitor_sleep_mode, USB_VBUS_PIO_ID, USB_VBUS_PIO_MASK, and USBHS_SLEEP_MODE_USB_SUSPEND.
Referenced by udc_start().
void udd_ep_abort | ( | udd_ep_id_t | ep | ) |
Aborts transfer on going on endpoint.
If a transfer is on going, then it is stopped and the callback registered is called to signal the end of transfer. Note: The control endpoint is not authorized.
ep | Endpoint to abort |
References Is_udd_endpoint_dma_supported, Is_udd_kill_last, udd_disable_endpoint_dma_interrupt, udd_disable_endpoint_interrupt, udd_disable_in_send_interrupt, udd_disable_out_received_interrupt, udd_endpoint_dma_set_control, udd_ep_abort_job(), udd_kill_last_in_bank, udd_nb_busy_bank, USB_EP_ADDR_MASK, and USB_EP_DIR_IN.
Referenced by udc_req_std_ep_set_feature(), and udd_ep_interrupt().
|
static |
Abort endpoint job on going.
ep | endpoint number of job to abort |
References udd_ep_finish_job(), and USB_EP_ADDR_MASK.
Referenced by udd_ep_abort(), and udd_ep_free().
bool udd_ep_alloc | ( | udd_ep_id_t | ep, |
uint8_t | bmAttributes, | ||
uint16_t | MaxEndpointSize | ||
) |
Configures and enables an endpoint.
ep | Endpoint number including direction (USB_EP_DIR_IN/USB_EP_DIR_OUT). |
bmAttributes | Attributes of endpoint declared in the descriptor. |
MaxEndpointSize | Endpoint maximum size |
1
if the endpoint is enabled, otherwise 0
. References Assert, udd_ep_job_t::b_shortpacket, udd_ep_job_t::buf, udd_ep_job_t::buf_cnt, udd_ep_job_t::buf_load, udd_ep_job_t::buf_size, udd_ep_job_t::busy, udd_ep_job_t::call_trans, dbg_print, Is_udd_endpoint_configured, Is_udd_endpoint_dma_supported, Is_udd_endpoint_enabled, Is_udd_endpoint_in, udd_allocate_memory, UDD_BULK_NB_BANK, udd_configure_endpoint, udd_disable_endpoint, udd_enable_endpoint, udd_enable_endpoint_bank_autoswitch, udd_ep_run(), UDD_EP_TRANSFER_ABORT, UDD_INTERRUPT_NB_BANK, UDD_ISOCHRONOUS_NB_BANK, udd_unallocate_memory, USB_DEVICE_MAX_EP, USB_EP_ADDR_MASK, USB_EP_DIR_IN, 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 | ) |
Clear the halted state of the endpoint ep.
After calling this function, any transaction on ep will be handled normally, i.e. a STALL handshake will not be sent, and the data toggle sequence will start at DATA0.
ep | The ID of the endpoint to be un-halted |
1
if function was successfully done, otherwise 0
. References udd_ep_job_t::busy, udd_ep_job_t::call_nohalt, Is_udd_endpoint_stall_requested, Is_udd_stall, udd_ep_job_t::stall_requested, udd_ack_stall, udd_disable_bank_interrupt, udd_disable_endpoint_interrupt, udd_disable_stall_handshake, udd_enable_endpoint_bank_autoswitch, udd_reset_data_toggle, USB_DEVICE_MAX_EP, and USB_EP_ADDR_MASK.
Referenced by udc_req_std_ep_clear_feature().
|
static |
Call the callback associated to the job which is finished.
ptr_job | job to complete |
b_abort | if true then the job has been aborted |
References udd_ep_job_t::buf_size, udd_ep_job_t::busy, udd_ep_job_t::call_trans, dbg_print, Is_udd_endpoint_in, UDD_EP_TRANSFER_ABORT, UDD_EP_TRANSFER_OK, and USB_EP_DIR_IN.
Referenced by udd_ep_abort_job(), udd_ep_interrupt(), udd_ep_job_table_kill(), and udd_ep_trans_done().
void udd_ep_free | ( | udd_ep_id_t | ep | ) |
Disables an endpoint.
ep | Endpoint number including direction (USB_EP_DIR_IN/USB_EP_DIR_OUT). |
References udd_ep_job_t::stall_requested, udd_disable_endpoint, udd_ep_abort_job(), udd_unallocate_memory, USB_DEVICE_MAX_EP, and USB_EP_ADDR_MASK.
Referenced by udc_iface_disable().
|
static |
Main interrupt routine for bulk/interrupt/isochronous endpoints.
This switchs endpoint events to correct sub function.
1
if an event about bulk/interrupt/isochronous endpoints has occured, otherwise 0
. References Assert, udd_ep_job_t::buf_cnt, udd_ep_job_t::buf_size, dbg_print, Is_udd_bank_interrupt_enabled, Is_udd_crc_error, Is_udd_endpoint_dma_interrupt, Is_udd_endpoint_dma_interrupt_enabled, Is_udd_endpoint_dma_supported, Is_udd_endpoint_interrupt_enabled, Is_udd_in_send, Is_udd_in_send_interrupt_enabled, Is_udd_out_received, Is_udd_out_received_interrupt_enabled, Is_udd_overflow, Is_udd_underflow, udd_ep_job_t::stall_requested, udd_ack_fifocon, udd_ack_in_send, udd_disable_bank_interrupt, udd_disable_endpoint_bank_autoswitch, udd_disable_endpoint_dma_interrupt, udd_disable_endpoint_interrupt, udd_disable_in_send_interrupt, udd_enable_stall_handshake, udd_endpoint_dma_get_status, udd_ep_abort(), udd_ep_finish_job(), udd_ep_trans_done(), udd_nb_busy_bank, udd_reset_data_toggle, and USB_DEVICE_MAX_EP.
bool udd_ep_is_halted | ( | udd_ep_id_t | ep | ) |
Check if the endpoint ep is halted.
ep | The ID of the endpoint to check. |
1
if ep is halted, otherwise 0
. References Is_udd_endpoint_stall_requested, and USB_EP_ADDR_MASK.
Referenced by udc_req_std_ep_get_status().
|
static |
Abort all endpoint jobs on going.
References udd_ep_finish_job(), and USB_DEVICE_MAX_EP.
Referenced by if().
|
static |
Reset all job table.
References udd_ep_job_t::busy, udd_ep_job_t::stall_requested, and USB_DEVICE_MAX_EP.
Referenced by udd_enable().
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 | ||
) |
Allows to receive or send data on an endpoint.
The driver uses a specific DMA USB to transfer data from internal RAM to endpoint, if this one is available. When the transfer is finished or aborted (stall, reset, ...), the callback is called. The callback returns the transfer status and eventually the number of byte transfered. Note: The control endpoint is not authorized.
ep | The ID of the endpoint to use |
b_shortpacket | Enabled automatic short packet |
buf | Buffer on Internal RAM to send or fill. It must be align, then use COMPILER_WORD_ALIGNED. |
buf_size | Buffer size to send or fill |
callback | NULL or function to call at the end of transfer |
1
if function was successfully done, otherwise 0
. References _dcache_flush(), _dcache_invalidate_prepare(), udd_ep_job_t::b_shortpacket, udd_ep_job_t::buf, udd_ep_job_t::buf_cnt, udd_ep_job_t::buf_load, udd_ep_job_t::buf_size, udd_ep_job_t::busy, udd_ep_job_t::call_trans, cpu_irq_restore(), cpu_irq_save(), dbg_print, Is_udd_endpoint_dma_supported, Is_udd_endpoint_enabled, Is_udd_endpoint_in, Is_udd_endpoint_stall_requested, udd_ep_job_t::stall_requested, udd_disable_endpoint_bank_autoswitch, udd_enable_endpoint_interrupt, udd_enable_in_send_interrupt, udd_enable_out_received_interrupt, udd_ep_trans_done(), USB_DEVICE_MAX_EP, and USB_EP_ADDR_MASK.
Referenced by udd_ep_alloc(), udi_vendor_bulk_in_run(), udi_vendor_bulk_out_run(), udi_vendor_interrupt_in_run(), and udi_vendor_interrupt_out_run().
bool udd_ep_set_halt | ( | udd_ep_id_t | ep | ) |
Set the halted state of the endpoint ep.
After calling this function, any transaction on ep will result in a STALL handshake being sent. Any pending transactions will be performed first, however.
ep | The ID of the endpoint to be halted |
1
if ep is halted, otherwise 0
. References udd_ep_job_t::busy, cpu_irq_restore(), cpu_irq_save(), Is_udd_endpoint_stall_requested, udd_ep_job_t::stall_requested, udd_ack_stall, udd_disable_endpoint_bank_autoswitch, udd_disable_in_send_interrupt, udd_enable_bank_interrupt, udd_enable_endpoint_bank_autoswitch, udd_enable_endpoint_interrupt, udd_enable_stall_handshake, udd_nb_busy_bank, USB_DEVICE_MAX_EP, USB_EP_ADDR_MASK, and USB_EP_DIR_IN.
Referenced by udc_req_std_ep_set_feature().
|
static |
Start the next transfer if necessary or complet the job associated.
ep | endpoint number without direction flag |
References _dcache_invalidate(), udd_ep_job_t::b_shortpacket, udd_ep_job_t::buf, udd_ep_job_t::buf_cnt, udd_ep_job_t::buf_load, udd_ep_job_t::buf_size, udd_ep_job_t::busy, cpu_irq_restore(), cpu_irq_save(), dbg_print, Is_udd_endpoint_in, Is_udd_write_enabled, udd_ack_in_send, udd_enable_endpoint_dma_interrupt, udd_enable_endpoint_interrupt, udd_enable_in_send_interrupt, udd_endpoint_dma_get_status, udd_endpoint_dma_set_addr, udd_endpoint_dma_set_control, UDD_ENDPOINT_MAX_TRANS, udd_ep_finish_job(), udd_get_endpoint_size, udd_get_endpoint_type, udd_raise_in_send, and USB_EP_TYPE_ISOCHRONOUS.
Referenced by udd_ep_interrupt(), and udd_ep_run().
bool udd_ep_wait_stall_clear | ( | udd_ep_id_t | ep, |
udd_callback_halt_cleared_t | callback | ||
) |
Registers a callback to call when endpoint halt is cleared.
ep | The ID of the endpoint to use |
callback | NULL or function to call when endpoint halt is cleared |
1
if the register is accepted, otherwise 0
. References udd_ep_job_t::busy, udd_ep_job_t::call_nohalt, Is_udd_endpoint_enabled, Is_udd_endpoint_stall_requested, udd_ep_job_t::stall_requested, USB_DEVICE_MAX_EP, and USB_EP_ADDR_MASK.
uint16_t udd_get_frame_number | ( | void | ) |
Returns the current start of frame number.
References udd_frame_number.
Referenced by main_sof_action().
uint16_t udd_get_micro_frame_number | ( | void | ) |
Returns the current micro start of frame number.
References udd_micro_frame_number.
uint8_t udd_getaddress | ( | void | ) |
Returns the USB address of device.
References udd_get_configured_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
. References Is_udd_full_speed_mode.
Referenced by udc_req_std_dev_get_descriptor(), udc_req_std_dev_set_configuration(), and udc_req_std_dev_set_feature().
|
static |
Reset control endpoint.
Called after a USB line reset or when UDD is enabled
References cpu_irq_restore(), cpu_irq_save(), udd_allocate_memory, udd_configure_address, udd_configure_endpoint, udd_enable_address, udd_enable_endpoint, udd_enable_endpoint_interrupt, udd_enable_out_received_interrupt, udd_enable_setup_received_interrupt, USB_DEVICE_EP_CTRL_SIZE, and USB_EP_TYPE_CONTROL.
Referenced by if().
void udd_send_remotewakeup | ( | void | ) |
The USB driver sends a resume signal called Upstream Resume.
References otg_unfreeze_clock, udd_b_idle, udd_initiate_remote_wake_up, and udd_sleep_mode().
Referenced by udc_remotewakeup().
void udd_set_address | ( | uint8_t | address | ) |
Changes the USB address of device.
address | New USB address |
References udd_configure_address, udd_disable_address, and udd_enable_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 |
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(), udc_req_std_ep_get_status(), and udc_req_std_iface_get_setting().
|
static |
Authorize or not the CPU powerdown mode.
b_idle | true to authorize idle mode |
References dbg_print, sleepmgr_lock_mode(), sleepmgr_unlock_mode(), udd_b_idle, and USBHS_SLEEP_MODE_USB_IDLE.
Referenced by if(), udd_attach(), udd_detach(), udd_enable(), and udd_send_remotewakeup().
void udd_test_mode_j | ( | void | ) |
Referenced by udc_req_std_dev_set_feature().
void udd_test_mode_k | ( | void | ) |
Referenced by udc_req_std_dev_set_feature().
void udd_test_mode_packet | ( | void | ) |
References udd_ack_fifocon, udd_allocate_memory, udd_configure_endpoint, udd_disable_endpoint, udd_enable_endpoint, udd_get_endpoint_fifo_access, and USB_EP_TYPE_BULK.
Referenced by udc_req_std_dev_set_feature().
void udd_test_mode_se0_nak | ( | void | ) |
Referenced by udc_req_std_dev_set_feature().
|
static |
USB VBus pin change handler.
References Is_otg_vbus_high, UDC_VBUS_EVENT, udd_attach(), udd_detach(), and udd_vbus_monitor_sleep_mode.
Referenced by udd_enable().
udd_interrupt_end __pad0__ |
udd_interrupt_sof_end __pad1__ |
|
static |
State of USB line.
Referenced by udd_enable(), udd_send_remotewakeup(), and udd_sleep_mode().
State of sleep manager.
Referenced by udd_disable(), and udd_enable().
|
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.
COMPILER_WORD_ALIGNED udd_ctrl_request_t udd_g_ctrlreq |
Global variable to give and record information about setup request management.
Referenced by 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_ep_clear_feature(), udc_req_std_ep_get_status(), udc_req_std_ep_set_feature(), udc_req_std_iface_get_setting(), udc_req_std_iface_set_setting(), udc_reqstd(), udc_valid_address(), and udi_vendor_setup().