Macros | |
#define | USB_INT_LEVEL 5 |
USB interrupt level By default USB interrupt have low priority. More... | |
Functions | |
void | otg_dual_disable (void) |
Uninitialize the dual role This function is implemented in usbhs_host.c file. More... | |
bool | otg_dual_enable (void) |
Initialize the dual role This function is implemented in usbhs_host.c file. More... | |
USBHS OTG ID pin management | |
The ID pin come from the USB OTG connector (A and B receptacle) and allows to select the USB mode host or device. The ID pin can be managed through PIO pin. This feature is optional, and it is enabled if USB_ID_PIN is defined in board.h and CONF_BOARD_USB_ID_DETECT defined in conf_board.h. | |
#define | OTG_ID_DETECT |
#define | OTG_ID_IO (defined(USB_ID_PIN) && OTG_ID_DETECT) |
#define | otg_id_init(handler) |
#define | otg_id_interrupt_enable() pio_enable_pin_interrupt(USB_ID_PIN) |
#define | otg_id_interrupt_disable() pio_disable_pin_interrupt(USB_ID_PIN) |
#define | Is_otg_id_device() ioport_get_pin_level(USB_ID_PIN) |
#define | Is_otg_id_host() (!Is_otg_id_device()) |
#define | otg_force_device_mode() (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
#define | Is_otg_device_mode_forced() (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Test if device mode is forced. More... | |
#define | otg_force_host_mode() (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Disable external OTG_ID pin and force host mode. More... | |
#define | Is_otg_host_mode_forced() (!Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Test if host mode is forced. More... | |
USBHS OTG VBUS pin management | |
USBHS peripheral does not support VBUS management and it's monitored by a PIO pin. This feature is optional, and it is enabled if USB_VBUS_PIN is defined in board.h and CONF_BOARD_USB_VBUS_DETECT defined in conf_board.h.
| |
#define | OTG_VBUS_DETECT |
#define | OTG_VBUS_IO (defined(USB_VBUS_PIN) && OTG_VBUS_DETECT) |
#define | USB_VBUS_WKUP 0 |
#define | otg_vbus_init(handler) |
#define | Is_otg_vbus_high() ioport_get_pin_level(USB_VBUS_PIN) |
#define | Is_otg_vbus_low() (!Is_otg_vbus_high()) |
#define | otg_enable_vbus_interrupt() pio_enable_pin_interrupt(USB_VBUS_PIN) |
#define | otg_disable_vbus_interrupt() pio_disable_pin_interrupt(USB_VBUS_PIN) |
USBHS OTG main management | |
These macros allows to enable/disable pad and USBHS hardware | |
#define | otg_reset() |
Reset USB macro. More... | |
#define | otg_enable() (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
Enable USB macro. More... | |
#define | otg_disable() (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
Disable USB macro. More... | |
#define | Is_otg_enabled() (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
#define | Is_otg_clock_usable() (Tst_bits(USBHS->USBHS_SR, USBHS_SR_CLKUSABLE)) |
For parts with HS feature, this one corresponding at UTMI clock. More... | |
#define | otg_freeze_clock() (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
Stop (freeze) internal USB clock. More... | |
#define | otg_unfreeze_clock() (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
#define | Is_otg_clock_frozen() (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
#define | otg_enable_rderr_interrupt() (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
Enables RDERR interrupt. More... | |
#define | otg_disable_rderr_interrupt() (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
Disables RDERR interrupt. More... | |
#define | Is_otg_rderr_interrupt_enabled() (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
#define | otg_ack_rderr_interrupt() (USBHS->USBHS_SCR = USBHS_SCR_RDERRIC) |
ACKs RDERR interrupt. More... | |
#define | otg_raise_rderr_interrupt() (USBHS->USBHS_SFR = USBHS_SFR_RDERRIS) |
Raises RDERR interrupt. More... | |
#define | Is_otg_rderr_interrupt() (Tst_bits(USBHS->USBHS_SR, USBHS_SR_RDERRI)) |
Tests if a RDERR occurs. More... | |
USBHS low-level driver for OTG features
#define Is_otg_clock_frozen | ( | ) | (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
Definition at line 178 of file usbhs_otg.h.
#define Is_otg_clock_usable | ( | ) | (Tst_bits(USBHS->USBHS_SR, USBHS_SR_CLKUSABLE)) |
For parts with HS feature, this one corresponding at UTMI clock.
Check Clock Usable
Definition at line 173 of file usbhs_otg.h.
#define Is_otg_device_mode_forced | ( | ) | (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Test if device mode is forced.
Definition at line 121 of file usbhs_otg.h.
#define Is_otg_enabled | ( | ) | (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
Definition at line 169 of file usbhs_otg.h.
#define Is_otg_host_mode_forced | ( | ) | (!Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Test if host mode is forced.
Definition at line 125 of file usbhs_otg.h.
#define Is_otg_id_device | ( | ) | ioport_get_pin_level(USB_ID_PIN) |
Definition at line 115 of file usbhs_otg.h.
#define Is_otg_id_host | ( | ) | (!Is_otg_id_device()) |
Definition at line 116 of file usbhs_otg.h.
#define Is_otg_rderr_interrupt | ( | ) | (Tst_bits(USBHS->USBHS_SR, USBHS_SR_RDERRI)) |
Tests if a RDERR occurs.
Definition at line 190 of file usbhs_otg.h.
#define Is_otg_rderr_interrupt_enabled | ( | ) | (Tst_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
Definition at line 184 of file usbhs_otg.h.
#define Is_otg_vbus_high | ( | ) | ioport_get_pin_level(USB_VBUS_PIN) |
Definition at line 148 of file usbhs_otg.h.
#define Is_otg_vbus_low | ( | ) | (!Is_otg_vbus_high()) |
Definition at line 149 of file usbhs_otg.h.
#define otg_ack_rderr_interrupt | ( | ) | (USBHS->USBHS_SCR = USBHS_SCR_RDERRIC) |
ACKs RDERR interrupt.
Definition at line 186 of file usbhs_otg.h.
#define otg_disable | ( | ) | (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
Disable USB macro.
Definition at line 168 of file usbhs_otg.h.
#define otg_disable_rderr_interrupt | ( | ) | (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
Disables RDERR interrupt.
Definition at line 183 of file usbhs_otg.h.
#define otg_disable_vbus_interrupt | ( | ) | pio_disable_pin_interrupt(USB_VBUS_PIN) |
Definition at line 151 of file usbhs_otg.h.
#define otg_enable | ( | ) | (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_USBE)) |
Enable USB macro.
Definition at line 166 of file usbhs_otg.h.
#define otg_enable_rderr_interrupt | ( | ) | (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_RDERRE)) |
Enables RDERR interrupt.
Definition at line 181 of file usbhs_otg.h.
#define otg_enable_vbus_interrupt | ( | ) | pio_enable_pin_interrupt(USB_VBUS_PIN) |
Definition at line 150 of file usbhs_otg.h.
#define otg_force_device_mode | ( | ) | (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Definition at line 119 of file usbhs_otg.h.
#define otg_force_host_mode | ( | ) | (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_UIMOD)) |
Disable external OTG_ID pin and force host mode.
Definition at line 123 of file usbhs_otg.h.
#define otg_freeze_clock | ( | ) | (Set_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
Stop (freeze) internal USB clock.
Definition at line 176 of file usbhs_otg.h.
#define OTG_ID_DETECT |
Definition at line 106 of file usbhs_otg.h.
#define otg_id_init | ( | handler | ) |
Definition at line 111 of file usbhs_otg.h.
#define otg_id_interrupt_disable | ( | ) | pio_disable_pin_interrupt(USB_ID_PIN) |
Definition at line 114 of file usbhs_otg.h.
#define otg_id_interrupt_enable | ( | ) | pio_enable_pin_interrupt(USB_ID_PIN) |
Definition at line 113 of file usbhs_otg.h.
#define OTG_ID_IO (defined(USB_ID_PIN) && OTG_ID_DETECT) |
Definition at line 108 of file usbhs_otg.h.
#define otg_raise_rderr_interrupt | ( | ) | (USBHS->USBHS_SFR = USBHS_SFR_RDERRIS) |
Raises RDERR interrupt.
Definition at line 188 of file usbhs_otg.h.
#define otg_reset | ( | ) |
Reset USB macro.
Definition at line 158 of file usbhs_otg.h.
#define otg_unfreeze_clock | ( | ) | (Clr_bits(USBHS->USBHS_CTRL, USBHS_CTRL_FRZCLK)) |
Definition at line 177 of file usbhs_otg.h.
#define OTG_VBUS_DETECT |
Definition at line 139 of file usbhs_otg.h.
#define otg_vbus_init | ( | handler | ) |
Definition at line 146 of file usbhs_otg.h.
#define OTG_VBUS_IO (defined(USB_VBUS_PIN) && OTG_VBUS_DETECT) |
Definition at line 141 of file usbhs_otg.h.
#define USB_INT_LEVEL 5 |
USB interrupt level By default USB interrupt have low priority.
Definition at line 79 of file usbhs_otg.h.
#define USB_VBUS_WKUP 0 |
Definition at line 143 of file usbhs_otg.h.
void otg_dual_disable | ( | void | ) |
Uninitialize the dual role This function is implemented in usbhs_host.c file.
bool otg_dual_enable | ( | void | ) |
Initialize the dual role This function is implemented in usbhs_host.c file.
true
if the ID pin management has been started, otherwise false
.