USBB low-level driver for OTG features.
Functions | |
void | otg_dual_disable (void) |
Uninitialize the dual role This function is implemented in usbb_host.c file. More... | |
bool | otg_dual_enable (void) |
Initialize the dual role This function is implemented in usbb_host.c file. More... | |
USBB IP properties | |
#define | otg_get_ip_name() (((uint64_t)AVR32_USBB.uname2<<32)|(uint64_t)AVR32_USBB.uname1) |
Get IP name part 1 or 2. More... | |
#define | otg_data_memory_barrier() (AVR32_USBB.uvers) |
Instruction to access at a peripheral register after interrupt clear, see AVR32002 - AVR32UC Technical reference $6.6 Memory barriers. More... | |
#define | otg_get_ip_version() USBB_RD_BITFIELD(UVERS,VERSION_NUM) |
Get IP version. More... | |
#define | otg_get_dpram_size() (128 << USBB_RD_BITFIELD(UFEATURES,FIFO_MAX_SIZE)) |
Get DPRAM size (FIFO maximal size) in bytes. More... | |
#define | otg_get_ip_paddress_size() (AVR32_USBB.uaddrsize) |
Get size of USBB PB address space. More... | |
USBB 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 USBB hardware can manage it automatically. This feature is optional. When otg_ID_PIN equals true in conf_usb_host.h, the USB_ID must be defined in board.h. | |
#define | OTG_ID_PIN ATPASTE2(USB_ID, _PIN) |
Pin and function for OTG_ID according to configuration from USB_ID. More... | |
#define | OTG_ID_FUNCTION ATPASTE2(USB_ID, _FUNCTION) |
#define | otg_input_id_pin() |
Input USB_ID from its pin. More... | |
#define | otg_enable_id_pin() USBB_SET_BITS(USBCON,UIDE) |
#define | otg_disable_id_pin() USBB_CLR_BITS(USBCON,UIDE) |
#define | otg_force_device_mode() USBB_SET_BITS(USBCON,UIMOD) |
#define | Is_otg_device_mode_forced() USBB_TST_BITS(USBCON,UIMOD) |
#define | otg_force_host_mode() USBB_CLR_BITS(USBCON,UIMOD) |
#define | Is_otg_host_mode_forced() (!Is_otg_device_mode_forced()) |
USBB OTG ID pin interrupt management | |
#define | otg_enable_id_interrupt() USBB_SET_BITS(USBCON,IDTE) |
#define | otg_disable_id_interrupt() USBB_CLR_BITS(USBCON,IDTE) |
#define | Is_otg_id_interrupt_enabled() USBB_TST_BITS(USBCON,IDTE) |
#define | Is_otg_id_device() USBB_TST_BITS(USBSTA,ID) |
#define | Is_otg_id_host() (!Is_otg_id_device()) |
#define | otg_ack_id_transition() USBB_REG_CLR(USBSTA,IDTI) |
#define | Is_otg_id_transition() USBB_TST_BITS(USBSTA,IDTI) |
#define Is_otg_device_mode_forced | ( | ) | USBB_TST_BITS(USBCON,UIMOD) |
Referenced by ISR().
#define Is_otg_host_mode_forced | ( | ) | (!Is_otg_device_mode_forced()) |
Referenced by udd_disable().
#define Is_otg_id_device | ( | ) | USBB_TST_BITS(USBSTA,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 | ( | ) | USBB_TST_BITS(USBCON,IDTE) |
#define Is_otg_id_transition | ( | ) | USBB_TST_BITS(USBSTA,IDTI) |
Referenced by ISR().
#define otg_ack_id_transition | ( | ) | USBB_REG_CLR(USBSTA,IDTI) |
Referenced by ISR(), and otg_dual_enable().
#define otg_data_memory_barrier | ( | ) | (AVR32_USBB.uvers) |
Instruction to access at a peripheral register after interrupt clear, see AVR32002 - AVR32UC Technical reference $6.6 Memory barriers.
Referenced by ISR(), and udd_interrupt().
#define otg_disable_id_interrupt | ( | ) | USBB_CLR_BITS(USBCON,IDTE) |
Referenced by otg_dual_disable().
#define otg_disable_id_pin | ( | ) | USBB_CLR_BITS(USBCON,UIDE) |
Referenced by udd_enable(), and uhd_enable().
#define otg_enable_id_interrupt | ( | ) | USBB_SET_BITS(USBCON,IDTE) |
Referenced by otg_dual_enable().
#define otg_enable_id_pin | ( | ) | USBB_SET_BITS(USBCON,UIDE) |
#define otg_force_device_mode | ( | ) | USBB_SET_BITS(USBCON,UIMOD) |
Referenced by udd_enable().
#define otg_force_host_mode | ( | ) | USBB_CLR_BITS(USBCON,UIMOD) |
Referenced by uhd_enable().
#define otg_get_dpram_size | ( | ) | (128 << USBB_RD_BITFIELD(UFEATURES,FIFO_MAX_SIZE)) |
Get DPRAM size (FIFO maximal size) in bytes.
#define otg_get_ip_name | ( | ) | (((uint64_t)AVR32_USBB.uname2<<32)|(uint64_t)AVR32_USBB.uname1) |
Get IP name part 1 or 2.
#define otg_get_ip_paddress_size | ( | ) | (AVR32_USBB.uaddrsize) |
Get size of USBB PB address space.
#define otg_get_ip_version | ( | ) | USBB_RD_BITFIELD(UVERS,VERSION_NUM) |
Get IP version.
#define OTG_ID_FUNCTION ATPASTE2(USB_ID, _FUNCTION) |
#define OTG_ID_PIN ATPASTE2(USB_ID, _PIN) |
Pin and function for OTG_ID according to configuration from USB_ID.
#define otg_input_id_pin | ( | ) |
Input USB_ID from its pin.
Referenced by otg_dual_enable().
void otg_dual_disable | ( | void | ) |
Uninitialize the dual role This function is implemented in usbb_host.c file.
References otg_disable, otg_disable_id_interrupt, otg_disable_pad, otg_initialized, otg_unfreeze_clock, 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 usbb_host.c file.
true
if the ID pin management has been started, otherwise false
. References irq_register_handler, Is_otg_id_device, otg_ack_id_transition, otg_enable, otg_enable_id_interrupt, otg_freeze_clock, otg_initialized, otg_input_id_pin, otg_unfreeze_clock, pm_asyn_wake_up_enable(), 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().