Contiki 2.6

USB host controller drivers

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

Defines

#define Host_allocate_memory()   (UPCFG1X |= (1<<ALLOC))
 allocates the current configuration in DPRAM memory
#define Host_unallocate_memory()   (UPCFG1X &= ~(1<<ALLOC))
 un-allocates the current configuration in DPRAM memory
#define Host_enable()   (USBCON |= (1<<HOST))
 enables USB Host function
#define Host_enable_sof()   (UHCON |= (1<<SOFEN))
 enables SOF generation
#define Host_disable_sof()   (UHCON &= ~(1<<SOFEN))
 disables SOF generation
#define Host_send_reset()   (UHCON |= (1<<RESET))
 sends a USB Reset to the device
#define Host_is_reset()   ((UHCON & (1<<RESET)) ? TRUE : FALSE)
 tests if USB Reset running
#define Host_send_resume()   (UHCON |= (1<<RESUME))
 sends a USB Resume to the device
#define Host_is_resume()   ((UHCON & (1<<RESUME)) ? TRUE : FALSE)
 tests if USB Resume running
#define Host_enable_sof_interrupt()   (UHIEN |= (1<<HSOFE))
 enables host start of frame interrupt
#define Host_disable_sof_interrupt()   (UHIEN &= ~(1<<HSOFE))
 enables host start of frame interrupt
#define Host_is_sof()   ((UHINT & (1<<HSOFI)) ? TRUE : FALSE)
 tests if SOF detected
#define Host_enable_hwup_interrupt()   (UHIEN |= (1<<HWUPE))
 enables host wake up interrupt detection
#define Host_disable_hwup_interrupt()   (UHIEN &= ~(1<<HWUPE))
 disables host wake up interrupt detection
#define Host_is_hwup()   ((UHINT & (1<<HWUPI)) ? TRUE : FALSE)
 tests if host wake up detected
#define Is_host_hwup()   ((UHINT & (1<<HWUPI)) ? TRUE : FALSE)
 Ack host wake up detection.
#define Host_enable_down_stream_resume_interrupt()   (UHIEN |= (1<<RSMEDE))
 enables host down stream rsm sent interrupt detection
#define Host_disable_down_stream_resume_interrupt()   (UHIEN &= ~(1<<RSMEDE))
 disables host down stream rsm sent interrupt detection
#define Is_host_down_stream_resume()   ((UHINT & (1<<RSMEDI)) ? TRUE : FALSE)
 Ack host down stream resume sent.
#define Host_enable_remote_wakeup_interrupt()   (UHIEN |= (1<<RXRSME))
 enables host remote wake up interrupt detection
#define Host_disable_remote_wakeup_interrupt()   (UHIEN &= ~(1<<RXRSME))
 disables host remote wake up interrupt detection
#define Host_is_remote_wakeup()   ((UHINT & (1<<RXRSMI)) ? TRUE : FALSE)
 tests if host wake up detected
#define Is_host_remote_wakeup()   ((UHINT & (1<<RXRSMI)) ? TRUE : FALSE)
 Ack host wake up detection.
#define Host_enable_device_connection_interrupt()   (UHIEN |= (1<<DCONNE))
 enables host device connection interrupt
#define Host_disable_device_connection_interrupt()   (UHIEN &= ~(1<<DCONNE))
 disables USB device connection interrupt
#define Is_device_connection()   (UHINT & (1<<DCONNI))
 tests if a USB device has been detected
#define Host_ack_device_connection()   (UHINT = ~(1<<DCONNI))
 acks device connection
#define Host_enable_device_disconnection_interrupt()   (UHIEN |= (1<<DDISCE))
 enables host device disconnection interrupt
#define Host_disable_device_disconnection_interrupt()   (UHIEN &= ~(1<<DDISCE))
 disables USB device connection interrupt
#define Is_device_disconnection()   (UHINT & (1<<DDISCI) ? TRUE : FALSE)
 tests if a USB device has been removed
#define Host_ack_device_disconnection()   (UHINT = ~(1<<DDISCI))
 acks device disconnection
#define Host_enable_reset_interrupt()   (UHIEN |= (1<<RSTE))
 enables host USB reset interrupt
#define Host_disable_reset_interrupt()   (UHIEN &= ~(1<<RSTE))
 disables host USB reset interrupt
#define Host_ack_reset()   (UHINT = ~(1<<RSTI))
 acks host USB reset sent
#define Is_host_reset()   Host_is_reset()
 tests if USB reset has been sent
#define Host_vbus_request()   (OTGCON |= (1<<VBUSREQ))
 switches on VBus
#define Host_clear_vbus_request()   (OTGCON |= (1<<VBUSRQC))
 switches off VBus
#define Host_configure_address(addr)   (UHADDR = addr & MSK_HADDR)
 configures the address to use for the device
#define Is_host_full_speed()   ((USBSTA & (1<<SPEED)) ? TRUE : FALSE)
 Get connected device speed, returns TRUE when in full speed mode.

Detailed Description

These macros manage the USB Host controller.