Macros | Functions | Variables
USB High-Speed Port for device mode (USBHS)
Collaboration diagram for USB High-Speed Port for device mode (USBHS):

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 UDD_ISOCHRONOUS_NB_BANK(ep)   2
 
#define USBHS_DEVEPTCFG_EPDIR_Pos   8
 

Functions

 if (udd_ctrl_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...
 
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

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)
 
#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...
 

USBHS Device IP properties

These macros give access to 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

These macros manage the USBHS Device attach.

#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

These macros manage the USBHS Device bus events.

#define udd_initiate_remote_wake_up()   (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP))
 
#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)
 
#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)
 
#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)
 
#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)
 
#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)
 
#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)
 
#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)
 
#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))
 

Detailed Description

USBHS Custom configuration

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.

management

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:

mode management

The Sleep modes authorized :

USBHS low-level driver for USB device mode

Macro Definition Documentation

◆ Is_udd_detached

#define Is_udd_detached ( )    (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))

Test if the device is detached.

Definition at line 123 of file usbhs_device.h.

◆ Is_udd_endpoint_dma_supported

#define Is_udd_endpoint_dma_supported (   ep)    ((((ep) >= 1) && ((ep) <= 7)) ? true : false)

Get DMA support of endpoints.

Definition at line 77 of file usbhs_device.h.

◆ Is_udd_endpoint_high_bw_supported

#define Is_udd_endpoint_high_bw_supported (   ep)    (((ep) >= 2) ? true : false)

Get High Band Width support of endpoints.

Definition at line 79 of file usbhs_device.h.

◆ Is_udd_frame_number_crc_error

#define Is_udd_frame_number_crc_error ( )    (Tst_bits(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNCERR))

Definition at line 190 of file usbhs_device.h.

◆ Is_udd_full_speed_mode

#define Is_udd_full_speed_mode ( )    true

Definition at line 100 of file usbhs_device.h.

◆ Is_udd_low_speed_enable

#define Is_udd_low_speed_enable ( )    (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))

Test if device low-speed mode is forced.

Definition at line 88 of file usbhs_device.h.

◆ Is_udd_msof

#define Is_udd_msof ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_MSOF))

Definition at line 200 of file usbhs_device.h.

◆ Is_udd_msof_interrupt_enabled

#define Is_udd_msof_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_MSOFE))

Definition at line 197 of file usbhs_device.h.

◆ Is_udd_pending_remote_wake_up

#define Is_udd_pending_remote_wake_up ( )    (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP))

Definition at line 134 of file usbhs_device.h.

◆ Is_udd_remote_wake_up_interrupt_enabled

#define Is_udd_remote_wake_up_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_UPRSME))

Definition at line 142 of file usbhs_device.h.

◆ Is_udd_remote_wake_up_start

#define Is_udd_remote_wake_up_start ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_UPRSM))

Definition at line 145 of file usbhs_device.h.

◆ Is_udd_reset

#define Is_udd_reset ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORST))

Definition at line 178 of file usbhs_device.h.

◆ Is_udd_reset_interrupt_enabled

#define Is_udd_reset_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSTE))

Definition at line 175 of file usbhs_device.h.

◆ Is_udd_resume

#define Is_udd_resume ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORSM))

Definition at line 156 of file usbhs_device.h.

◆ Is_udd_resume_interrupt_enabled

#define Is_udd_resume_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSME))

Definition at line 153 of file usbhs_device.h.

◆ Is_udd_sof

#define Is_udd_sof ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SOF))

Definition at line 188 of file usbhs_device.h.

◆ Is_udd_sof_interrupt_enabled

#define Is_udd_sof_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SOFE))

Definition at line 185 of file usbhs_device.h.

◆ Is_udd_suspend

#define Is_udd_suspend ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SUSP))

Definition at line 212 of file usbhs_device.h.

◆ Is_udd_suspend_interrupt_enabled

#define Is_udd_suspend_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SUSPE))

Definition at line 209 of file usbhs_device.h.

◆ Is_udd_wake_up

#define Is_udd_wake_up ( )    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_WAKEUP))

Definition at line 167 of file usbhs_device.h.

◆ Is_udd_wake_up_interrupt_enabled

#define Is_udd_wake_up_interrupt_enabled ( )    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_WAKEUPE))

