Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
USBB common management drivers

These macros manage the USBB controller.

Macros

#define Is_usb_bconnection_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_BCERRI_MASK))
 tests if a B-device connection error occurs More...
 
#define Is_usb_bconnection_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 
#define Is_usb_clock_frozen()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 
#define Is_usb_data_srp_method_selected()   (!Is_usb_vbus_srp_method_selected())
 
#define Is_usb_device_mode_forced()   (!Is_usb_id_pin_enabled() && Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))
 Test if device mode is forced. More...
 
#define Is_usb_device_srp()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))
 tests if a SRP from device occurs More...
 
#define Is_usb_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 
#define Is_usb_full_speed_mode()   (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_FULL)
 Test if controller is in full speed mode. More...
 
#define Is_usb_full_speed_mode_used()   (!Is_usb_low_speed_mode_forced())
 Test if device full speed mode is used. More...
 
#define Is_usb_hnp()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 tests if a HNP occurs More...
 
#define Is_usb_hnp_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_HNPERRI_MASK))
 tests if a HNP error occurs More...
 
#define Is_usb_hnp_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 
#define Is_usb_host_mode_forced()   (!Is_usb_id_pin_enabled() && !Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))
 Test if host mode is forced. More...
 
#define Is_usb_id_device()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ID_MASK))
 
#define Is_usb_id_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Is_usb_id_pin_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Test if external USB_ID pin enabled (listened to by USB) More...
 
#define Is_usb_id_pin_input()
 Test if USB_ID is input from its pin. More...
 
#define Is_usb_id_transition()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_IDTI_MASK))
 
#define Is_usb_low_speed_mode()   (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_LOW)
 Test if controller is in low-speed mode. More...
 
#define Is_usb_low_speed_mode_forced()   (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Test if device low-speed mode is forced. More...
 
#define Is_usb_otg_pad_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 
#define Is_usb_role_exchange_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ROLEEXI_MASK))
 tests if a role exchange occurs More...
 
#define Is_usb_role_exchange_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 
#define Is_usb_srp_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SRPI_MASK))
 tests if a SRP occurs More...
 
#define Is_usb_srp_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 
#define Is_usb_suspend_time_out_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_STOI_MASK))
 tests if a suspend time out occurs More...
 
#define Is_usb_suspend_time_out_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 
#define Is_usb_vbof_active_high()   (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 Get USB_VBOF output pin polarity. More...
 
#define Is_usb_vbof_active_low()   (!Is_usb_vbof_active_high())
 
#define Is_usb_vbof_pin_output()
 Test if USB_VBOF is output onto its pin. More...
 
#define Is_usb_vbus_enabled()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSRQ_MASK))
 tests if VBus activation has been requested More...
 
#define Is_usb_vbus_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBERRI_MASK))
 tests if a VBus error occurs More...
 
#define Is_usb_vbus_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 
#define Is_usb_vbus_high()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUS_MASK))
 
#define Is_usb_vbus_hw_control_enabled()   (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 
#define Is_usb_vbus_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Is_usb_vbus_low()   (!Is_usb_vbus_high())
 
#define Is_usb_vbus_srp_method_selected()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 
#define Is_usb_vbus_transition()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSTI_MASK))
 
#define Usb_ack_bconnection_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_BCERRIC_MASK)
 acks B-device connection error interrupt More...
 
#define Usb_ack_hnp_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_HNPERRIC_MASK)
 acks HNP error interrupt More...
 
#define Usb_ack_id_transition()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_IDTIC_MASK)
 
#define Usb_ack_role_exchange_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_ROLEEXIC_MASK)
 acks role exchange interrupt More...
 
#define Usb_ack_srp_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_SRPIC_MASK)
 acks SRP interrupt More...
 
#define Usb_ack_suspend_time_out_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_STOIC_MASK)
 acks suspend time out interrupt More...
 
#define Usb_ack_vbus_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBERRIC_MASK)
 acks VBus error interrupt More...
 
#define Usb_ack_vbus_transition()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSTIC_MASK)
 
#define Usb_configure_timeout(timer, timeout)
 Configure time-out of specified OTG timer. More...
 
