Robobo
USB Device Driver (UDD)

Macros

#define UOTGHS_DEVEPTCFG_EPDIR_Pos   8
 

UOTGHS Device IP properties

These macros give access to IP properties

#define udd_get_endpoint_max_nbr()   (9)
 Get maximal number of endpoints.
 
#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.
 
#define udd_get_endpoint_size_max(ep)   (((ep) == 0) ? 64 : 512)
 Get maximal size of endpoint (3X, 1024/64)
 
#define Is_udd_endpoint_dma_supported(ep)   ((((ep) >= 1) && ((ep) <= 6)) ? true : false)
 Get DMA support of endpoints.
 
#define Is_udd_endpoint_high_bw_supported(ep)   (((ep) >= 2) ? true : false)
 Get High Band Width support of endpoints.
 

UOTGHS Device speeds management

#define udd_low_speed_enable()   (Set_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_LS))
 Enable/disable device low-speed mode.
 
#define udd_low_speed_disable()   (Clr_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_LS))
 
#define Is_udd_low_speed_enable()   (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_LS))
 Test if device low-speed mode is forced.
 
#define udd_high_speed_enable()   (Wr_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_SPDCONF_Msk, 0))
 Enable high speed mode.
 
#define udd_high_speed_disable()   (Wr_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_SPDCONF_Msk, 3))
 Disable high speed mode.
 
#define Is_udd_full_speed_mode()   (Rd_bitfield(UOTGHS->UOTGHS_SR, UOTGHS_SR_SPEED_Msk) == UOTGHS_SR_SPEED_FULL_SPEED)
 Test if controller is in full speed mode.
 

UOTGHS Device vbus management

#define udd_enable_vbus_interrupt()   (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_VBUSTE))
 
#define udd_disable_vbus_interrupt()   (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_VBUSTE))
 
#define Is_udd_vbus_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_VBUSTE))
 
#define Is_udd_vbus_high()   (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUS))
 
#define Is_udd_vbus_low()   (!Is_udd_vbus_high())
 
#define udd_ack_vbus_transition()   (UOTGHS->UOTGHS_SCR = UOTGHS_SCR_VBUSTIC)
 
#define udd_raise_vbus_transition()   (UOTGHS->UOTGHS_SFR = UOTGHS_SFR_VBUSTIS)
 
#define Is_udd_vbus_transition()   (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
 

UOTGHS device attach control

These macros manage the UOTGHS Device attach.

#define udd_detach_device()   (Set_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
 Detaches from USB bus.
 
#define udd_attach_device()   (Clr_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
 Attaches to USB bus.
 
#define Is_udd_detached()   (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
 Test if the device is detached.
 

UOTGHS device bus events control

These macros manage the UOTGHS Device bus events.

#define udd_initiate_remote_wake_up()   (Set_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_RMWKUP))
 
#define Is_udd_pending_remote_wake_up()   (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_RMWKUP))
 
#define udd_enable_remote_wake_up_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_UPRSMES)
 
#define udd_disable_remote_wake_up_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_UPRSMEC)
 
#define Is_udd_remote_wake_up_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_UPRSME))
 
#define udd_ack_remote_wake_up_start()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_UPRSMC)
 
#define udd_raise_remote_wake_up_start()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_UPRSMS)
 
#define Is_udd_remote_wake_up_start()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_UPRSM))
 
#define udd_enable_resume_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_EORSMES)
 
#define udd_disable_resume_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_EORSMEC)
 
#define Is_udd_resume_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_EORSME))
 
#define udd_ack_resume()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_EORSMC)
 
#define udd_raise_resume()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_EORSMS)
 
#define Is_udd_resume()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_EORSM))
 
#define udd_enable_wake_up_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_WAKEUPES)
 
#define udd_disable_wake_up_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_WAKEUPEC)
 
#define Is_udd_wake_up_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_WAKEUPE))
 
#define udd_ack_wake_up()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_WAKEUPC)
 
#define udd_raise_wake_up()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_WAKEUPS)
 
#define Is_udd_wake_up()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_WAKEUP))
 
#define udd_enable_reset_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_EORSTES)
 
#define udd_disable_reset_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_EORSTEC)
 
#define Is_udd_reset_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_EORSTE))
 
#define udd_ack_reset()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_EORSTC)
 
#define udd_raise_reset()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_EORSTS)
 
#define Is_udd_reset()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_EORST))
 
#define udd_enable_sof_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_SOFES)
 
#define udd_disable_sof_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_SOFEC)
 
#define Is_udd_sof_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_SOFE))
 
#define udd_ack_sof()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_SOFC)
 
#define udd_raise_sof()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_SOFS)
 
#define Is_udd_sof()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_SOF))
 
#define udd_frame_number()   (Rd_bitfield(UOTGHS->UOTGHS_DEVFNUM, UOTGHS_DEVFNUM_FNUM_Msk))
 
#define Is_udd_frame_number_crc_error()   (Tst_bits(UOTGHS->UOTGHS_DEVFNUM, UOTGHS_DEVFNUM_FNCERR))
 
#define udd_enable_msof_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_MSOFES)
 
#define udd_disable_msof_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_MSOFEC)
 
#define Is_udd_msof_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_MSOFE))
 
#define udd_ack_msof()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVIMR_MSOFE)
 
#define udd_raise_msof()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_MSOFS)
 
#define Is_udd_msof()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_MSOF))
 
#define udd_micro_frame_number()   (Rd_bitfield(UOTGHS->UOTGHS_DEVFNUM, (UOTGHS_DEVFNUM_FNUM_Msk|UOTGHS_DEVFNUM_MFNUM_Msk)))
 
#define udd_enable_suspend_interrupt()   (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_SUSPES)
 
#define udd_disable_suspend_interrupt()   (UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_SUSPEC)
 
#define Is_udd_suspend_interrupt_enabled()   (Tst_bits(UOTGHS->UOTGHS_DEVIMR, UOTGHS_DEVIMR_SUSPE))
 
#define udd_ack_suspend()   (UOTGHS->UOTGHS_DEVICR = UOTGHS_DEVICR_SUSPC)
 
#define udd_raise_suspend()   (UOTGHS->UOTGHS_DEVIFR = UOTGHS_DEVIFR_SUSPS)
 
#define Is_udd_suspend()   (Tst_bits(UOTGHS->UOTGHS_DEVISR, UOTGHS_DEVISR_SUSP))
 

Detailed Description

UOTGHS low-level driver for USB device mode

Macro Definition Documentation

#define udd_enable_msof_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_MSOFES)

Manage Micro start of frame event (High Speed Only)

#define udd_enable_remote_wake_up_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_UPRSMES)

Manage upstream resume event (=remote wakeup) The USB driver sends a resume signal called "Upstream Resume"

#define udd_enable_reset_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_EORSTES)

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

#define udd_enable_resume_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_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 ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_SOFES)

Manage start of frame event

#define udd_enable_suspend_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_SUSPES)

Manage suspend event

#define udd_enable_wake_up_interrupt ( )    (UOTGHS->UOTGHS_DEVIER = UOTGHS_DEVIER_WAKEUPES)

Manage wake-up event (=usb line activity) The USB controller is reactivated by a filtered non-idle signal from the lines

#define udd_initiate_remote_wake_up ( )    (Set_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_RMWKUP))

Initiates a remote wake-up event