Definition at line 164 of file usbhs_device.h.

◆ udd_ack_msof

#define udd_ack_msof ( )    (USBHS->USBHS_DEVICR = USBHS_DEVIMR_MSOFE)

Definition at line 198 of file usbhs_device.h.

◆ udd_ack_remote_wake_up_start

#define udd_ack_remote_wake_up_start ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_UPRSMC)

Definition at line 143 of file usbhs_device.h.

◆ udd_ack_reset

#define udd_ack_reset ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSTC)

Definition at line 176 of file usbhs_device.h.

◆ udd_ack_resume

#define udd_ack_resume ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSMC)

Definition at line 154 of file usbhs_device.h.

◆ udd_ack_sof

#define udd_ack_sof ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_SOFC)

Definition at line 186 of file usbhs_device.h.

◆ udd_ack_suspend

#define udd_ack_suspend ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_SUSPC)

Definition at line 210 of file usbhs_device.h.

◆ udd_ack_wake_up

#define udd_ack_wake_up ( )    (USBHS->USBHS_DEVICR = USBHS_DEVICR_WAKEUPC)

Definition at line 165 of file usbhs_device.h.

◆ udd_attach_device

#define udd_attach_device ( )    (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))

Attaches to USB bus.

Definition at line 121 of file usbhs_device.h.

◆ UDD_BULK_NB_BANK

#define UDD_BULK_NB_BANK (   ep)    2

Definition at line 343 of file usbhs_device.c.

◆ UDD_BULK_NB_BANK_ERROR

#define UDD_BULK_NB_BANK_ERROR
Value:
( UDD_EP_NB_BANK_ERROR( 1, BULK) \
|| UDD_EP_NB_BANK_ERROR( 2, BULK) \
|| UDD_EP_NB_BANK_ERROR( 3, BULK) \
|| UDD_EP_NB_BANK_ERROR( 4, BULK) \
|| UDD_EP_NB_BANK_ERROR( 5, BULK) \
|| UDD_EP_NB_BANK_ERROR( 6, BULK) \
|| UDD_EP_NB_BANK_ERROR( 7, BULK) \
|| UDD_EP_NB_BANK_ERROR( 8, BULK) \
|| UDD_EP_NB_BANK_ERROR( 9, BULK) \
|| UDD_EP_NB_BANK_ERROR(10, BULK) \
|| UDD_EP_NB_BANK_ERROR(11, BULK) \
|| UDD_EP_NB_BANK_ERROR(12, BULK) \
|| UDD_EP_NB_BANK_ERROR(13, BULK) \
|| UDD_EP_NB_BANK_ERROR(14, BULK) \
|| UDD_EP_NB_BANK_ERROR(15, BULK) )
#define UDD_EP_NB_BANK_ERROR(ep, type)
Definition: usbhs_device.c:282

Definition at line 301 of file usbhs_device.c.

◆ udd_detach_device

#define udd_detach_device ( )    (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))

Detaches from USB bus.

Definition at line 119 of file usbhs_device.h.

◆ udd_disable_msof_interrupt

#define udd_disable_msof_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_MSOFEC)

Definition at line 196 of file usbhs_device.h.

◆ udd_disable_remote_wake_up_interrupt

#define udd_disable_remote_wake_up_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_UPRSMEC)

Definition at line 141 of file usbhs_device.h.

◆ udd_disable_reset_interrupt

#define udd_disable_reset_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSTEC)

Definition at line 174 of file usbhs_device.h.

◆ udd_disable_resume_interrupt

#define udd_disable_resume_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSMEC)

Definition at line 152 of file usbhs_device.h.

◆ udd_disable_sof_interrupt

#define udd_disable_sof_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SOFEC)

Definition at line 184 of file usbhs_device.h.

◆ udd_disable_suspend_interrupt

#define udd_disable_suspend_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SUSPEC)

Definition at line 208 of file usbhs_device.h.

◆ udd_disable_wake_up_interrupt

#define udd_disable_wake_up_interrupt ( )    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_WAKEUPEC)

Definition at line 163 of file usbhs_device.h.

◆ udd_enable_msof_interrupt

#define udd_enable_msof_interrupt ( )    (USBHS->USBHS_DEVIER = USBHS_DEVIER_MSOFES)

