ATMEL: USB host controller drivers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# USB host controller drivers
[USB low level 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 | Is_host_pipe_memory_allocated() (UPCFG1X & (1<<ALLOC) ? TRUE : FALSE)
| Check if pipe memory is allocated.
#define | Host_enable() (USBCON |= (1<<HOST))
| enables USB Host function
#define | SOFEN 0
#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 | Is_host_sof_interrupt_enabled() ((UHIEN & (1<<HSOFE)) ? TRUE : FALSE)
#define | Host_is_sof() ((UHINT & (1<<HSOFI)) ? TRUE : FALSE)
| tests if SOF detected
#define | Is_host_sof() ((UHINT & (1<<HSOFI)) ? TRUE : FALSE)
#define | Host_ack_sof() (UHINT &= ~(1<<HSOFI))
#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 | Is_host_hwup_interrupt_enabled() ((UHIEN & (1<<HWUPE)) ? TRUE : FALSE)
#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_ack_hwup() (UHINT &= ~(1<<HWUPI))
#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_interrupt_enabled() ((UHIEN & (1<<RSMEDE)) ? TRUE : FALSE)
#define | Is_host_down_stream_resume() ((UHINT & (1<<RSMEDI)) ? TRUE : FALSE)
| Ack host down stream resume sent.
#define | Host_ack_down_stream_resume() (UHINT &= ~(1<<RSMEDI))
#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 | Is_host_remote_wakeup_interrupt_enabled() ((UHIEN & (1<<RXRSME)) ? TRUE : FALSE)
#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_ack_remote_wakeup() (UHINT &= ~(1<<RXRSMI))
#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_host_device_connection_interrupt_enabled() ((UHIEN & (1<<DCONNE)) ? TRUE : FALSE)
#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_host_device_disconnection_interrupt_enabled() ((UHIEN & (1<<DDISCE)) ? TRUE : FALSE)
#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 | Is_host_reset_interrupt_enabled() ((UHIEN & (1<<RSTE)) ? TRUE : FALSE)
#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.

## Define Documentation

#define Host_allocate_memory | ( |  | ) | (UPCFG1X |= (1<<ALLOC))

allocates the current configuration in DPRAM memory

Definition at line 657 of file usb_drv.h.

Referenced by host_config_pipe().

#define Host_unallocate_memory | ( |  | ) | (UPCFG1X &= ~(1<<ALLOC))

un-allocates the current configuration in DPRAM memory

Definition at line 659 of file usb_drv.h.

Referenced by host_auto_configure_endpoint(), host_disable_all_pipe(), and remove_device_entry().

#define Is_host_pipe_memory_allocated | ( |  | ) | (UPCFG1X & (1<<ALLOC) ? TRUE : FALSE)

Check if pipe memory is allocated.

Definition at line 661 of file usb_drv.h.

Referenced by host_auto_configure_endpoint().

#define Host_enable | ( |  | ) | (USBCON |= (1<<HOST))

enables USB Host function

Definition at line 664 of file usb_drv.h.

#define SOFEN 0

Definition at line 667 of file usb_drv.h.

#define Host_enable_sof | ( |  | ) | (UHCON |= (1<<SOFEN))

enables SOF generation

Definition at line 670 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_disable_sof | ( |  | ) | (UHCON &= ~(1<<SOFEN))

disables SOF generation

Definition at line 672 of file usb_drv.h.

Referenced by usb_device_task(), usb_host_task(), and usb_task().

#define Host_send_reset | ( |  | ) | (UHCON |= (1<<RESET))

sends a USB Reset to the device

Definition at line 674 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_is_reset | ( |  | ) | ((UHCON & (1<<RESET)) ? TRUE : FALSE)

tests if USB Reset running

Definition at line 676 of file usb_drv.h.

#define Host_send_resume | ( |  | ) | (UHCON |= (1<<RESUME))

sends a USB Resume to the device

Definition at line 678 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_is_resume | ( |  | ) | ((UHCON & (1<<RESUME)) ? TRUE : FALSE)

tests if USB Resume running

Definition at line 680 of file usb_drv.h.

#define Host_enable_sof_interrupt | ( |  | ) | (UHIEN |= (1<<HSOFE))

enables host start of frame interrupt

Definition at line 683 of file usb_drv.h.

Referenced by host_get_data(), host_get_data_interrupt(), host_send_control(), host_send_data(), host_send_data_interrupt(), and usb_host_task().

#define Host_disable_sof_interrupt | ( |  | ) | (UHIEN &= ~(1<<HSOFE))

enables host start of frame interrupt

Definition at line 685 of file usb_drv.h.

Referenced by host_get_data(), host_send_control(), host_send_data(), usb_general_interrupt(), usb_host_task(), usb_pipe_interrupt(), and usb_task().

#define Is_host_sof_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<HSOFE)) ? TRUE : FALSE)

Definition at line 686 of file usb_drv.h.

Referenced by host_get_data(), host_get_data_interrupt(), host_send_control(), host_send_data(), host_send_data_interrupt(), usb_general_interrupt(), and usb_host_task().

#define Host_is_sof | ( |  | ) | ((UHINT & (1<<HSOFI)) ? TRUE : FALSE)

tests if SOF detected

Definition at line 688 of file usb_drv.h.

#define Is_host_sof | ( |  | ) | ((UHINT & (1<<HSOFI)) ? TRUE : FALSE)

Definition at line 689 of file usb_drv.h.

Referenced by usb_general_interrupt().

#define Host_ack_sof | ( |  | ) | (UHINT &= ~(1<<HSOFI))

Definition at line 690 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_enable_hwup_interrupt | ( |  | ) | (UHIEN |= (1<<HWUPE))

enables host wake up interrupt detection

Definition at line 693 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_disable_hwup_interrupt | ( |  | ) | (UHIEN &= ~(1<<HWUPE))

disables host wake up interrupt detection

Definition at line 695 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Is_host_hwup_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<HWUPE)) ? TRUE : FALSE)

