ATMEL: USB host operating mode configuration

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

# USB host operating mode configuration
[USB application configuration]

## Modules

| USB host custom actions

## Defines

#define | PIPE_MOUSE_IN pipe_mouse_in
#define | PIPE_HID_IN pipe_hid_in
#define | PIPE_HID_OUT pipe_hid_out
#define | Is_dfu_connected() ( dfu_connected ? TRUE : FALSE )
#define | Is_hid_connected() ( (hid_connected && Is_host_not_suspended()) ? TRUE : FALSE )
#define | VID_PID_TABLE
#define | CLASS_SUBCLASS_PROTOCOL
#define | SIZEOF_DATA_STAGE 250
| The size of RAM buffer reserved of descriptors manipulation.
#define | DEVICE_BASE_ADDRESS 0x05
| The address that will be assigned to the connected device.
#define | MAX_EP_PER_INTERFACE 3
| The maximum number of endpoints per interface supported.
#define | MAX_INTERFACE_FOR_DEVICE 3
| The maximum number of interface supported per device.
#define | MAX_DEVICE_IN_USB_TREE 4
| The maximum number of devices in the USB tree.
#define | SAVE_INTERRUPT_PIPE_FOR_DMS_INTERFACE ENABLE
#define | USB_HUB_SUPPORT ENABLE
| Configuration for Hub support in host mode.
#define | USB_MAX_HUB_NUMBER 4
#define | HUB_MAX_NB_PORT 4
#define | HOST_STRICT_VID_PID_TABLE DISABLE
| The host controller will be limited to the strict VID/PID list.
#define | HOST_AUTO_CFG_ENDPOINT ENABLE
| Try to configure the host pipe according to the device descriptors received.
#define | HOST_CONTINUOUS_SOF_INTERRUPT DISABLE
| Host start of frame interrupt always enable.
#define | HOST_ERROR_RESTART ENABLE
| When Host error state detected, goto unattached state.
#define | USB_HOST_PIPE_INTERRUPT_TRANSFER ENABLE
| USB host pipes transfers use USB communication interrupt (allows to use none blocking functions).
#define | ID_PIN_CHANGE_GENERATE_RESET DISABLE
| Force WDT reset upon ID pin change.
#define | TIMEOUT_DELAY_ENABLE ENABLE
| Enable Timeout delay (time) for host transfer.
#define | TIMEOUT_DELAY 10
| delay 1/4sec (250ms) before timeout value
#define | NAK_TIMEOUT_ENABLE DISABLE
| Enable cpt NAK Timeout for host transfer.
#define | NAK_SEND_TIMEOUT 0x0FFF
| Number of NAK handshake before timeout for transmit functions (up to 0xFFFF).
#define | NAK_RECEIVE_TIMEOUT 0x0FFF
| NAKNumber of NAK handshake before timeout for receive functions (up to 0xFFFF).
#define | SOFTWARE_VBUS_CTRL ENABLE
| For reduced host only allows to control VBUS generator with PIO PE.7.
#define | User_configure_endpoint()
| If no auto configuration of EP, map here user function.

## Functions

void | set_power_down_mode (void)
| This function makes the AVR core enter power down mode.
void | host_sof_action (void)

## Variables

U8 | pipe_mouse_in
U8 | dfu_connected
U8 | hid_connected

## Define Documentation

#define PIPE_MOUSE_IN pipe_mouse_in

Definition at line 95 of file conf_usb.h.

Referenced by host_mouse_task().

#define PIPE_HID_IN pipe_hid_in

Definition at line 96 of file conf_usb.h.

Referenced by host_hid_task().

#define PIPE_HID_OUT pipe_hid_out

Definition at line 97 of file conf_usb.h.

Referenced by host_hid_task().

#define Is_dfu_connected | ( |  | ) | ( dfu_connected ? TRUE : FALSE )

Definition at line 102 of file conf_usb.h.

Referenced by ushell_cmddfu_erase(), ushell_cmddfu_load(), and ushell_cmddfu_start().