Manage Micro start of frame event (High Speed Only)

Definition at line 195 of file usbhs_device.h.

◆ udd_enable_remote_wake_up_interrupt

#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"

Definition at line 140 of file usbhs_device.h.

◆ udd_enable_reset_interrupt

#define udd_enable_reset_interrupt ( )    (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSTES)

Manage reset event Set when a USB "End of Reset" has been detected

Definition at line 173 of file usbhs_device.h.

◆ udd_enable_resume_interrupt

#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

Definition at line 151 of file usbhs_device.h.

◆ udd_enable_sof_interrupt

#define udd_enable_sof_interrupt ( )    (USBHS->USBHS_DEVIER = USBHS_DEVIER_SOFES)

Manage start of frame event

Definition at line 183 of file usbhs_device.h.

◆ udd_enable_suspend_interrupt

#define udd_enable_suspend_interrupt ( )    (USBHS->USBHS_DEVIER = USBHS_DEVIER_SUSPES)

Manage suspend event

Definition at line 207 of file usbhs_device.h.

◆ udd_enable_wake_up_interrupt

#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

Definition at line 162 of file usbhs_device.h.

◆ UDD_EP_BULK_NB_BANK_ERROR

#define UDD_EP_BULK_NB_BANK_ERROR (   ep)    (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep))

Definition at line 277 of file usbhs_device.c.

◆ UDD_EP_BULK_NBANK_ERROR

#define UDD_EP_BULK_NBANK_ERROR (   ep)    ( (UDD_BULK_NB_BANK(ep) < 1) || (UDD_BULK_NB_BANK(ep) > 2) )

Definition at line 270 of file usbhs_device.c.

◆ UDD_EP_INT_NB_BANK_ERROR

#define UDD_EP_INT_NB_BANK_ERROR (   ep)    (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep))

Definition at line 279 of file usbhs_device.c.

◆ UDD_EP_INT_NBANK_ERROR

#define UDD_EP_INT_NBANK_ERROR (   ep)    ( (UDD_INTERRUPT_NB_BANK(ep) < 1) || (UDD_INTERRUPT_NB_BANK(ep) > 2) )

Definition at line 272 of file usbhs_device.c.

◆ UDD_EP_ISO_NB_BANK_ERROR

#define UDD_EP_ISO_NB_BANK_ERROR (   ep)    (UDD_EP_USED(ep) && UDD_EP_ISO_NBANK_ERROR(ep))

Definition at line 275 of file usbhs_device.c.

◆ UDD_EP_ISO_NBANK_ERROR

#define UDD_EP_ISO_NBANK_ERROR (   ep)
Value:
|| (UDD_ISOCHRONOUS_NB_BANK(ep) > 3) )
#define UDD_ISOCHRONOUS_NB_BANK(ep)
Definition: usbhs_device.c:335

Definition at line 267 of file usbhs_device.c.

◆ UDD_EP_NB_BANK_ERROR

#define UDD_EP_NB_BANK_ERROR (   ep,
  type 
)    (ATPASTE3(UDD_EP_, type, _NB_BANK_ERROR(ep)))

Definition at line 282 of file usbhs_device.c.

◆ udd_frame_number

#define udd_frame_number ( )    (Rd_bitfield(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNUM_Msk))

Definition at line 189 of file usbhs_device.h.

◆ udd_get_endpoint_bank_max_nbr

#define udd_get_endpoint_bank_max_nbr (   ep)    ((ep == 0) ? 1 : (( ep <= 2) ? 3 : 2))

Get maximal number of banks of endpoints.

Definition at line 73 of file usbhs_device.h.

◆ udd_get_endpoint_max_nbr

#define udd_get_endpoint_max_nbr ( )    (9)

Get maximal number of endpoints.

Definition at line 70 of file usbhs_device.h.

◆ udd_get_endpoint_size_max

#define udd_get_endpoint_size_max (   ep)    (((ep) == 0) ? 64 : 1024)

Get maximal size of endpoint (3X, 1024/64)

Definition at line 75 of file usbhs_device.h.

◆ udd_high_speed_disable

#define udd_high_speed_disable ( )    do { } while (0)

Definition at line 99 of file usbhs_device.h.

◆ udd_high_speed_enable