Definition at line 696 of file usb_drv.h.

Referenced by usb_general_interrupt().

#define Host_is_hwup | ( |  | ) | ((UHINT & (1<<HWUPI)) ? TRUE : FALSE)

tests if host wake up detected

Definition at line 698 of file usb_drv.h.

#define Is_host_hwup | ( |  | ) | ((UHINT & (1<<HWUPI)) ? TRUE : FALSE)

Ack host wake up detection.

Definition at line 700 of file usb_drv.h.

Referenced by usb_general_interrupt().

#define Host_ack_hwup | ( |  | ) | (UHINT &= ~(1<<HWUPI))

Definition at line 701 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_enable_down_stream_resume_interrupt | ( |  | ) | (UHIEN |= (1<<RSMEDE))

enables host down stream rsm sent interrupt detection

Definition at line 704 of file usb_drv.h.

#define Host_disable_down_stream_resume_interrupt | ( |  | ) | (UHIEN &= ~(1<<RSMEDE))

disables host down stream rsm sent interrupt detection

Definition at line 706 of file usb_drv.h.

#define Is_host_down_stream_resume_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<RSMEDE)) ? TRUE : FALSE)

Definition at line 707 of file usb_drv.h.

#define Is_host_down_stream_resume | ( |  | ) | ((UHINT & (1<<RSMEDI)) ? TRUE : FALSE)

Ack host down stream resume sent.

Definition at line 709 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_ack_down_stream_resume | ( |  | ) | (UHINT &= ~(1<<RSMEDI))

Definition at line 710 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_enable_remote_wakeup_interrupt | ( |  | ) | (UHIEN |= (1<<RXRSME))

enables host remote wake up interrupt detection

Definition at line 713 of file usb_drv.h.

#define Host_disable_remote_wakeup_interrupt | ( |  | ) | (UHIEN &= ~(1<<RXRSME))

disables host remote wake up interrupt detection

Definition at line 715 of file usb_drv.h.

#define Is_host_remote_wakeup_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<RXRSME)) ? TRUE : FALSE)

Definition at line 716 of file usb_drv.h.

#define Host_is_remote_wakeup | ( |  | ) | ((UHINT & (1<<RXRSMI)) ? TRUE : FALSE)