#define Usb_device_initiate_hnp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 initiates a Host negotiation Protocol More...
 
#define Usb_device_initiate_srp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))
 initiates a Session Request Protocol More...
 
#define Usb_disable()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 Disable USB macro. More...
 
#define Usb_disable_bconnection_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 disables B-device connection error interrupt More...
 
#define Usb_disable_hnp_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 disables HNP error interrupt More...
 
#define Usb_disable_id_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Usb_disable_id_pin()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Disable external USB_ID pin (ignored by USB) More...
 
#define Usb_disable_otg_pad()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 Disable OTG pad. More...
 
#define Usb_disable_role_exchange_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 disables role exchange interrupt More...
 
#define Usb_disable_srp_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 disables SRP interrupt More...
 
#define Usb_disable_suspend_time_out_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 disables suspend time out interrupt More...
 
#define Usb_disable_vbus()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSRQC_MASK)
 requests VBus deactivation More...
 
#define Usb_disable_vbus_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 disables VBus error interrupt More...
 
#define Usb_disable_vbus_hw_control()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 disables hardware control over the USB_VBOF output pin More...
 
#define Usb_disable_vbus_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Usb_enable()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 Enable USB macro. More...
 
#define Usb_enable_bconnection_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 enables B-device connection error interrupt More...
 
#define Usb_enable_hnp_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 enables HNP error interrupt More...
 
#define Usb_enable_id_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Usb_enable_id_pin()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Enable external USB_ID pin (listened to by USB) More...
 
#define Usb_enable_otg_pad()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 Enable OTG pad. More...
 
#define Usb_enable_role_exchange_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 enables role exchange interrupt More...
 
#define Usb_enable_srp_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 enables SRP interrupt More...
 
#define Usb_enable_suspend_time_out_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 enables suspend time out interrupt More...
 
#define Usb_enable_vbus()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSRQS_MASK)
 requests VBus activation More...
 
#define Usb_enable_vbus_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 enables VBus error interrupt More...
 
#define Usb_enable_vbus_hw_control()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 enables hardware control over the USB_VBOF output pin More...
 
#define Usb_enable_vbus_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Usb_force_device_mode()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())
 Disable external USB_ID pin and force device mode. More...
 
#define Usb_force_full_speed_mode()   do { } while (0)
 
#define Usb_force_host_mode()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())
 Disable external USB_ID pin and force host mode. More...
 
#define Usb_force_low_speed_mode()   (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Force device low-speed mode. More...
 
#define Usb_freeze_clock()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 Stop (freeze) internal USB clock. More...
 
#define Usb_get_fsm_drd_state()   (Rd_bitfield(AVR32_USBB_usbfsm, AVR32_USBB_USBFSM_DRDSTATE_MASK))
 Get the dual-role device state of the internal USB finite state machine of the USBB controller. More...
 
#define Usb_get_timeout(timer)
 Get configured time-out of specified OTG timer. More...
 
#define Usb_host_accept_hnp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 accepts a Host negotiation Protocol More...
 
#define Usb_host_reject_hnp()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 rejects a Host negotiation Protocol More...
 
#define USB_ID_FUNCTION   ATPASTE2(USB_ID, _FUNCTION)
 
#define USB_ID_PIN   ATPASTE2(USB_ID, _PIN)
 Check that multiplexed pin used for USB_ID is defined. More...
 
#define Usb_input_id_pin()
 Input USB_ID from its pin. More...
 
#define Usb_output_vbof_pin()
 Output USB_VBOF onto its pin. More...
 
#define Usb_raise_bconnection_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_BCERRIS_MASK)
 raises B-device connection error interrupt More...
 
#define Usb_raise_hnp_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_HNPERRIS_MASK)
 raises HNP error interrupt More...
 
#define Usb_raise_id_transition()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_IDTIS_MASK)
 
#define Usb_raise_role_exchange_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_ROLEEXIS_MASK)
 raises role exchange interrupt More...
 
#define Usb_raise_srp_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_SRPIS_MASK)
 raises SRP interrupt More...
 
#define Usb_raise_suspend_time_out_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_STOIS_MASK)
 raises suspend time out interrupt More...
 
