Contiki 2.6
|
These macros manage the USB controller. More...
Defines | |
#define | Usb_enable_uid_pin() (UHWCON |= (1<<UIDE)) |
Enable external UID pin. | |
#define | Usb_disable_uid_pin() (UHWCON &= ~(1<<UIDE)) |
Disable external UID pin. | |
#define | Usb_force_device_mode() (Usb_disable_uid_pin(), UHWCON |= (1<<UIMOD)) |
Disable external UID pin and force device mode. | |
#define | Usb_force_host_mode() (Usb_disable_uid_pin(), UHWCON &= ~(1<<UIMOD)) |
Disable external UID pin and force host mode. | |
#define | Usb_enable_uvcon_pin() (UHWCON |= (1<<UVCONE)) |
Enable external UVCON pin. | |
#define | Usb_disable_uvcon_pin() (UHWCON &= ~(1<<UVCONE)) |
Enable external UVCON pin. | |
#define | Usb_full_speed_mode() (UDCON &= ~(1<<LSM)) |
Use device full speed mode (default mode) | |
#define | Usb_low_speed_mode() (UDCON |= (1<<LSM)) |
For device mode, force low speed mode. | |
#define | Usb_enable() (USBCON |= ((1<<USBE) | (1<<OTGPADE))) |
Enable both USB interface and Vbus pad. | |
#define | Usb_disable() (USBCON &= ~((1<<USBE) | (1<<OTGPADE))) |
Disable both USB interface and Vbus pad. | |
#define | Usb_enable_vbus_pad() (USBCON |= (1<<OTGPADE)) |
Enable VBUS pad. | |
#define | Usb_disable_vbus_pad() (USBCON &= ~(1<<OTGPADE)) |
Disable VBUS pad. | |
#define | Usb_freeze_clock() (USBCON |= (1<<FRZCLK)) |
Stop internal USB clock in interface (freeze the interface register) | |
#define | Usb_get_general_interrupt() (USBINT & (USBCON & MSK_IDTE_VBUSTE)) |
returns the USB general interrupts (interrupt enabled) | |
#define | Usb_ack_all_general_interrupt() (USBINT = ~(USBCON & MSK_IDTE_VBUSTE)) |
acks the general interrupts (interrupt enabled) | |
#define | Usb_get_otg_interrupt() (OTGINT & OTGIEN) |
returns the USB Pad interrupts (interrupt enabled) | |
#define | Usb_ack_all_otg_interrupt() (OTGINT = ~OTGIEN) |
acks the USB Pad interrupts (interrupt enabled) | |
#define | Usb_enable_vbus() (OTGCON |= (1<<VBUSREQ)) |
requests for VBus activation | |
#define | Usb_disable_vbus() (OTGCON |= (1<<VBUSRQC)) |
requests for VBus desactivation | |
#define | Usb_enable_manual_vbus() (PORTE|=0x80,DDRE|=0x80,Usb_disable_uvcon_pin()) |
Manually request VBUS without UVCON signal from USB interface. | |
#define | Usb_device_initiate_hnp() (OTGCON |= (1<<HNPREQ)) |
initiates a Host Negociation Protocol | |
#define | Usb_host_accept_hnp() (OTGCON |= (1<<HNPREQ)) |
accepts a Host Negociation Protocol | |
#define | Usb_host_reject_hnp() (OTGCON &= ~(1<<HNPREQ)) |
rejects a Host Negociation Protocol | |
#define | Usb_device_initiate_srp() (OTGCON |= (1<<SRPREQ)) |
initiates a Session Request Protocol | |
#define | Usb_select_vbus_srp_method() (OTGCON |= (1<<SRPSEL)) |
selects VBus as SRP method | |
#define | Usb_select_data_srp_method() (OTGCON &= ~(1<<SRPSEL)) |
selects data line as SRP method | |
#define | Usb_enable_vbus_hw_control() (OTGCON &= ~(1<<VBUSHWC)) |
enables hardware control on VBus | |
#define | Usb_disable_vbus_hw_control() (OTGCON |= (1<<VBUSHWC)) |
disables hardware control on VBus | |
#define | Is_usb_vbus_enabled() ((OTGCON & (1<<VBUSREQ)) ? TRUE : FALSE) |
tests if VBus has been requested | |
#define | Is_usb_hnp() ((OTGCON & (1<<HNPREQ)) ? TRUE : FALSE) |
tests if a HNP occurs | |
#define | Is_usb_device_srp() ((OTGCON & (1<<SRPREQ)) ? TRUE : FALSE) |
tests if a SRP from device occurs | |
#define | Usb_enable_suspend_time_out_interrupt() (OTGIEN |= (1<<STOE)) |
enables suspend time out interrupt | |
#define | Usb_disable_suspend_time_out_interrupt() (OTGIEN &= ~(1<<STOE)) |
disables suspend time out interrupt | |
#define | Usb_ack_suspend_time_out_interrupt() (OTGINT &= ~(1<<STOI)) |
acks suspend time out interrupt | |
#define | Is_usb_suspend_time_out_interrupt() ((OTGINT & (1<<STOI)) ? TRUE : FALSE) |
tests if a suspend time out occurs | |
#define | Usb_enable_hnp_error_interrupt() (OTGIEN |= (1<<HNPERRE)) |
enables HNP error interrupt | |
#define | Usb_disable_hnp_error_interrupt() (OTGIEN &= ~(1<<HNPERRE)) |
disables HNP error interrupt | |
#define | Usb_ack_hnp_error_interrupt() (OTGINT &= ~(1<<HNPERRI)) |
acks HNP error interrupt | |
#define | Is_usb_hnp_error_interrupt() ((OTGINT & (1<<HNPERRI)) ? TRUE : FALSE) |
tests if a HNP error occurs | |
#define | Usb_enable_role_exchange_interrupt() (OTGIEN |= (1<<ROLEEXE)) |
enables role exchange interrupt | |
#define | Usb_disable_role_exchange_interrupt() (OTGIEN &= ~(1<<ROLEEXE)) |
disables role exchange interrupt | |
#define | Usb_ack_role_exchange_interrupt() (OTGINT &= ~(1<<ROLEEXI)) |
acks role exchange interrupt | |
#define | Is_usb_role_exchange_interrupt() ((OTGINT & (1<<ROLEEXI)) ? TRUE : FALSE) |
tests if a role exchange occurs | |
#define | Usb_enable_bconnection_error_interrupt() (OTGIEN |= (1<<BCERRE)) |
enables B device connection error interrupt | |
#define | Usb_disable_bconnection_error_interrupt() (OTGIEN &= ~(1<<BCERRE)) |
disables B device connection error interrupt | |
#define | Usb_ack_bconnection_error_interrupt() (OTGINT &= ~(1<<BCERRI)) |
acks B device connection error interrupt | |
#define | Is_usb_bconnection_error_interrupt() ((OTGINT & (1<<BCERRI)) ? TRUE : FALSE) |
tests if a B device connection error occurs | |
#define | Usb_enable_vbus_error_interrupt() (OTGIEN |= (1<<VBERRE)) |
enables VBus error interrupt | |
#define | Usb_disable_vbus_error_interrupt() (OTGIEN &= ~(1<<VBERRE)) |
disables VBus error interrupt | |
#define | Usb_ack_vbus_error_interrupt() (OTGINT &= ~(1<<VBERRI)) |
acks VBus error interrupt | |
#define | Is_usb_vbus_error_interrupt() ((OTGINT & (1<<VBERRI)) ? TRUE : FALSE) |
tests if a VBus error occurs | |
#define | Usb_enable_srp_interrupt() (OTGIEN |= (1<<SRPE)) |
enables SRP interrupt | |
#define | Usb_disable_srp_interrupt() (OTGIEN &= ~(1<<SRPE)) |
disables SRP interrupt | |
#define | Usb_ack_srp_interrupt() (OTGINT &= ~(1<<SRPI)) |
acks SRP interrupt | |
#define | Is_usb_srp_interrupt() ((OTGINT & (1<<SRPI)) ? TRUE : FALSE) |
tests if a SRP occurs |
These macros manage the USB controller.