tests if host wake up detected

Definition at line 718 of file usb_drv.h.

#define Is_host_remote_wakeup | ( |  | ) | ((UHINT & (1<<RXRSMI)) ? TRUE : FALSE)

Ack host wake up detection.

Definition at line 720 of file usb_drv.h.

#define Host_ack_remote_wakeup | ( |  | ) | (UHINT &= ~(1<<RXRSMI))

Definition at line 721 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_enable_device_connection_interrupt | ( |  | ) | (UHIEN |= (1<<DCONNE))

enables host device connection interrupt

Definition at line 724 of file usb_drv.h.

#define Host_disable_device_connection_interrupt | ( |  | ) | (UHIEN &= ~(1<<DCONNE))

disables USB device connection interrupt

Definition at line 726 of file usb_drv.h.

#define Is_host_device_connection_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<DCONNE)) ? TRUE : FALSE)

Definition at line 727 of file usb_drv.h.

Referenced by usb_general_interrupt().

#define Is_device_connection | ( |  | ) | (UHINT & (1<<DCONNI))

tests if a USB device has been detected

Definition at line 729 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_ack_device_connection | ( |  | ) | (UHINT = ~(1<<DCONNI))

acks device connection

Definition at line 731 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_enable_device_disconnection_interrupt | ( |  | ) | (UHIEN |= (1<<DDISCE))

enables host device disconnection interrupt

Definition at line 734 of file usb_drv.h.

Referenced by usb_host_task(), and usb_host_task_init().

#define Host_disable_device_disconnection_interrupt | ( |  | ) | (UHIEN &= ~(1<<DDISCE))

disables USB device connection interrupt

Definition at line 736 of file usb_drv.h.

Referenced by usb_host_task(), and usb_task().

#define Is_host_device_disconnection_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<DDISCE)) ? TRUE : FALSE)

Definition at line 737 of file usb_drv.h.

Referenced by usb_general_interrupt().

#define Is_device_disconnection | ( |  | ) | (UHINT & (1<<DDISCI) ? TRUE : FALSE)

tests if a USB device has been removed

Definition at line 739 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_ack_device_disconnection | ( |  | ) | (UHINT = ~(1<<DDISCI))

acks device disconnection

Definition at line 741 of file usb_drv.h.

Referenced by usb_general_interrupt(), and usb_host_task().

#define Host_enable_reset_interrupt | ( |  | ) | (UHIEN |= (1<<RSTE))

enables host USB reset interrupt

Definition at line 744 of file usb_drv.h.

#define Host_disable_reset_interrupt | ( |  | ) | (UHIEN &= ~(1<<RSTE))

disables host USB reset interrupt

Definition at line 746 of file usb_drv.h.

#define Is_host_reset_interrupt_enabled | ( |  | ) | ((UHIEN & (1<<RSTE)) ? TRUE : FALSE)

Definition at line 747 of file usb_drv.h.

#define Host_ack_reset | ( |  | ) | (UHINT = ~(1<<RSTI))

acks host USB reset sent

Definition at line 749 of file usb_drv.h.

Referenced by usb_host_task().

#define Is_host_reset | ( |  | ) | Host_is_reset()

tests if USB reset has been sent

Definition at line 751 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_vbus_request | ( |  | ) | (OTGCON |= (1<<VBUSREQ))

switches on VBus

Definition at line 755 of file usb_drv.h.

#define Host_clear_vbus_request | ( |  | ) | (OTGCON |= (1<<VBUSRQC))

switches off VBus

Definition at line 757 of file usb_drv.h.

Referenced by usb_host_task().

#define Host_configure_address | ( | addr |  | ) | (UHADDR = addr & MSK_HADDR)

configures the address to use for the device

Definition at line 759 of file usb_drv.h.

Referenced by host_select_device(), and host_send_control().

#define Is_host_full_speed | ( |  | ) | ((USBSTA & (1<<SPEED)) ? TRUE : FALSE)

Get connected device speed, returns TRUE when in full speed mode.

Definition at line 762 of file usb_drv.h.

Referenced by ushell_cmdusb_ls().