#define Usb_raise_vbus_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBERRIS_MASK)
 raises VBus error interrupt More...
 
#define Usb_raise_vbus_transition()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSTIS_MASK)
 
#define Usb_select_data_srp_method()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 selects data line as SRP method More...
 
#define Usb_select_vbus_srp_method()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 selects VBus as SRP method More...
 
#define Usb_set_vbof_active_high()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 Set USB_VBOF output pin polarity. More...
 
#define Usb_set_vbof_active_low()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 
#define Usb_unfreeze_clock()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 
#define Usb_use_dual_speed_mode()   do { } while (0)
 
#define Usb_use_full_speed_mode()   (Clr_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Use device full speed mode (default) More...
 
#define USB_VBOF_FUNCTION   ATPASTE2(USB_VBOF, _FUNCTION)
 
#define USB_VBOF_PIN   ATPASTE2(USB_VBOF, _PIN)
 Check that multiplexed pin used for USB_VBOF is defined. More...
 

#define Is_usb_bconnection_error_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_BCERRI_MASK))

tests if a B-device connection error occurs

Referenced by usb_host_task().

#define Is_usb_bconnection_error_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
#define Is_usb_data_srp_method_selected ( )    (!Is_usb_vbus_srp_method_selected())
#define Is_usb_device_mode_forced ( )    (!Is_usb_id_pin_enabled() && Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))

Test if device mode is forced.

#define Is_usb_device_srp ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))

tests if a SRP from device occurs

#define Is_usb_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
#define Is_usb_full_speed_mode ( )    (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_FULL)
#define Is_usb_full_speed_mode_used ( )    (!Is_usb_low_speed_mode_forced())

Test if device full speed mode is used.

#define Is_usb_hnp ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))

tests if a HNP occurs

#define Is_usb_hnp_error_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_HNPERRI_MASK))

tests if a HNP error occurs

#define Is_usb_hnp_error_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
#define Is_usb_host_mode_forced ( )    (!Is_usb_id_pin_enabled() && !Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))

Test if host mode is forced.

#define Is_usb_id_device ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ID_MASK))
#define Is_usb_id_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))

Referenced by usb_general_interrupt().

#define Is_usb_id_pin_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))

Test if external USB_ID pin enabled (listened to by USB)

#define Is_usb_id_pin_input ( )
Value:
(!Tst_bits(AVR32_GPIO.port[USB_ID_PIN >> 5].gper, 1 << (USB_ID_PIN & 0x1F)) &&\
Tst_bits(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr0, 1 << (USB_ID_PIN & 0x1F)) == Tst_bits(USB_ID_FUNCTION, 0x01) &&\
Tst_bits(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr1, 1 << (USB_ID_PIN & 0x1F)) == Tst_bits(USB_ID_FUNCTION, 0x02))
#define Tst_bits(value, mask)
Tests the bits of a value specified by a given bit-mask.
Definition: compiler.h:478
#define USB_ID_PIN
Check that multiplexed pin used for USB_ID is defined.
Definition: usb_drv.h:225
#define USB_ID_FUNCTION
Definition: usb_drv.h:226

Test if USB_ID is input from its pin.

#define Is_usb_id_transition ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_IDTI_MASK))

Referenced by usb_general_interrupt().

#define Is_usb_low_speed_mode ( )    (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_LOW)

Test if controller is in low-speed mode.

Referenced by host_get_data(), and host_transfer_control().

#define Is_usb_low_speed_mode_forced ( )    (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))

Test if device low-speed mode is forced.

#define Is_usb_otg_pad_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
#define Is_usb_role_exchange_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ROLEEXI_MASK))

tests if a role exchange occurs

#define Is_usb_role_exchange_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
#define Is_usb_srp_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SRPI_MASK))

tests if a SRP occurs

#define Is_usb_srp_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
#define Is_usb_suspend_time_out_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_STOI_MASK))

tests if a suspend time out occurs

#define Is_usb_suspend_time_out_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
#define Is_usb_vbof_active_high ( )    (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))

Get USB_VBOF output pin polarity.