#define udd_high_speed_enable ( )    do { } while (0)

Definition at line 98 of file usbhs_device.h.

◆ udd_initiate_remote_wake_up

#define udd_initiate_remote_wake_up ( )    (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP))

Initiates a remote wake-up event

Definition at line 133 of file usbhs_device.h.

◆ UDD_INTERRUPT_NB_BANK

#define UDD_INTERRUPT_NB_BANK (   ep)    1

Definition at line 351 of file usbhs_device.c.

◆ UDD_INTERRUPT_NB_BANK_ERROR

#define UDD_INTERRUPT_NB_BANK_ERROR
Value:

Definition at line 317 of file usbhs_device.c.

◆ UDD_ISO_NB_BANK_ERROR

#define UDD_ISO_NB_BANK_ERROR
Value:
|| UDD_EP_NB_BANK_ERROR( 2, ISO) \
|| UDD_EP_NB_BANK_ERROR( 3, ISO) \
|| UDD_EP_NB_BANK_ERROR( 4, ISO) \
|| UDD_EP_NB_BANK_ERROR( 5, ISO) \
|| UDD_EP_NB_BANK_ERROR( 6, ISO) \
|| UDD_EP_NB_BANK_ERROR( 7, ISO) \
|| UDD_EP_NB_BANK_ERROR( 8, ISO) \
|| UDD_EP_NB_BANK_ERROR( 9, ISO) \
|| UDD_EP_NB_BANK_ERROR(10, ISO) \
|| UDD_EP_NB_BANK_ERROR(11, ISO) \
|| UDD_EP_NB_BANK_ERROR(12, ISO) \
|| UDD_EP_NB_BANK_ERROR(13, ISO) \
|| UDD_EP_NB_BANK_ERROR(14, ISO) \
|| UDD_EP_NB_BANK_ERROR(15, ISO) )
#define UDD_EP_NB_BANK_ERROR(ep, type)
Definition: usbhs_device.c:282

Definition at line 285 of file usbhs_device.c.

◆ UDD_ISOCHRONOUS_NB_BANK

#define UDD_ISOCHRONOUS_NB_BANK (   ep)    2

Definition at line 335 of file usbhs_device.c.

◆ udd_low_speed_disable

#define udd_low_speed_disable ( )    (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))

Definition at line 86 of file usbhs_device.h.

◆ udd_low_speed_enable

#define udd_low_speed_enable ( )    (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))

Enable/disable device low-speed mode.

Definition at line 85 of file usbhs_device.h.

◆ UDD_MAX_PEP_NB

#define UDD_MAX_PEP_NB   (udd_get_endpoint_max_nbr() + 1)

Definition at line 71 of file usbhs_device.h.

◆ udd_micro_frame_number

#define udd_micro_frame_number ( )    (Rd_bitfield(USBHS->USBHS_DEVFNUM, (USBHS_DEVFNUM_FNUM_Msk|USBHS_DEVFNUM_MFNUM_Msk)))

Definition at line 201 of file usbhs_device.h.

◆ udd_raise_msof

#define udd_raise_msof ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_MSOFS)

Definition at line 199 of file usbhs_device.h.

◆ udd_raise_remote_wake_up_start

#define udd_raise_remote_wake_up_start ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_UPRSMS)

Definition at line 144 of file usbhs_device.h.

◆ udd_raise_reset

#define udd_raise_reset ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSTS)

Definition at line 177 of file usbhs_device.h.

◆ udd_raise_resume

#define udd_raise_resume ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSMS)

Definition at line 155 of file usbhs_device.h.

◆ udd_raise_sof

#define udd_raise_sof ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SOFS)

Definition at line 187 of file usbhs_device.h.

◆ udd_raise_suspend

#define udd_raise_suspend ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SUSPS)

Definition at line 211 of file usbhs_device.h.

◆ udd_raise_wake_up

#define udd_raise_wake_up ( )    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_WAKEUPS)

Definition at line 166 of file usbhs_device.h.

◆ udd_vbus_monitor_sleep_mode

#define udd_vbus_monitor_sleep_mode (   lock)

Definition at line 427 of file usbhs_device.c.

◆ USBHS_DEVEPTCFG_EPDIR_Pos

#define USBHS_DEVEPTCFG_EPDIR_Pos   8