#define Is_hid_connected | ( |  | ) | ( (hid_connected && Is_host_not_suspended()) ? TRUE : FALSE )

Definition at line 104 of file conf_usb.h.

Referenced by ushell_cmdhid_enter_dfu(), and ushell_cmdhid_getinfo().

#define VID_PID_TABLE

Value:

    {VID_ATMEL, 2, PID_MegaHIDMouse, 0x2014 \
                                        ,0x0123, 3, 0x2000, 0x2100, 0x1258}

VID/PID supported table list This table contains the VID/PID that are supported by the reduced host application VID_PID_TABLE format definition: define VID_PID_TABLE {VID1, number_of_pid_for_this_VID1, PID11_value,..., PID1X_Value
...
,VIDz, number_of_pid_for_this_VIDz, PIDz1_value,..., PIDzX_Value}

Definition at line 115 of file conf_usb.h.

#define CLASS_SUBCLASS_PROTOCOL

Value:

    {\
                                           0x00, 0x00, 0x00,\
                                           HUB_CLASS, 0x00, 0x00,\
                                           MS_CLASS, MS_SUB_CLASS2, MS_PROTOCOL,\
                                           MS_CLASS, MS_SUB_CLASS5, MS_PROTOCOL,\
                                           MS_CLASS, MS_SUB_CLASS6, MS_PROTOCOL,\
                                           HID_CLASS, NO_SUBCLASS, HID_PROTOCOL_MOUSE,\
                                           HID_CLASS, HID_SUB_CLASS_BOOT, HID_PROTOCOL_MOUSE,\
                                           HID_CLASS, NO_SUBCLASS, NO_PROTOCOL,\
                                           }

CLASS/SUBCLASS_PROTOCOL supported table list This table contains the CLASS/SUBCLASS/PROTOCOL that is supported by the reduced host application This table definition allows to extended the reduced application device support to an entire Class/ /subclass/protocol instead of a simple VID/PID table list.

CLASS_SUBCLASS_PROTOCOL format definition:
define CLASS_SUBCLASS_PROTOCOL {CLASS1, SUB_CLASS1,PROTOCOL1,
...
CLASSz, SUB_CLASSz,PROTOCOLz}

Definition at line 128 of file conf_usb.h.

#define SIZEOF_DATA_STAGE 250

The size of RAM buffer reserved of descriptors manipulation.

Definition at line 140 of file conf_usb.h.

Referenced by get_interface_descriptor_offset(), host_auto_configure_endpoint(), and host_check_class().

#define DEVICE_BASE_ADDRESS 0x05

The address that will be assigned to the connected device.

Definition at line 143 of file conf_usb.h.

Referenced by enumerate_hub_port_device(), and usb_host_task().

#define MAX_EP_PER_INTERFACE 3

The maximum number of endpoints per interface supported.

Definition at line 146 of file conf_usb.h.

Referenced by host_get_hwd_pipe_nb(), and remove_device_entry().

#define MAX_INTERFACE_FOR_DEVICE 3

The maximum number of interface supported per device.

Definition at line 149 of file conf_usb.h.

Referenced by host_check_class(), host_get_hwd_pipe_nb(), and remove_device_entry().

#define MAX_DEVICE_IN_USB_TREE 4

The maximum number of devices in the USB tree.

Definition at line 152 of file conf_usb.h.

Referenced by enumerate_hub_port_device(), init_usb_tree(), remove_device_entry(), and usb_host_task().

#define SAVE_INTERRUPT_PIPE_FOR_DMS_INTERFACE ENABLE

Definition at line 154 of file conf_usb.h.

#define USB_HUB_SUPPORT ENABLE

Configuration for Hub support in host mode.

Definition at line 158 of file conf_usb.h.

#define USB_MAX_HUB_NUMBER 4

Definition at line 159 of file conf_usb.h.

Referenced by hub_manage_port_change_status(), init_usb_tree(), and remove_device_entry().