#define Is_usb_vbof_active_low ( )    (!Is_usb_vbof_active_high())
#define Is_usb_vbof_pin_output ( )
Value:
(!Tst_bits(AVR32_GPIO.port[USB_VBOF_PIN >> 5].gper, 1 << (USB_VBOF_PIN & 0x1F)) &&\
Tst_bits(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr0, 1 << (USB_VBOF_PIN & 0x1F)) == Tst_bits(USB_VBOF_FUNCTION, 0x01) &&\
Tst_bits(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr1, 1 << (USB_VBOF_PIN & 0x1F)) == Tst_bits(USB_VBOF_FUNCTION, 0x02))
#define USB_VBOF_PIN
Check that multiplexed pin used for USB_VBOF is defined.
Definition: usb_drv.h:266
#define USB_VBOF_FUNCTION
Definition: usb_drv.h:267
#define Tst_bits(value, mask)
Tests the bits of a value specified by a given bit-mask.
Definition: compiler.h:478

Test if USB_VBOF is output onto its pin.

#define Is_usb_vbus_enabled ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSRQ_MASK))

tests if VBus activation has been requested

#define Is_usb_vbus_error_interrupt ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBERRI_MASK))

tests if a VBus error occurs

Referenced by usb_host_task().

#define Is_usb_vbus_error_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
#define Is_usb_vbus_high ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUS_MASK))
#define Is_usb_vbus_hw_control_enabled ( )    (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
#define Is_usb_vbus_interrupt_enabled ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))

Referenced by usb_general_interrupt().

#define Is_usb_vbus_low ( )    (!Is_usb_vbus_high())

Referenced by usb_host_task().

#define Is_usb_vbus_srp_method_selected ( )    (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
#define Is_usb_vbus_transition ( )    (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSTI_MASK))

Referenced by usb_general_interrupt().

#define Usb_ack_bconnection_error_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_BCERRIC_MASK)

acks B-device connection error interrupt

Referenced by usb_host_task().

#define Usb_ack_hnp_error_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_HNPERRIC_MASK)

acks HNP error interrupt

#define Usb_ack_id_transition ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_IDTIC_MASK)

Referenced by if(), and usb_general_interrupt().

#define Usb_ack_role_exchange_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_ROLEEXIC_MASK)

acks role exchange interrupt

#define Usb_ack_srp_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_SRPIC_MASK)

acks SRP interrupt

#define Usb_ack_suspend_time_out_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_STOIC_MASK)

acks suspend time out interrupt

#define Usb_ack_vbus_error_interrupt ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBERRIC_MASK)

acks VBus error interrupt

Referenced by usb_host_task().

#define Usb_ack_vbus_transition ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSTIC_MASK)

Referenced by usb_general_interrupt().

#define Usb_configure_timeout (   timer,
  timeout 
)
Value:
(Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UNLOCK_MASK),\
Wr_bitfield(AVR32_USBB_usbcon, AVR32_USBB_USBCON_TIMPAGE_MASK, timer),\
Wr_bitfield(AVR32_USBB_usbcon, AVR32_USBB_USBCON_TIMVALUE_MASK, timeout),\
Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UNLOCK_MASK))
#define Clr_bits(lvalue, mask)
Clears the bits of a C lvalue specified by a given bit-mask.
Definition: compiler.h:487
#define AVR32_USBB_usbcon
Access points to the USBB memory map with arrayed registers.
Definition: usbb.h:948
t_cpu_time timer
Definition: host_audio_task.c:99
#define Set_bits(lvalue, mask)
Sets the bits of a C lvalue specified by a given bit-mask.
Definition: compiler.h:496
#define Wr_bitfield(lvalue, mask, bitfield)
Writes the bit-field of a C lvalue specified by a given bit-mask.
Definition: compiler.h:524

Configure time-out of specified OTG timer.

#define Usb_device_initiate_hnp ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))

initiates a Host negotiation Protocol

#define Usb_device_initiate_srp ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))

initiates a Session Request Protocol

#define Usb_disable ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
#define Usb_disable_bconnection_error_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))

disables B-device connection error interrupt

#define Usb_disable_hnp_error_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))

disables HNP error interrupt