Definition at line 63 of file usbhs_device.h.

◆ USBHS_SLEEP_MODE_USB_IDLE

#define USBHS_SLEEP_MODE_USB_IDLE   SLEEPMGR_SLEEP_WFI

Definition at line 368 of file usbhs_device.c.

◆ USBHS_SLEEP_MODE_USB_SUSPEND

#define USBHS_SLEEP_MODE_USB_SUSPEND   SLEEPMGR_WAIT_FAST

Definition of sleep levels.

Definition at line 367 of file usbhs_device.c.

Enumeration Type Documentation

◆ udd_ctrl_ep_state_t

Bit definitions about endpoint control state machine for udd_ep_control_state.

Enumerator
UDD_EPCTRL_SETUP 

Wait a SETUP packet.

UDD_EPCTRL_DATA_OUT 

Wait a OUT data packet.

UDD_EPCTRL_DATA_IN 

Wait a IN data packet.

UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP 

Wait a IN ZLP packet.

UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP 

Wait a OUT ZLP packet.

UDD_EPCTRL_STALL_REQ 

STALL enabled on IN & OUT packet.

Definition at line 462 of file usbhs_device.c.

Function Documentation

◆ if() [1/4]

if ( udd_ctrl_interrupt()  )

Definition at line 688 of file usbhs_device.c.

◆ if() [2/4]

if ( Is_udd_reset()  )

Definition at line 699 of file usbhs_device.c.

◆ if() [3/4]

Definition at line 715 of file usbhs_device.c.

◆ if() [4/4]

Definition at line 728 of file usbhs_device.c.

◆ udd_attach()

void udd_attach ( void  )

Attach device to the bus when possible.

Warning
If a VBus control is included in driver, then it will attach device when an acceptable Vbus level from the host is detected.

Definition at line 898 of file usbhs_device.c.

◆ udd_ctrl_endofrequest()

static void udd_ctrl_endofrequest ( void  )
static

Call callback associated to setup request.

Definition at line 1802 of file usbhs_device.c.

◆ udd_ctrl_in_sent()

static void udd_ctrl_in_sent ( void  )
static

Managed reception of IN packet on control endpoint.

Definition at line 1549 of file usbhs_device.c.

◆ udd_ctrl_init()

static void udd_ctrl_init ( void  )
static

Reset control endpoint management.

Called after a USB line reset or at the end of SETUP request (after ZLP)

Definition at line 1462 of file usbhs_device.c.

◆ udd_ctrl_interrupt()

static bool udd_ctrl_interrupt ( void  )
static

Main interrupt routine for control endpoint.

This switchs control endpoint events to correct sub function.

Returns
1 if an event about control endpoint is occured, otherwise 0.

Definition at line 1811 of file usbhs_device.c.

◆ udd_ctrl_out_received()

static void udd_ctrl_out_received ( void  )
static

Managed reception of OUT packet on control endpoint.

Definition at line 1636 of file usbhs_device.c.

◆ udd_ctrl_overflow()

static void udd_ctrl_overflow ( void  )
static

Managed overflow event of OUT packet on control endpoint.

Definition at line 1744 of file usbhs_device.c.

◆ udd_ctrl_send_zlp_in()

static void udd_ctrl_send_zlp_in ( void  )
static

Send a ZLP IN on control endpoint.

Definition at line 1768 of file usbhs_device.c.

◆ udd_ctrl_send_zlp_out()

static void udd_ctrl_send_zlp_out ( void  )
static

Send a ZLP OUT on control endpoint.

Definition at line 1786 of file usbhs_device.c.

◆ udd_ctrl_setup_received()

static void udd_ctrl_setup_received ( void  )
static

Managed reception of SETUP packet on control endpoint.

Definition at line 1485 of file usbhs_device.c.

◆ udd_ctrl_stall_data()

static void udd_ctrl_stall_data ( void  )
static

Managed stall event of IN/OUT packet on control endpoint.

Definition at line 1760 of file usbhs_device.c.

◆ udd_ctrl_underflow()

static void udd_ctrl_underflow ( void  )
static

Managed underflow event of IN packet on control endpoint.

Definition at line 1727 of file usbhs_device.c.

◆ udd_detach()

void udd_detach ( void  )

