Contiki 2.6

USB device controller drivers

These macros manage the USB Device controller. More...

Defines

#define Usb_initiate_remote_wake_up()   (UDCON |= (1<<RMWKUP))
 initiates a remote wake-up
#define Usb_detach()   (UDCON |= (1<<DETACH))
 detaches from USB bus
#define Usb_attach()   (UDCON &= ~(1<<DETACH))
 attaches to USB bus
#define Is_usb_pending_remote_wake_up()   ((UDCON & (1<<RMWKUP)) ? TRUE : FALSE)
 test if remote wake-up still running
#define Is_usb_detached()   ((UDCON & (1<<DETACH)) ? TRUE : FALSE)
 test if the device is detached
#define Usb_get_device_interrupt()   (UDINT & (1<<UDIEN))
 returns the USB device interrupts (interrupt enabled)
#define Usb_ack_all_device_interrupt()   (UDINT = ~(1<<UDIEN))
 acks the USB device interrupts (interrupt enabled)
#define Usb_enable_remote_wake_up_interrupt()   (UDIEN |= (1<<UPRSME))
 enables remote wake-up interrupt
#define Usb_disable_remote_wake_up_interrupt()   (UDIEN &= ~(1<<UPRSME))
 disables remote wake-up interrupt
#define Usb_ack_remote_wake_up_start()   (UDINT = ~(1<<UPRSMI))
 acks remote wake-up
#define Is_usb_remote_wake_up_start()   ((UDINT & (1<<UPRSMI)) ? TRUE : FALSE)
 tests if remote wake-up still running
#define Usb_enable_resume_interrupt()   (UDIEN |= (1<<EORSME))
 enables resume interrupt
#define Usb_disable_resume_interrupt()   (UDIEN &= ~(1<<EORSME))
 disables resume interrupt
#define Usb_ack_resume()   (UDINT = ~(1<<EORSMI))
 acks resume
#define Is_usb_resume()   ((UDINT & (1<<EORSMI)) ? TRUE : FALSE)
 tests if resume occurs
#define Usb_enable_wake_up_interrupt()   (UDIEN |= (1<<WAKEUPE))
 enables wake-up interrupt
#define Usb_disable_wake_up_interrupt()   (UDIEN &= ~(1<<WAKEUPE))
 disables wake-up interrupt
#define Usb_ack_wake_up()   (UDINT = ~(1<<WAKEUPI))
 acks wake-up
#define Is_usb_wake_up()   ((UDINT & (1<<WAKEUPI)) ? TRUE : FALSE)
 tests if wake-up occurs
#define Usb_enable_reset_interrupt()   (UDIEN |= (1<<EORSTE))
 enables USB reset interrupt
#define Usb_disable_reset_interrupt()   (UDIEN &= ~(1<<EORSTE))
 disables USB reset interrupt
#define Usb_ack_reset()   (UDINT = ~(1<<EORSTI))
 acks USB reset
#define Is_usb_reset()   ((UDINT & (1<<EORSTI)) ? TRUE : FALSE)
 tests if USB reset occurs
#define Usb_enable_sof_interrupt()   (UDIEN |= (1<<SOFE))
 enables Start Of Frame Interrupt
#define Usb_disable_sof_interrupt()   (UDIEN &= ~(1<<SOFE))
 disables Start Of Frame Interrupt
#define Usb_ack_sof()   (UDINT = ~(1<<SOFI))
 acks Start Of Frame
#define Is_usb_sof()   ((UDINT & (1<<SOFI)) ? TRUE : FALSE)
 tests if Start Of Frame occurs
#define Usb_enable_suspend_interrupt()   (UDIEN |= (1<<SUSPE))
 enables suspend state interrupt
#define Usb_disable_suspend_interrupt()   (UDIEN &= ~(1<<SUSPE))
 disables suspend state interrupt
#define Usb_ack_suspend()   (UDINT = ~(1<<SUSPI))
 acks Suspend
#define Is_usb_suspend()   ((UDINT & (1<<SUSPI)) ? TRUE : FALSE)
 tests if Suspend state detected
#define Usb_enable_address()   (UDADDR |= (1<<ADDEN))
 enables USB device address
#define Usb_disable_address()   (UDADDR &= ~(1<<ADDEN))
 disables USB device address
#define Usb_configure_address(addr)   (UDADDR = (UDADDR & (1<<ADDEN)) | ((U8)addr & MSK_UADD))
 sets the USB device address
#define Usb_frame_number()   ((U16)((((U16)UDFNUMH) << 8) | ((U16)UDFNUML)))
 returns the last frame number
#define Is_usb_frame_number_crc_error()   ((UDMFN & (1<<FNCERR)) ? TRUE : FALSE)
 tests if a crc error occurs in frame number

Detailed Description

These macros manage the USB Device controller.