#define Usb_disable_id_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
#define Usb_disable_id_pin ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))

Disable external USB_ID pin (ignored by USB)

#define Usb_disable_otg_pad ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
#define Usb_disable_role_exchange_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))

disables role exchange interrupt

#define Usb_disable_srp_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))

disables SRP interrupt

#define Usb_disable_suspend_time_out_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))

disables suspend time out interrupt

#define Usb_disable_vbus ( )    (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSRQC_MASK)

requests VBus deactivation

Referenced by usb_host_task().

#define Usb_disable_vbus_error_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))

disables VBus error interrupt

#define Usb_disable_vbus_hw_control ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))

disables hardware control over the USB_VBOF output pin

Referenced by usb_host_task_init().

#define Usb_disable_vbus_interrupt ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
#define Usb_enable ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))

Enable USB macro.

Referenced by usb_device_task_init(), and usb_host_task_init().

#define Usb_enable_bconnection_error_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))

enables B-device connection error interrupt

#define Usb_enable_hnp_error_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))

enables HNP error interrupt

#define Usb_enable_id_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))

Referenced by usb_task().

#define Usb_enable_id_pin ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))

Enable external USB_ID pin (listened to by USB)

#define Usb_enable_otg_pad ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))

Enable OTG pad.

Referenced by usb_device_task_init(), and usb_host_task_init().

#define Usb_enable_role_exchange_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))

enables role exchange interrupt

#define Usb_enable_srp_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))

enables SRP interrupt

#define Usb_enable_suspend_time_out_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))

enables suspend time out interrupt

#define Usb_enable_vbus ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSRQS_MASK)

requests VBus activation

Referenced by usb_host_task().

#define Usb_enable_vbus_error_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))

enables VBus error interrupt

#define Usb_enable_vbus_hw_control ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))

enables hardware control over the USB_VBOF output pin

#define Usb_enable_vbus_interrupt ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))

Referenced by usb_device_task_init().

#define Usb_force_device_mode ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())

Disable external USB_ID pin and force device mode.

#define Usb_force_full_speed_mode ( )    do { } while (0)

Referenced by usb_start_device().

#define Usb_force_host_mode ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())

Disable external USB_ID pin and force host mode.

#define Usb_force_low_speed_mode ( )    (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))

Force device low-speed mode.

#define Usb_freeze_clock ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))

Stop (freeze) internal USB clock.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Usb_get_fsm_drd_state ( )    (Rd_bitfield(AVR32_USBB_usbfsm, AVR32_USBB_USBFSM_DRDSTATE_MASK))

Get the dual-role device state of the internal USB finite state machine of the USBB controller.

#define Usb_get_timeout (   timer)
Value:
(Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UNLOCK_MASK),\
Wr_bitfield(AVR32_USBB_usbcon, AVR32_USBB_USBCON_TIMPAGE_MASK, timer),\
Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UNLOCK_MASK),\
Rd_bitfield(AVR32_USBB_usbcon, AVR32_USBB_USBCON_TIMVALUE_MASK))
#define Clr_bits(lvalue, mask)
Clears the bits of a C lvalue specified by a given bit-mask.
Definition: compiler.h:487
#define Rd_bitfield(value, mask)
Reads the bit-field of a value specified by a given bit-mask.
Definition: compiler.h:514
#define AVR32_USBB_usbcon
Access points to the USBB memory map with arrayed registers.
Definition: usbb.h:948
t_cpu_time timer
Definition: host_audio_task.c:99
#define Set_bits(lvalue, mask)
Sets the bits of a C lvalue specified by a given bit-mask.
Definition: compiler.h:496
#define Wr_bitfield(lvalue, mask, bitfield)
Writes the bit-field of a C lvalue specified by a given bit-mask.
Definition: compiler.h:524

Get configured time-out of specified OTG timer.

#define Usb_host_accept_hnp ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))

accepts a Host negotiation Protocol

#define Usb_host_reject_hnp ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))

rejects a Host negotiation Protocol

#define USB_ID_FUNCTION   ATPASTE2(USB_ID, _FUNCTION)
#define USB_ID_PIN   ATPASTE2(USB_ID, _PIN)

