USBC OTG Driver header file.
Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
|
#define | AVR32_USBC_EPT_NUM 7 |
|
#define | USBC_CLR_BITS(reg, bit) |
|
#define | USBC_RD_BITFIELD(reg, bit) |
|
#define | USBC_REG_CLR(reg, bit) |
|
#define | USBC_REG_SET(reg, bit) |
|
#define | USBC_SET_BITS(reg, bit) |
|
#define | USBC_TST_BITS(reg, bit) |
|
#define | USBC_WR_BITFIELD(reg, bit, value) |
|
|
These macros give access to IP properties
|
#define | otg_get_ip_name() (((uint64_t)AVR32_USBC.uname2<<32)|(uint64_t)AVR32_USBC.uname1) |
| Get IP name part 1 or 2. More...
|
|
#define | otg_data_memory_barrier() (AVR32_USBC.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() USBC_RD_BITFIELD(UVERS,VERSION_NUM) |
| Get IP version. More...
|
|
#define | otg_get_dpram_size() (128 << USBC_RD_BITFIELD(UFEATURES,FIFO_MAX_SIZE)) |
| Get DPRAM size (FIFO maximal size) in bytes. More...
|
|
#define | otg_get_ip_paddress_size() (AVR32_USBC.uaddrsize) |
| Get size of USBC PB address space. More...
|
|
|
The ID pin come from the USB OTG connector (A and B receptable) and allows to select the USB mode host or device.
The USBC 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() USBC_SET_BITS(USBCON,UIDE) |
|
#define | otg_disable_id_pin() USBC_CLR_BITS(USBCON,UIDE) |
|
#define | otg_force_device_mode() USBC_SET_BITS(USBCON,UIMOD) |
|
#define | Is_otg_device_mode_forced() USBC_TST_BITS(USBCON,UIMOD) |
|
#define | otg_force_host_mode() USBC_CLR_BITS(USBCON,UIMOD) |
|
#define | Is_otg_host_mode_forced() (!Is_otg_device_mode_forced()) |
|
|
These macros manage the ID pin interrupt
|
#define | otg_enable_id_interrupt() USBC_SET_BITS(USBCON,IDTE) |
|
#define | otg_disable_id_interrupt() USBC_CLR_BITS(USBCON,IDTE) |
|
#define | Is_otg_id_interrupt_enabled() USBC_TST_BITS(USBCON,IDTE) |
|
#define | Is_otg_id_device() USBC_TST_BITS(USBSTA,ID) |
|
#define | Is_otg_id_host() (!Is_otg_id_device()) |
|
#define | otg_ack_id_transition() USBC_REG_CLR(USBSTA,IDTI) |
|
#define | Is_otg_id_transition() USBC_TST_BITS(USBSTA,IDTI) |
|
|
#define | otg_enable_vbus_interrupt() USBC_SET_BITS(USBCON,VBUSTE) |
|
#define | otg_disable_vbus_interrupt() USBC_CLR_BITS(USBCON,VBUSTE) |
|
#define | Is_otg_vbus_interrupt_enabled() USBC_TST_BITS(USBCON,VBUSTE) |
|
#define | Is_otg_vbus_high() USBC_TST_BITS(USBSTA,VBUS) |
|
#define | Is_otg_vbus_low() (!Is_otg_vbus_high()) |
|
#define | otg_ack_vbus_transition() USBC_REG_CLR(USBSTA,VBUSTI) |
|
#define | otg_raise_vbus_transition() USBC_REG_SET(USBSTA,VBUSTI) |
|
#define | Is_otg_vbus_transition() USBC_TST_BITS(USBSTA,VBUSTI) |
|
|
These macros allows to enable/disable pad and USBC hardware
|
#define | otg_enable() USBC_SET_BITS(USBCON,USBE) |
|
#define | otg_disable() USBC_CLR_BITS(USBCON,USBE) |
|
#define | otg_enable_pad() USBC_SET_BITS(USBCON,OTGPADE) |
|
#define | otg_disable_pad() USBC_CLR_BITS(USBCON,OTGPADE) |
|
#define | otg_register_desc_tab(addr) (Wr_bitfield(AVR32_USBC.udesc, AVR32_USBC_UDESC_MASK, addr)) |
|
#define | Is_otg_clock_usable() USBC_TST_BITS(USBSTA,CLKUSABLE) |
| Check USB interface clock usable. More...
|
|
#define | otg_freeze_clock() USBC_SET_BITS(USBCON,FRZCLK) |
|
#define | otg_unfreeze_clock() USBC_CLR_BITS(USBCON,FRZCLK) |
|
#define | Is_otg_clock_frozen() USBC_TST_BITS(USBCON,FRZCLK) |
|
|
These macros manages the hardware OTG protocol
|
#define | otg_configure_timeout(timer, timeout) |
| Configure time-out of specified OTG timer. More...
|
|
#define | otg_get_timeout(timer) |
| Get configured time-out of specified OTG timer. More...
|
|
#define | otg_get_fsm_drd_state() USBC_RD_BITFIELD(USBFSM,DRDSTATE) |
| Get the dual-role device state of the internal USB finite state machine of the USBC controller. More...
|
|
#define | otg_device_initiate_hnp() USBC_SET_BITS(USBCON,HNPREQ) |
| Host negotiation Protocol. More...
|
|
#define | otg_host_accept_hnp() USBC_SET_BITS(USBCON,HNPREQ) |
|
#define | otg_host_reject_hnp() USBC_CLR_BITS(USBCON,HNPREQ) |
|
#define | Is_otg_hnp() USBC_TST_BITS(USBCON,HNPREQ) |
|
#define | otg_enable_hnp_error_interrupt() USBC_SET_BITS(USBCON,HNPERRE) |
|
#define | otg_disable_hnp_error_interrupt() USBC_CLR_BITS(USBCON,HNPERRE) |
|
#define | Is_otg_hnp_error_interrupt_enabled() USBC_TST_BITS(USBCON,HNPERRE) |
|
#define | otg_ack_hnp_error_interrupt() USBC_REG_CLR(USBSTA,HNPERRI) |
|
#define | Is_otg_hnp_error_interrupt() USBC_TST_BITS(USBSTA,HNPERRI) |
|
|
#define | otg_device_initiate_srp() USBC_SET_BITS(USBCON,SRPREQ) |
| Session Request Protocol. More...
|
|
#define | Is_otg_device_srp() USBC_TST_BITS(USBCON,SRPREQ) |
|
#define | otg_select_vbus_srp_method() USBC_SET_BITS(USBCON,SRPSEL) |
|
#define | Is_otg_vbus_srp_method_selected() USBC_TST_BITS(USBCON,SRPSEL) |
|
#define | otg_select_data_srp_method() USBC_CLR_BITS(USBCON,SRPSEL) |
|
#define | Is_otg_data_srp_method_selected() (!Is_otg_vbus_srp_method_selected()) |
|
#define | otg_enable_srp_interrupt() USBC_SET_BITS(USBCON,SRPE) |
|
#define | otg_disable_srp_interrupt() USBC_CLR_BITS(USBCON,SRPE) |
|
#define | Is_otg_srp_interrupt_enabled() USBC_TST_BITS(USBCON,SRPE) |
|
#define | otg_ack_srp_interrupt() USBC_REG_CLR(USBSTA,SRPI) |
|
#define | Is_otg_srp_interrupt() USBC_TST_BITS(USBSTA,SRPI) |
|
|
#define | otg_enable_role_exchange_interrupt() USBC_SET_BITS(USBCON,ROLEEXE) |
| Role exchange interrupt. More...
|
|
#define | otg_disable_role_exchange_interrupt() USBC_CLR_BITS(USBCON,ROLEEXE) |
|
#define | Is_otg_role_exchange_interrupt_enabled() USBC_TST_BITS(USBCON,ROLEEXE) |
|
#define | otg_ack_role_exchange_interrupt() USBC_REG_CLR(USBSTA,ROLEEXI) |
|
#define | otg_raise_role_exchange_interrupt() USBC_REG_SET(USBSTA,ROLEEXI) |
|
#define | Is_otg_role_exchange_interrupt() USBC_TST_BITS(USBSTA,ROLEEXI) |
|