USBC low-level driver for USB host mode.
USBC Host IP properties | |
These macros give access to IP properties Get maximal number of endpoints | |
#define | uhd_get_pipe_max_nbr() otg_get_max_nbr_endpoints() |
#define | UHD_MAX_PEP_NB USBC_EPT_NBR |
#define | UHD_PEP_NB (UHD_MAX_PEP_NB+1) |
Host Misc | |
#define | uhd_disable_all_interrupts() |
#define | uhd_disable_wakeup_interrupts() |
Disable wakeup/resume interrupts. More... | |
#define | uhd_ack_all_interrupts() |
Ack all interrupts. More... | |
Host Vbus line control | |
VBOF is an optional output pin which allows to enable or disable the external VBus generator. VBOF is managed through GPIO driver. This feature is optional, and it is enabled if USB_VBOF_PIN is defined in board.h and (CONF_BOARD_USB_VBUS_CONTROL) not defined in conf_board.h. | |
#define | UHD_VBUS_CTRL (defined(CONF_BOARD_USB_VBUS_CONTROL)) |
#define | UHD_VBOF_IO (defined(USB_VBOF_PIN) && UHD_VBUS_CTRL) |
#define | pad_vbus_enable() ioport_set_pin_level(USB_VBOF_PIN, USB_VBOF_ACTIVE_LEVEL) |
#define | pad_vbus_disable() ioport_set_pin_level(USB_VBOF_PIN, USB_VBOF_INACTIVE_LEVEL) |
Host Vbus line error monitoring | |
The VBus generator can provide an error signal through a GPIO or EIC pin. This feature is optional, and it is enabled if USB_VBERR_PIN or USB_VBERR_EIC is defined in board.h and CONF_BOARD_USB_VBUS_ERR_DETECT defined in conf_board.h. | |
#define | UHD_VBUS_ERR_DETECT (defined(CONF_BOARD_USB_VBUS_ERR_DETECT)) |
#define | UHD_VBERR_IO (defined(USB_VBERR_PIN) && UHD_VBUS_ERR_DETECT) |
#define | UHD_VBERR_EIC (defined(USB_VBERR_EIC) && UHD_VBUS_ERR_DETECT) |
#define | pad_vbus_error_init() eic_pad_init(USB_VBERR_EIC_LINE, uhd_vberr_handler, USB_VBERR_EIC_IRQn, USB_VBERR_EIC, UHD_USB_INT_LEVEL); |
#define | pad_vbus_error_interrupt_disable() eic_line_disable_interrupt(EIC, USB_VBERR_EIC_LINE) |
#define | pad_ack_vbus_error_interrupt() |
#define | Is_pad_vbus_error() ioport_get_pin_level(USB_VBERR_EIC) |
USB device connection/disconnection monitoring | |
#define | uhd_enable_connection_int() USBC_REG_SET(UHINTE,DCONNIE) |
#define | uhd_disable_connection_int() USBC_REG_CLR(UHINTE,DCONNIE) |
#define | Is_uhd_connection_int_enabled() USBC_TST_BITS(UHINTE,DCONNIE) |
#define | uhd_raise_connection() USBC_REG_SET(UHINT,DCONNI); |
#define | uhd_ack_connection() USBC_REG_CLR(UHINT,DCONNI) |
#define | Is_uhd_connection() USBC_TST_BITS(UHINT,DCONNI) |
#define | uhd_enable_disconnection_int() USBC_REG_SET(UHINTE,DDISCIE) |
#define | uhd_disable_disconnection_int() USBC_REG_CLR(UHINTE,DDISCIE) |
#define | Is_uhd_disconnection_int_enabled() USBC_TST_BITS(UHINTE,DDISCIE) |
#define | uhd_raise_disconnection() USBC_REG_SET(UHINT,DDISCI); |
#define | uhd_ack_disconnection() USBC_REG_CLR(UHINT,DDISCI) |
#define | Is_uhd_disconnection() USBC_TST_BITS(UHINT,DDISCI) |
USB device speed control | |
#define | uhd_get_speed_mode() USBC_RD_BITS(USBSTA,SPEED_Msk) |
#define | Is_uhd_low_speed_mode() (USBC_RD_BITS(USBSTA,SPEED_Msk) == USBC_USBSTA_SPEED_LOW) |
#define | Is_uhd_full_speed_mode() (USBC_RD_BITS(USBSTA,SPEED_Msk) == USBC_USBSTA_SPEED_FULL) |
#define | Is_uhd_high_speed_mode() false |
#define Is_pad_vbus_error | ( | ) | ioport_get_pin_level(USB_VBERR_EIC) |
#define Is_uhd_connection | ( | ) | USBC_TST_BITS(UHINT,DCONNI) |
Referenced by uhd_interrupt().
#define Is_uhd_connection_int_enabled | ( | ) | USBC_TST_BITS(UHINTE,DCONNIE) |
Referenced by uhd_interrupt().
#define Is_uhd_disconnection | ( | ) | USBC_TST_BITS(UHINT,DDISCI) |
Referenced by uhd_interrupt(), and uhd_sof_interrupt().
#define Is_uhd_disconnection_int_enabled | ( | ) | USBC_TST_BITS(UHINTE,DDISCIE) |
Referenced by uhd_interrupt().
#define Is_uhd_downstream_resume | ( | ) | USBC_TST_BITS(UHINT,RSMEDI) |
Referenced by uhd_interrupt().
#define Is_uhd_downstream_resume_interrupt_enabled | ( | ) | USBC_TST_BITS(UHINTE,RSMEDIE) |
#define Is_uhd_full_speed_mode | ( | ) | (USBC_RD_BITS(USBSTA,SPEED_Msk) == USBC_USBSTA_SPEED_FULL) |
#define Is_uhd_high_speed_mode | ( | ) | false |
Referenced by uhd_interrupt().
#define Is_uhd_low_speed_mode | ( | ) | (USBC_RD_BITS(USBSTA,SPEED_Msk) == USBC_USBSTA_SPEED_LOW) |
Referenced by uhd_interrupt(), and uhd_sof_interrupt().
#define Is_uhd_reset_sent | ( | ) | USBC_TST_BITS(UHINT,RSTI) |
Referenced by uhd_interrupt().
#define Is_uhd_reset_sent_interrupt_enabled | ( | ) | USBC_TST_BITS(UHINTE,RSTIE) |
#define Is_uhd_sending_resume | ( | ) | USBC_TST_BITS(UHCON,RESUME) |
#define Is_uhd_sof | ( | ) | USBC_TST_BITS(UHINT,HSOFI) |
Referenced by uhd_interrupt().
#define Is_uhd_sof_enabled | ( | ) | USBC_TST_BITS(UHCON,SOFE) |
Referenced by uhd_is_suspend(), uhd_resume(), and uhd_sof_interrupt().
#define Is_uhd_sof_interrupt_enabled | ( | ) | USBC_TST_BITS(UHINTE,HSOFIE) |
#define Is_uhd_starting_reset | ( | ) | USBC_TST_BITS(UHCON,RESET) |
#define Is_uhd_upstream_resume | ( | ) | USBC_TST_BITS(UHINT,RXRSMI) |
Referenced by uhd_interrupt().
#define Is_uhd_upstream_resume_interrupt_enabled | ( | ) | USBC_TST_BITS(UHINTE,RXRSMIE) |
#define Is_uhd_wakeup | ( | ) | USBC_TST_BITS(UHINT,HWUPI) |
Referenced by uhd_interrupt().
#define Is_uhd_wakeup_interrupt_enabled | ( | ) | USBC_TST_BITS(UHINTE,HWUPIE) |
Referenced by uhd_interrupt().
#define pad_ack_vbus_error_interrupt | ( | ) |
#define pad_vbus_disable | ( | ) | ioport_set_pin_level(USB_VBOF_PIN, USB_VBOF_INACTIVE_LEVEL) |
Referenced by uhd_disable().
#define pad_vbus_enable | ( | ) | ioport_set_pin_level(USB_VBOF_PIN, USB_VBOF_ACTIVE_LEVEL) |
Referenced by uhd_enable().
#define pad_vbus_error_init | ( | ) | eic_pad_init(USB_VBERR_EIC_LINE, uhd_vberr_handler, USB_VBERR_EIC_IRQn, USB_VBERR_EIC, UHD_USB_INT_LEVEL); |
Referenced by uhd_enable().
#define pad_vbus_error_interrupt_disable | ( | ) | eic_line_disable_interrupt(EIC, USB_VBERR_EIC_LINE) |
Referenced by uhd_disable().
#define uhd_ack_all_interrupts | ( | ) |
Ack all interrupts.
Referenced by uhd_enable().
#define uhd_ack_connection | ( | ) | USBC_REG_CLR(UHINT,DCONNI) |
Referenced by uhd_interrupt().
#define uhd_ack_disconnection | ( | ) | USBC_REG_CLR(UHINT,DDISCI) |
Referenced by uhd_interrupt().
#define uhd_ack_downstream_resume | ( | ) | USBC_REG_CLR(UHINT,RSMEDI) |
#define uhd_ack_reset_sent | ( | ) | USBC_REG_CLR(UHINT,RSTI) |
Referenced by uhd_interrupt().
#define uhd_ack_sof | ( | ) | USBC_REG_CLR(UHINT,HSOFI) |
Referenced by uhd_interrupt().
#define uhd_ack_upstream_resume | ( | ) | USBC_REG_CLR(UHINT,RXRSMI) |
#define uhd_ack_wakeup | ( | ) | USBC_REG_CLR(UHINT,HWUPI) |
Referenced by uhd_interrupt().
#define uhd_disable_all_interrupts | ( | ) |
Referenced by uhd_disable().
#define uhd_disable_connection_int | ( | ) | USBC_REG_CLR(UHINTE,DCONNIE) |
Referenced by uhd_interrupt().
#define uhd_disable_disconnection_int | ( | ) | USBC_REG_CLR(UHINTE,DDISCIE) |
Referenced by uhd_interrupt().
#define uhd_disable_downstream_resume_interrupt | ( | ) | USBC_REG_CLR(UHINTE,RSMEDIE) |
#define uhd_disable_reset_sent_interrupt | ( | ) | USBC_REG_CLR(UHINTE,RSTIE) |
#define uhd_disable_sof | ( | ) | USBC_CLR_BITS(UHCON,SOFE) |
Referenced by uhd_disable(), and uhd_sof_interrupt().
#define uhd_disable_sof_interrupt | ( | ) | USBC_REG_CLR(UHINTE,HSOFIE) |
#define uhd_disable_upstream_resume_interrupt | ( | ) | USBC_REG_CLR(UHINTE,RXRSMIE) |
#define uhd_disable_wakeup_interrupt | ( | ) | USBC_REG_CLR(UHINTE,HWUPIE) |
Referenced by uhd_interrupt().
#define uhd_disable_wakeup_interrupts | ( | ) |
Disable wakeup/resume interrupts.
Referenced by uhd_interrupt().
#define uhd_enable_connection_int | ( | ) | USBC_REG_SET(UHINTE,DCONNIE) |
Referenced by uhd_enable(), and uhd_interrupt().
#define uhd_enable_disconnection_int | ( | ) | USBC_REG_SET(UHINTE,DDISCIE) |
Referenced by uhd_interrupt().
#define uhd_enable_downstream_resume_interrupt | ( | ) | USBC_REG_SET(UHINTE,RSMEDIE) |
#define uhd_enable_reset_sent_interrupt | ( | ) | USBC_REG_SET(UHINTE,RSTIE) |
Referenced by uhd_enable().
#define uhd_enable_sof | ( | ) | USBC_SET_BITS(UHCON,SOFE) |
Initiates a SOF events.
Referenced by uhd_interrupt(), and uhd_resume().
#define uhd_enable_sof_interrupt | ( | ) | USBC_REG_SET(UHINTE,HSOFIE) |
Referenced by uhd_enable().
#define uhd_enable_upstream_resume_interrupt | ( | ) | USBC_REG_SET(UHINTE,RXRSMIE) |
#define uhd_enable_wakeup_interrupt | ( | ) | USBC_REG_SET(UHINTE,HWUPIE) |
Detection of a wake-up event A wake-up event is received when the host controller is in the suspend mode:
Referenced by uhd_enable(), and uhd_interrupt().
#define uhd_get_frame_position | ( | ) | USBC_RD_BITFIELD(UHFNUM,FLENHIGH) |
Referenced by uhd_sof_interrupt().
#define uhd_get_microsof_number | ( | ) |
Referenced by uhd_get_microframe_number().
#define uhd_get_pipe_max_nbr | ( | ) | otg_get_max_nbr_endpoints() |
#define uhd_get_sof_number | ( | ) | USBC_RD_BITFIELD(UHFNUM,FNUM) |
Referenced by uhd_get_frame_number().
#define uhd_get_speed_mode | ( | ) | USBC_RD_BITS(USBSTA,SPEED_Msk) |
Referenced by uhd_get_speed().
#define UHD_MAX_PEP_NB USBC_EPT_NBR |
#define UHD_PEP_NB (UHD_MAX_PEP_NB+1) |
Referenced by uhd_ep_abort(), uhd_ep_alloc(), uhd_ep_free(), uhd_ep_run(), uhd_interrupt(), uhd_sof_interrupt(), and uhd_suspend().
#define uhd_raise_connection | ( | ) | USBC_REG_SET(UHINT,DCONNI); |
#define uhd_raise_disconnection | ( | ) | USBC_REG_SET(UHINT,DDISCI); |
#define uhd_send_resume | ( | ) | USBC_SET_BITS(UHCON,RESUME) |
Initiates a resume event It is called downstream resume event.
Referenced by uhd_interrupt(), and uhd_resume().
#define uhd_start_reset | ( | ) | USBC_SET_BITS(UHCON,RESET) |
Initiates a reset event.
Referenced by uhd_send_reset().
#define uhd_stop_reset | ( | ) | USBC_CLR_BITS(UHCON,RESET) |
Referenced by uhd_interrupt().
#define UHD_VBERR_EIC (defined(USB_VBERR_EIC) && UHD_VBUS_ERR_DETECT) |
#define UHD_VBERR_IO (defined(USB_VBERR_PIN) && UHD_VBUS_ERR_DETECT) |
#define UHD_VBOF_IO (defined(USB_VBOF_PIN) && UHD_VBUS_CTRL) |
#define UHD_VBUS_CTRL (defined(CONF_BOARD_USB_VBUS_CONTROL)) |
#define UHD_VBUS_ERR_DETECT (defined(CONF_BOARD_USB_VBUS_ERR_DETECT)) |