Check that multiplexed pin used for USB_ID is defined.

Pin and function for USB_ID according to configuration from USB_ID

#define Usb_input_id_pin ( )
Value:
{\
(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr0s = 1 << (USB_ID_PIN & 0x1F)) :\
(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr0c = 1 << (USB_ID_PIN & 0x1F)); \
(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr1s = 1 << (USB_ID_PIN & 0x1F)) :\
(AVR32_GPIO.port[USB_ID_PIN >> 5].pmr1c = 1 << (USB_ID_PIN & 0x1F)); \
AVR32_GPIO.port[USB_ID_PIN >> 5].gperc = 1 << (USB_ID_PIN & 0x1F);\
AVR32_GPIO.port[USB_ID_PIN >> 5].puers = 1 << (USB_ID_PIN & 0x1F);\
}
#define Tst_bits(value, mask)
Tests the bits of a value specified by a given bit-mask.
Definition: compiler.h:478
#define USB_ID_PIN
Check that multiplexed pin used for USB_ID is defined.
Definition: usb_drv.h:225
#define USB_ID_FUNCTION
Definition: usb_drv.h:226

Input USB_ID from its pin.

#define Usb_output_vbof_pin ( )
Value:
{\
(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr0s = 1 << (USB_VBOF_PIN & 0x1F)) :\
(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr0c = 1 << (USB_VBOF_PIN & 0x1F)); \
(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr1s = 1 << (USB_VBOF_PIN & 0x1F)) :\
(AVR32_GPIO.port[USB_VBOF_PIN >> 5].pmr1c = 1 << (USB_VBOF_PIN & 0x1F)); \
AVR32_GPIO.port[USB_VBOF_PIN >> 5].gperc = 1 << (USB_VBOF_PIN & 0x1F);\
AVR32_GPIO.port[USB_VBOF_PIN >> 5].odmerc = 1 << (USB_VBOF_PIN & 0x1F);\
AVR32_GPIO.port[USB_VBOF_PIN >> 5].puerc = 1 << (USB_VBOF_PIN & 0x1F);\
}
#define USB_VBOF_PIN
Check that multiplexed pin used for USB_VBOF is defined.
Definition: usb_drv.h:266
#define USB_VBOF_FUNCTION
Definition: usb_drv.h:267
#define Tst_bits(value, mask)
Tests the bits of a value specified by a given bit-mask.
Definition: compiler.h:478

Output USB_VBOF onto its pin.

Referenced by usb_host_task_init().

#define Usb_raise_bconnection_error_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_BCERRIS_MASK)

raises B-device connection error interrupt

#define Usb_raise_hnp_error_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_HNPERRIS_MASK)

raises HNP error interrupt

#define Usb_raise_id_transition ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_IDTIS_MASK)
#define Usb_raise_role_exchange_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_ROLEEXIS_MASK)

raises role exchange interrupt

#define Usb_raise_srp_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_SRPIS_MASK)

raises SRP interrupt

#define Usb_raise_suspend_time_out_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_STOIS_MASK)

raises suspend time out interrupt

#define Usb_raise_vbus_error_interrupt ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBERRIS_MASK)

raises VBus error interrupt

#define Usb_raise_vbus_transition ( )    (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSTIS_MASK)
#define Usb_select_data_srp_method ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))

selects data line as SRP method

#define Usb_select_vbus_srp_method ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))

selects VBus as SRP method

#define Usb_set_vbof_active_high ( )    (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))

Set USB_VBOF output pin polarity.

Referenced by usb_host_task_init().

#define Usb_set_vbof_active_low ( )    (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))

Referenced by usb_host_task_init().

#define Usb_use_dual_speed_mode ( )    do { } while (0)

Referenced by usb_start_device().

#define Usb_use_full_speed_mode ( )    (Clr_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))

Use device full speed mode (default)

#define USB_VBOF_FUNCTION   ATPASTE2(USB_VBOF, _FUNCTION)
#define USB_VBOF_PIN   ATPASTE2(USB_VBOF, _PIN)

Check that multiplexed pin used for USB_VBOF is defined.

Pin and function for USB_VBOF according to configuration from USB_VBOF