#define HUB_MAX_NB_PORT 4

Definition at line 160 of file conf_usb.h.

Referenced by hub_init(), hub_manage_port_change_status(), init_usb_tree(), and remove_device_entry().

#define HOST_STRICT_VID_PID_TABLE DISABLE

The host controller will be limited to the strict VID/PID list.

When enabled, if the device PID/VID does not belongs to the supported list, the host controller library will not go to deeper configuration, but to error state.

Definition at line 168 of file conf_usb.h.

#define HOST_AUTO_CFG_ENDPOINT ENABLE

Try to configure the host pipe according to the device descriptors received.

Definition at line 171 of file conf_usb.h.

#define HOST_CONTINUOUS_SOF_INTERRUPT DISABLE

Host start of frame interrupt always enable.

Definition at line 174 of file conf_usb.h.

#define HOST_ERROR_RESTART ENABLE

When Host error state detected, goto unattached state.

Definition at line 177 of file conf_usb.h.

#define USB_HOST_PIPE_INTERRUPT_TRANSFER ENABLE

USB host pipes transfers use USB communication interrupt (allows to use none blocking functions).

Definition at line 180 of file conf_usb.h.

#define ID_PIN_CHANGE_GENERATE_RESET DISABLE

Force WDT reset upon ID pin change.

Definition at line 183 of file conf_usb.h.

#define TIMEOUT_DELAY_ENABLE ENABLE

Enable Timeout delay (time) for host transfer.

Definition at line 186 of file conf_usb.h.

#define TIMEOUT_DELAY 10

delay 1/4sec (250ms) before timeout value

Definition at line 189 of file conf_usb.h.

Referenced by host_get_data(), host_send_data(), and usb_general_interrupt().

#define NAK_TIMEOUT_ENABLE DISABLE

Enable cpt NAK Timeout for host transfer.

Definition at line 192 of file conf_usb.h.

#define NAK_SEND_TIMEOUT 0x0FFF

Number of NAK handshake before timeout for transmit functions (up to 0xFFFF).

Definition at line 195 of file conf_usb.h.

Referenced by host_send_data(), host_send_data_interrupt(), and usb_pipe_interrupt().

#define NAK_RECEIVE_TIMEOUT 0x0FFF

NAKNumber of NAK handshake before timeout for receive functions (up to 0xFFFF).

Definition at line 198 of file conf_usb.h.

Referenced by host_get_data(), host_get_data_interrupt(), and usb_pipe_interrupt().

#define SOFTWARE_VBUS_CTRL ENABLE

For reduced host only allows to control VBUS generator with PIO PE.7.

Definition at line 201 of file conf_usb.h.

#define User_configure_endpoint | ( |  | ) |

If no auto configuration of EP, map here user function.

Definition at line 205 of file conf_usb.h.

Referenced by enumerate_hub_port_device(), and usb_host_task().

## Function Documentation

void set_power_down_mode | ( | void |  | ) |

This function makes the AVR core enter power down mode.

Definition at line 73 of file power_drv.c.

    00074 {
    00075    Setup_power_down_mode();
    00076    Sleep_instruction();
    00077 }

void host_sof_action | ( | void |  | ) |

This function is called each host start of frame, when sync operation is on-going, the function toggles Led3 each 255ms.

Definition at line 159 of file host_ms_task.c.

    00160 {
    00161    host_cpt_sof++;
    00162    #if (HOST_SYNC_MODE==ENABLE)
    00163    if(host_cpt_sof==0 &&sync_on_going) Led3_toggle();
    00164    #endif
    00165 }

## Variable Documentation

U8 pipe_mouse_in

Definition at line 68 of file host_mouse_task.c.

U8 dfu_connected

Definition at line 74 of file host_dfu_task.c.

Referenced by host_dfu_task(), and host_dfu_task_init().

U8 hid_connected

Definition at line 68 of file host_hid_task.c.

Referenced by host_hid_task(), and host_hid_task_init().