UOTGHS low-level driver for OTG features.
Functions | |
void | otg_dual_disable (void) |
Uninitialize the dual role This function is implemented in uotghs_host.c file. More... | |
bool | otg_dual_enable (void) |
Initialize the dual role This function is implemented in uotghs_host.c file. More... | |
UOTGHS OTG ID pin management | |
The ID pin come from the USB OTG connector (A and B receptable) and allows to select the USB mode host or device. The UOTGHS hardware can manage it automatically. This feature is optional. When USB_ID_GPIO is defined (in board.h), this feature is enabled. | |
#define | otg_enable_id_pin() (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Enable external OTG_ID pin (listened to by USB) More... | |
#define | otg_disable_id_pin() (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Disable external OTG_ID pin (ignored by USB) More... | |
#define | Is_otg_id_pin_enabled() (Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Test if external OTG_ID pin enabled (listened to by USB) More... | |
#define | otg_force_device_mode() (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD), otg_disable_id_pin()) |
Disable external OTG_ID pin and force device mode. More... | |
#define | Is_otg_device_mode_forced() (!Is_otg_id_pin_enabled() && Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD)) |
Test if device mode is forced. More... | |
#define | otg_force_host_mode() (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD), otg_disable_id_pin()) |
Disable external OTG_ID pin and force host mode. More... | |
#define | Is_otg_host_mode_forced() (!Is_otg_id_pin_enabled() && !Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD)) |
Test if host mode is forced. More... | |
UOTGHS OTG ID pin interrupt management | |
#define | otg_enable_id_interrupt() (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
#define | otg_disable_id_interrupt() (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
#define | Is_otg_id_interrupt_enabled() (Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
#define | Is_otg_id_device() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_ID)) |
#define | Is_otg_id_host() (!Is_otg_id_device()) |
#define | otg_ack_id_transition() (UOTGHS->UOTGHS_SCR = UOTGHS_SCR_IDTIC) |
#define | otg_raise_id_transition() (UOTGHS->UOTGHS_SFR = UOTGHS_SFR_IDTIS) |
#define | Is_otg_id_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_IDTI)) |
#define Is_otg_device_mode_forced | ( | ) | (!Is_otg_id_pin_enabled() && Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD)) |
Test if device mode is forced.
Referenced by ISR().
#define Is_otg_host_mode_forced | ( | ) | (!Is_otg_id_pin_enabled() && !Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD)) |
Test if host mode is forced.
Referenced by udd_disable().
#define Is_otg_id_device | ( | ) | (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_ID)) |
Referenced by ISR(), otg_dual_enable(), and udd_enable().
#define Is_otg_id_host | ( | ) | (!Is_otg_id_device()) |
Referenced by udd_disable(), and uhd_enable().
#define Is_otg_id_interrupt_enabled | ( | ) | (Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
#define Is_otg_id_pin_enabled | ( | ) | (Tst_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Test if external OTG_ID pin enabled (listened to by USB)
#define otg_ack_id_transition | ( | ) | (UOTGHS->UOTGHS_SCR = UOTGHS_SCR_IDTIC) |
Referenced by ISR(), and otg_dual_enable().
#define otg_disable_id_interrupt | ( | ) | (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
Referenced by otg_dual_disable().
#define otg_disable_id_pin | ( | ) | (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Disable external OTG_ID pin (ignored by USB)
Referenced by main_otg_init(), udd_enable(), and uhd_enable().
#define otg_enable_id_interrupt | ( | ) | (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_IDTE)) |
Referenced by otg_dual_enable().
#define otg_enable_id_pin | ( | ) | (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIDE)) |
Enable external OTG_ID pin (listened to by USB)
#define otg_force_device_mode | ( | ) | (Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD), otg_disable_id_pin()) |
Disable external OTG_ID pin and force device mode.
Referenced by main_otg_init(), and udd_enable().
#define otg_force_host_mode | ( | ) | (Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_UIMOD), otg_disable_id_pin()) |
Disable external OTG_ID pin and force host mode.
Referenced by uhd_enable().
#define otg_raise_id_transition | ( | ) | (UOTGHS->UOTGHS_SFR = UOTGHS_SFR_IDTIS) |
void otg_dual_disable | ( | void | ) |
Uninitialize the dual role This function is implemented in uotghs_host.c file.
References otg_disable, otg_disable_id_interrupt, otg_disable_pad, otg_freeze_clock, otg_initialized, otg_unfreeze_clock, pmc_clr_fast_startup_input(), pmc_disable_periph_clk(), sysclk_disable_usb(), uhd_sleep_mode(), and UHD_STATE_OFF.
Referenced by uhd_disable().
bool otg_dual_enable | ( | void | ) |
Initialize the dual role This function is implemented in uotghs_host.c file.
true
if the ID pin management has been started, otherwise false
. References Is_otg_id_device, otg_ack_id_transition, otg_enable, otg_enable_id_interrupt, otg_freeze_clock, otg_initialized, otg_unfreeze_clock, pmc_enable_periph_clk(), pmc_set_fast_startup_input(), sysclk_enable_usb(), udc_start(), UHC_MODE_CHANGE, uhc_start(), uhd_sleep_mode(), UHD_STATE_OFF, UHD_STATE_WAIT_ID_HOST, and UHD_USB_INT_LEVEL.
Referenced by udd_enable(), and uhd_enable().