usb_host_enum.h File Reference

,vUSB host enumeration process header file More...

#include "modules/usb/usb_task.h"

Include dependency graph for usb_host_enum.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  S_usb_setup_data
 Usb Setup Data. More...
struct  S_interface

Defines

#define T_DESC_OFFSET   U8
 Optimize descriptor offset index according to data_stage[] size.
#define MAX_EP_PER_INTERFACE   4
#define BIT_SELF_POWERED   6
#define BIT_REMOTE_WAKEUP   5
#define BIT_SRP_SUPPORT   0
#define BIT_HNP_SUPPORT   1
#define REQUEST_TYPE_POS   0
#define REQUEST_POS   1
#define VALUE_HIGH_POS   2
#define VALUE_LOW_POS   3
#define INDEX_HIGH_POS   4
#define INDEX_LOW_POS   5
#define LENGTH_HIGH_POS   6
#define LENGTH_LOW_POS   7
#define UNCOMPLETE_READ_POS   8
#define DATA_ADDR_HIGH_POS   9
#define DATA_ADDR_LOW_POS   10
#define CONTROL_GOOD   0
#define CONTROL_DATA_TOGGLE   0x01
#define CONTROL_DATA_PID   0x02
#define CONTROL_PID   0x04
#define CONTROL_TIMEOUT   0x08
#define CONTROL_CRC16   0x10
#define CONTROL_STALL   0x20
#define CONTROL_NO_DEVICE   0x40
 Set of defines for offset in data stage.
#define OFFSET_FIELD_MAXPACKETSIZE   7
#define OFFSET_FIELD_MSB_VID   9
#define OFFSET_FIELD_LSB_VID   8
#define OFFSET_FIELD_MSB_PID   11
#define OFFSET_FIELD_LSB_PID   10
#define OFFSET_DESCRIPTOR_LENGHT   0
#define OFFSET_FIELD_DESCRIPTOR_TYPE   1
#define OFFSET_FIELD_TOTAL_LENGHT   2
#define OFFSET_FIELD_BMATTRIBUTES   7
#define OFFSET_FIELD_MAXPOWER   8
#define OFFSET_FIELD_OTG_FEATURES   2
#define OFFSET_FIELD_NB_INTERFACE   4
 OFFSET for INTERFACE DESCRIPTORS.
#define OFFSET_FIELD_CLASS   5
#define OFFSET_FIELD_SUB_CLASS   6
#define OFFSET_FIELD_PROTOCOL   7
#define OFFSET_FIELD_INTERFACE_NB   2
#define OFFSET_FIELD_ALT   3
#define OFFSET_FIELS_NB_OF_EP   4
#define OFFSET_FIELD_EP_ADDR   2
#define OFFSET_FIELD_EP_TYPE   3
#define OFFSET_FIELD_EP_SIZE   4
#define OFFSET_FIELD_EP_INTERVAL   6
#define OFFSET_DEV_DESC_CLASS   4
 defines for Hub detection
#define HUB_CLASS_CODE   9
#define HOST_FALSE   0
#define HOST_TRUE   1
#define host_clear_endpoint_feature(ep)
 host_clear_endpoint_featurethis function send a clear endpoint request
#define host_get_configuration()
 host_get_configurationthis function send a get configuration request
#define host_set_configuration(cfg_nb)
 host_set_configurationthis function send a set configuration request
#define host_set_interface(interface_nb, alt_setting)
 host_set_interfacethis function send a set interface request to specify a specific alt setting for an interface
#define host_get_device_descriptor_uncomplete()
 host_get_device_descriptor_uncompletethis function send a get device desriptor request. The descriptor table received is stored in data_stage array. The received descriptors is limited to the control pipe lenght
#define host_get_device_descriptor()
 host_get_device_descriptorthis function send a get device desriptor request. The descriptor table received is stored in data_stage array.
#define host_get_configuration_descriptor()
 host_get_configuration_descriptorthis function send a get device configuration request. The configuration descriptor table received is stored in data_stage array.
#define host_get_descriptor_uncomplete()
#define host_set_address(addr)
 host_set_addressthis function send a set address request.
#define host_set_feature_remote_wakeup()
 host_set_feature_remote_wakeupthis function send a set feature device remote wakeup
#define host_set_feature_a_hnp_support()
 host_set_feature_a_hnp_supportThis function send a set feature "a_hnp_support" to tell to B-Device that A-Device support HNP
#define host_set_feature_b_hnp_enable()
 host_set_feature_b_hnp_enableThis function send a set feature "b_hnp_enable" to make B-Device initiating a HNP
#define host_ms_get_max_lun()
 host_ms_get_max_lunthis function send the mass storage specific request "get max lun"
#define Get_VID()   (device_VID)
 Get_VIDthis function returns the VID of the device connected.
#define Get_PID()   (device_PID)
 Get_PIDthis function returns the PID of the device connected.
#define Get_maxpower()   (maxpower)
 Get_maxpowerthis function returns the maximum power consumption ot hte connected device (unit is 2mA).