Detaches the device from the bus.

The driver must remove pull-up on USB line D- or D+.

Definition at line 939 of file usbhs_device.c.

◆ udd_disable()

void udd_disable ( void  )

Disables the USB Device mode.

Definition at line 858 of file usbhs_device.c.

◆ udd_enable()

void udd_enable ( void  )

Enables the USB Device mode.

Definition at line 764 of file usbhs_device.c.

◆ udd_get_frame_number()

uint16_t udd_get_frame_number ( void  )

Returns the current start of frame number.

Returns
current start of frame number.

Definition at line 974 of file usbhs_device.c.

◆ udd_get_micro_frame_number()

uint16_t udd_get_micro_frame_number ( void  )

Returns the current micro start of frame number.

Returns
current micro start of frame number required in high speed mode.

Definition at line 979 of file usbhs_device.c.

◆ udd_getaddress()

uint8_t udd_getaddress ( void  )

Returns the USB address of device.

Returns
USB address

Definition at line 968 of file usbhs_device.c.

◆ udd_include_vbus_monitoring()

bool udd_include_vbus_monitoring ( void  )

Authorizes the VBUS event.

Returns
true, if the VBUS monitoring is possible.

Definition at line 754 of file usbhs_device.c.

◆ udd_is_high_speed()

bool udd_is_high_speed ( void  )

Test whether the USB Device Controller is running at high speed or not.

Returns
true if the Device is running at high speed mode, otherwise false.

Definition at line 950 of file usbhs_device.c.

◆ udd_reset_ep_ctrl()

static void udd_reset_ep_ctrl ( void  )
static

Reset control endpoint.

Called after a USB line reset or when UDD is enabled

Definition at line 1438 of file usbhs_device.c.

◆ udd_send_remotewakeup()

void udd_send_remotewakeup ( void  )

The USB driver sends a resume signal called Upstream Resume.

Definition at line 984 of file usbhs_device.c.

◆ udd_set_address()

void udd_set_address ( uint8_t  address)

Changes the USB address of device.

Parameters
addressNew USB address

Definition at line 960 of file usbhs_device.c.

◆ udd_set_setup_payload()

void udd_set_setup_payload ( uint8_t *  payload,
uint16_t  payload_size 
)

Load setup payload.

Parameters
payloadPointer on payload
payload_sizeSize of payload

Definition at line 997 of file usbhs_device.c.

◆ udd_sleep_mode()

static void udd_sleep_mode ( bool  b_idle)
static

Authorize or not the CPU powerdown mode.

Parameters
b_idletrue to authorize idle mode

Definition at line 380 of file usbhs_device.c.

◆ udd_vbus_handler()

static void udd_vbus_handler ( uint32_t  id,
uint32_t  mask 
)
static

USB VBus pin change handler

Definition at line 433 of file usbhs_device.c.

Variable Documentation

◆ __pad0__

udd_interrupt_end __pad0__

Definition at line 748 of file usbhs_device.c.

◆ __pad1__

udd_interrupt_sof_end __pad1__

Definition at line 750 of file usbhs_device.c.

◆ udd_b_idle

bool udd_b_idle
static

State of USB line.

Definition at line 371 of file usbhs_device.c.

◆ udd_b_sleep_initialized

bool udd_b_sleep_initialized = false
static

State of sleep manager.

Definition at line 373 of file usbhs_device.c.

◆ udd_ctrl_payload_buf_cnt

uint16_t udd_ctrl_payload_buf_cnt
static

Number of data received/sent to/from udd_g_ctrlreq.payload buffer.

Definition at line 478 of file usbhs_device.c.

◆ udd_ctrl_prev_payload_buf_cnt

uint16_t udd_ctrl_prev_payload_buf_cnt
static

Total number of data received/sent during data packet phase with previous payload buffers.

Definition at line 475 of file usbhs_device.c.

◆ udd_ep_control_state

udd_ctrl_ep_state_t udd_ep_control_state
static

State of the endpoint control management.

Definition at line 472 of file usbhs_device.c.

◆ udd_g_ctrlreq

COMPILER_WORD_ALIGNED udd_ctrl_request_t udd_g_ctrlreq

Global variable to give and record information about setup request management.

Definition at line 459 of file usbhs_device.c.



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