usb_host_enum.h File Reference


Detailed Description

Processing of USB host enumeration requests.

This file contains the USB control pipe management routines corresponding to the standard enumeration process (refer to chapter 9 of the USB specification).

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file usb_host_enum.h.

#include "conf_usb.h"
#include "compiler.h"
#include "usb_drv.h"
#include "usb_task.h"

Go to the source code of this file.

Data Structures

struct  S_interface
 Interface. More...
struct  S_usb_setup_data
 USB Setup Data. More...

Defines

#define CONTROL_CRC16   0x10
#define CONTROL_DATA_PID   0x02
#define CONTROL_DATA_TOGGLE   0x01
#define CONTROL_GOOD   0x00
#define CONTROL_NO_DEVICE   0x40
#define CONTROL_PID   0x04
#define CONTROL_STALL   0x20
#define CONTROL_TIMEOUT   0x08
#define Get_altset_nb(s_interface)   (interface_supported[(s_interface)].altset_nb)
 Number of alternate settings associated with a supported interface.
#define Get_class(s_interface)   (interface_supported[(s_interface)].uclass)
 USB class associated with the supported interface.
#define Get_ep_nbr(s_interface, n_ep)   (Host_get_pipe_endpoint_number(Get_ep_pipe(s_interface, n_ep)))
 Endpoint number associated with the supported interface.
#define Get_ep_pipe(s_interface, n_ep)   (interface_supported[(s_interface)].ep_pipe[(n_ep)])
 Endpoint pipe associated with the supported interface.
#define Get_ep_type(s_interface, n_ep)   (Host_get_pipe_type(Get_ep_pipe(s_interface, n_ep)))
 Endpoint type associated with the supported interface.
#define Get_interface_number(s_interface)   (interface_supported[(s_interface)].interface_nb)
 Number of interfaces associated with a supported interface.
#define Get_maxpower()   (maxpower)
 Maximal power consumption ot the connected device (unit is 2 mA).
#define Get_nb_ep(s_interface)   (interface_supported[(s_interface)].nb_ep)
 Number of endpoints associated with a supported interface.
#define Get_nb_supported_interface()   (nb_interface_supported)
 Number of supported interfaces in the connected device.
#define Get_PID()   (device_PID)
 PID of the connected device.
#define Get_pipe_token(ep_addr)   ((Get_desc_ep_dir(ep_addr)) ? TOKEN_IN : TOKEN_OUT)
 Extract token information from endpoint address.
#define Get_protocol(s_interface)   (interface_supported[(s_interface)].protocol)
 USB protocol associated with the supported interface.
#define Get_subclass(s_interface)   (interface_supported[(s_interface)].subclass)
 USB subclass associated with the supported interface.
#define Get_VID()   (device_VID)
 VID of the connected device.
#define host_clear_endpoint_feature(ep)
 Send a "clear endpoint feature" request.
#define host_get_configuration()
 Send a "get configuration" request.
#define host_get_configuration_descriptor(cfg_ix)
 Send a "get device configuration descriptor" request The configuration descriptor received is stored in the data_stage array.
#define host_get_device_descriptor()
 Send a "get device desriptor" request The descriptor received is stored in the data_stage array.
#define host_get_device_descriptor_incomplete()
 Send an incomplete "get device desriptor" request The descriptor received is stored in the data_stage array.
#define host_ms_get_max_lun()
 Send the mass-storage specific request "get max LUN".
#define host_set_address(addr)
 Send a "set address" request.
#define host_set_configuration(cfg_nb)
 Send a "set configuration" request.
#define host_set_feature_remote_wakeup()
 Send a "set feature" "device remote wake-up".
#define host_set_interface(interface_nb, alt_setting)
 Send a "set interface" request to specify an alternate setting for an interface.
#define Is_device_self_powered()   (Tst_bits(bmattributes, SELF_POWERED_MASK))
 TRUE if the connected device is self-powered.
#define Is_device_supports_remote_wakeup()   (Tst_bits(bmattributes, REMOTE_WAKEUP_MASK))
 TRUE if the connected device supports remote wake-up.
#define Is_ep_in(s_interface, n_ep)   (Host_get_pipe_token(Get_ep_pipe(s_interface, n_ep)) == TOKEN_IN)
 TRUE if the endpoint direction associated with the supported interface is IN.
#define OFFSET_DESCRIPTOR_LENGTH   0
 Offsets common to all descriptor types.
#define OFFSET_FIELD_ALT   3
#define OFFSET_FIELD_BMATTRIBUTES   7
#define OFFSET_FIELD_CLASS   5
#define OFFSET_FIELD_CONFIGURATION_NB   5
#define OFFSET_FIELD_DESCRIPTOR_TYPE   1
#define OFFSET_FIELD_EP_ADDR   2
 Offsets in endpoint descriptors.
#define OFFSET_FIELD_EP_INTERVAL   6
#define OFFSET_FIELD_EP_SIZE   4
#define OFFSET_FIELD_EP_TYPE   3
#define OFFSET_FIELD_INTERFACE_NB   2
 Offsets in interface descriptors.
#define OFFSET_FIELD_MAXPACKETSIZE   7
 Offsets in device descriptors.
#define OFFSET_FIELD_MAXPOWER   8
#define OFFSET_FIELD_NB_CONFIGURATION   17
#define OFFSET_FIELD_NB_INTERFACE   4
#define OFFSET_FIELD_NB_OF_EP   4
#define OFFSET_FIELD_PID   10
#define OFFSET_FIELD_PROTOCOL   7
#define OFFSET_FIELD_SUB_CLASS   6
#define OFFSET_FIELD_TOTAL_LENGTH   2
 Offsets in configuration descriptors.
#define OFFSET_FIELD_VID   8
#define REMOTE_WAKEUP_BIT   5
#define REMOTE_WAKEUP_MASK   (1 << REMOTE_WAKEUP_BIT)
#define SELF_POWERED_BIT   6
#define SELF_POWERED_MASK   (1 << SELF_POWERED_BIT)

Functions

Bool host_check_class (void)
 This function checks if the device class is supported.
Bool host_check_VID_PID (void)
 This function checks if the VID and the PID are supported (if the VID & PID belong to the VID_PID table).
Status_t host_transfer_control (void *data_pointer)
 This function is the generic control pipe management function.

Variables

volatile U8 bmattributes
 bmAttributes byte of connected device
volatile U16 device_PID
 PID of connected device.
volatile U16 device_VID
 VID of connected device.
volatile S_interface interface_supported [MAX_INTERFACE_SUPPORTED]
 Supported interfaces.
volatile U8 maxpower
 maxpower byte of connected device (unit is 2 mA)
volatile U8 nb_interface_supported
 Number of interfaces the host is able to support in the connected device.


Generated on Fri Feb 19 02:27:51 2010 for AVR32 - USB Enumeration Example by  doxygen 1.5.5