#define Get_class(s_interface)   (interface_supported[s_interface].class)
 this function returns the USB class associated to the specified interface
#define Get_subclass(s_interface)   (interface_supported[s_interface].subclass)
 this function returns the USB subclass associated to the specified interface
#define Get_protocol(s_interface)   (interface_supported[s_interface].protocol)
 this function returns the USB protocol associated to the specified interface
#define Get_ep_addr(s_interface, n_ep)   (interface_supported[s_interface].ep_addr[n_ep])
 this function returns endpoint address associated to the specified interface and endpoint number in this interface.
#define Get_nb_ep(s_interface)   (interface_supported[s_interface].nb_ep)
 this function returns number of endpoints associated to a supported interface.
#define Get_alts_s(s_interface)   (interface_supported[s_interface].altset_nb)
 this function returns number of the alternate setting field associated to a supported interface.
#define Get_interface_number(s_interface)   (interface_supported[s_interface].interface_nb)
 this function returns number of the interface number associated to a supported interface.
#define Get_nb_supported_interface()   (nb_interface_supported)
 this function returns the number of interface supported in the device connected
#define Is_device_self_powered()   ((bmattributes & (1<<BIT_SELF_POWERED)) ? TRUE : FALSE)
 this function returns true if the device connected is self powered
#define Is_device_supports_remote_wakeup()   ((bmattributes & (1<<BIT_REMOTE_WAKEUP)) ? TRUE : FALSE)
 this function returns true if the device supports remote wake_up
#define Is_device_supports_srp()   ((otg_features_supported & (1<<BIT_SRP_SUPPORT)) ? TRUE : FALSE)
 this function returns true if the device supports SRP
#define Is_device_supports_hnp()   ((otg_features_supported & (1<<BIT_HNP_SUPPORT)) ? TRUE : FALSE)
 this function returns true if the device supports HNP

Functions

U8 host_send_control (U8 *)
 host_send_control.This function is the generic Pipe 0 management function This function is used to send and receive control request over pipe 0
U8 host_check_VID_PID (void)
 host_check_VID_PIDThis function checks if the VID and the PID are supported (if the VID/PID belongs to the VID_PID table)
U8 host_check_OTG_features (void)
 host_check_OTG_featuresThis function checks if the OTG descriptor has been received and indicates which features are supported
U8 host_check_class (void)
 host_check_classThis function checks if the device class is supported. The function looks in all interface declared in the received dewcriptors, if one of them match with the CLASS/SUB_CLASS/PROTOCOL table
U8 host_auto_configure_endpoint ()
 This function configures the pipe according to the device class of the interface selected.
U8 get_interface_descriptor_offset (U8 interface, U8 alt)
 get_interface_descriptor_offsetThis function returns the offset in data_stage where to find the interface descriptor whose number and alternate setting values are passed as parameters
U8 host_get_hwd_pipe_nb (U8 ep_addr)
 This function returns the physical pipe number linked to a logical endpoint address.

Variables

S_usb_setup_data usb_request
 For control requests management over pipe 0.
U8 data_stage [SIZEOF_DATA_STAGE]
 Public : U8 data_stage[SIZEOF_DATA_STAGE]; Internal RAM buffer for USB data stage content This buffer is required to setup host enumeration process Its contains the device descriptors received.
U8 device_status
U8 nb_interface_supported
 The number of interface the host is able to support in the device connected.
S_interface interface_supported [MAX_INTERFACE_SUPPORTED]
U16 device_PID
 PID of device connected.
U16 device_VID
 VID of device connected.
U8 bmattributes
 bmAttributes byte of the connected device
U8 maxpower
 maxpower byte of the connected device (Caution, unit is 2mA)


Detailed Description

,vUSB host enumeration process header file

Copyright (c) 2004 Atmel.

Use of this program is subject to Atmel's End User License Agreement. Please read file license.txt for copyright notice.

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

Version:
1.12 at90usb128-otg-dual_role-toggle-1_0_0
Id
usb_host_enum.h,v 1.12 2007/02/13 10:14:12 arobert Exp
Todo:
Bug:

Definition in file usb_host_enum.h.


Define Documentation

#define T_DESC_OFFSET   U8

Optimize descriptor offset index according to data_stage[] size.

Definition at line 34 of file usb_host_enum.h.

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

#define MAX_EP_PER_INTERFACE   4

Definition at line 40 of file usb_host_enum.h.

#define BIT_SELF_POWERED   6

Definition at line 43 of file usb_host_enum.h.

#define BIT_REMOTE_WAKEUP   5

Definition at line 44 of file usb_host_enum.h.

#define BIT_SRP_SUPPORT   0

Definition at line 46 of file usb_host_enum.h.

#define BIT_HNP_SUPPORT   1

Definition at line 47 of file usb_host_enum.h.


Generated on Mon Feb 19 09:32:05 2007 for Atmel by  doxygen 1.5.1-p1