USB OTG Driver for USBHS. More...
#include "compiler.h"
#include "conf_board.h"
#include "board.h"
#include "ioport.h"
#include "pio.h"
#include "pio_handler.h"
Go to the source code of this file.
Macros | |
#define | USB_INT_LEVEL 5 |
USB interrupt level By default USB interrupt have low priority. 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... | |
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... | |
static __always_inline void | otg_io_pin_init (uint32_t pin, uint32_t flags, IRQn_Type port_irqn, uint8_t irq_level, void(*handler)(uint32_t, uint32_t), uint32_t wkup) |
USB OTG Driver for USBHS.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
Definition in file usbhs_otg.h.
|
static |
Definition at line 53 of file usbhs_otg.h.