usb_specific_request.h File Reference

#include "config.h"

Include dependency graph for usb_specific_request.h:

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

Go to the source code of this file.

Functions

Bool usb_user_read_request (U8, U8)
 This function checks the specific request and if known then processes it
void usb_user_endpoint_init (U8)
U8 usb_user_interface_get (U16 wInterface)
void usb_user_interface_reset (U16 wInterface, U8 alternate_setting)
Bool usb_user_get_descriptor (U8, U8)
 This function fills the global descriptor.

Variables

code
S_usb_device_descriptor 
usb_dev_desc
code
S_usb_user_configuration_descriptor 
usb_conf_desc
code
S_usb_manufacturer_string_descriptor 
usb_user_manufacturer_string_descriptor
code
S_usb_product_string_descriptor 
usb_user_product_string_descriptor
code S_usb_serial_number usb_user_serial_number
code S_usb_language_id usb_user_language_id


Detailed Description

Specific enumeration process requests header file - Compiler: IAR EWAVR and GNU GCC for AVR

Definition in file usb_specific_request.h.


Function Documentation

Bool usb_user_read_request ( U8  type,
U8  request 
)

This function checks the specific request and if known then processes it

Parameters:
type corresponding at bmRequestType (see USB specification)
request corresponding at bRequest (see USB specification)
Returns:
TRUE, when the request is processed

FALSE, if the request is'nt know (STALL handshake is managed by the main standard request function).

Definition at line 80 of file usb_specific_request.c.

References FALSE, SETUP_GET_DESCRIPTOR, Usb_read_byte, USB_SETUP_GET_CLASS_INTER, USB_SETUP_GET_STAND_INTERFACE, and USB_SETUP_SET_CLASS_INTER.

00081 {
00082    U8  wValue_msb;
00083    U8  wValue_lsb;
00084 
00085    // Read wValue
00086    wValue_lsb = Usb_read_byte();
00087    wValue_msb = Usb_read_byte();
00088 
00089    //** Specific request from Class
00090    if( USB_SETUP_GET_STAND_INTERFACE == type )
00091    {
00092       switch( request )
00093       {
00094          case SETUP_GET_DESCRIPTOR:
00095          switch( wValue_msb ) // Descriptor ID
00096          {
00097             default:
00098             // TODO
00099             break;
00100          }
00101          break;
00102       }
00103    }
00104    if( USB_SETUP_SET_CLASS_INTER == type )
00105    {
00106       switch( request )
00107       {
00108          default:
00109          break;
00110       }
00111    }
00112    if( USB_SETUP_GET_CLASS_INTER == type )
00113    {
00114       switch( request )
00115       {
00116          default:
00117          break;
00118       }
00119    }
00120    return FALSE;  // No supported request
00121 }

void usb_user_endpoint_init ( U8  conf_nb  ) 

This function configures the endpoints

Parameters:
conf_nb configuration number choosed by USB host

Definition at line 128 of file usb_specific_request.c.

References DIRECTION_IN, DIRECTION_OUT, EP_TEMP_IN, EP_TEMP_INT_IN, EP_TEMP_OUT, NYET_ENABLED, ONE_BANK, SIZE_64, TYPE_BULK, TYPE_INTERRUPT, and usb_configure_endpoint.

00129 {
00130    usb_configure_endpoint(EP_TEMP_IN,    \
00131                           TYPE_BULK,     \
00132                           DIRECTION_IN,  \
00133                           SIZE_64,       \
00134                           ONE_BANK,      \
00135                           NYET_ENABLED);
00136    usb_configure_endpoint(EP_TEMP_OUT,   \
00137                           TYPE_BULK,     \
00138                           DIRECTION_OUT, \
00139                           SIZE_64,       \
00140                           ONE_BANK,      \
00141                           NYET_ENABLED);
00142    usb_configure_endpoint(EP_TEMP_INT_IN,\
00143                           TYPE_BULK,     \
00144                           TYPE_INTERRUPT,\
00145                           SIZE_64,       \
00146                           ONE_BANK,      \
00147                           NYET_ENABLED);
00148 }

U8 usb_user_interface_get ( U16  wInterface  ) 

This function returns the interface alternate setting

Parameters:
wInterface Interface selected
Returns:
alternate setting configurated

Definition at line 157 of file usb_specific_request.c.

00158 {
00159    return 0;  // Only one alternate setting possible for all interface
00160 }

void usb_user_interface_reset ( U16  wInterface,
U8  alternate_setting 
)

This function selects (and resets) the interface alternate setting

Parameters:
wInterface Interface selected
alternate_setting alternate setting selected

Definition at line 168 of file usb_specific_request.c.

References EP_TEMP_IN, EP_TEMP_INT_IN, EP_TEMP_OUT, INTERFACE_NB_SECOND_TEMP, INTERFACE_NB_TEMP, Usb_disable_stall_handshake, Usb_reset_data_toggle, Usb_reset_endpoint, and Usb_select_endpoint.

00169 {  
00170    // default setting selected = reset data toggle
00171    if( INTERFACE_NB_TEMP == wInterface )
00172    {
00173       // Interface reset
00174       Usb_select_endpoint(EP_TEMP_IN);
00175       Usb_disable_stall_handshake();
00176       Usb_reset_endpoint(EP_TEMP_IN);
00177       Usb_reset_data_toggle();
00178       Usb_select_endpoint(EP_TEMP_OUT);
00179       Usb_disable_stall_handshake();
00180       Usb_reset_endpoint(EP_TEMP_OUT);
00181       Usb_reset_data_toggle();
00182    }
00183    if( INTERFACE_NB_SECOND_TEMP == wInterface )
00184    {
00185       // Interface reset
00186       Usb_select_endpoint(EP_TEMP_INT_IN);
00187       Usb_disable_stall_handshake();
00188       Usb_reset_endpoint(EP_TEMP_INT_IN);
00189       Usb_reset_data_toggle();
00190    }
00191 }

Bool usb_user_get_descriptor ( U8  type,
U8  string 
)

This function fills the global descriptor.

Parameters:
type corresponding at MSB of wValue (see USB specification)
string corresponding at LSB of wValue (see USB specification)
Returns:
FALSE, if the global descriptor no filled

Definition at line 201 of file usb_specific_request.c.

References S_usb_serial_number::bLength, S_usb_product_string_descriptor::bLength, S_usb_manufacturer_string_descriptor::bLength, S_usb_language_id::bLength, data_to_transfer, DESCRIPTOR_STRING, f_get_serial_string, FALSE, LANG_ID, MAN_INDEX, pbuffer, PROD_INDEX, SN_INDEX, SN_LENGTH, TRUE, usb_user_language_id, usb_user_manufacturer_string_descriptor, usb_user_product_string_descriptor, and usb_user_serial_number.

00202 {
00203    switch(type)
00204    {
00205       case DESCRIPTOR_STRING:
00206       switch (string)
00207       {
00208          case LANG_ID:
00209          data_to_transfer = sizeof (usb_user_language_id);
00210          pbuffer = &(usb_user_language_id.bLength);
00211          return TRUE;
00212          break;
00213         
00214          case MAN_INDEX:
00215          data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor);
00216          pbuffer = &(usb_user_manufacturer_string_descriptor.bLength);
00217          return TRUE;
00218          break;
00219         
00220          case PROD_INDEX:
00221          data_to_transfer = sizeof (usb_user_product_string_descriptor);
00222          pbuffer = &(usb_user_product_string_descriptor.bLength);
00223          return TRUE;
00224          break;
00225            
00226 #if (USB_DEVICE_SN_USE==ENABLE)              
00227          case SN_INDEX:
00228          data_to_transfer = sizeof (usb_user_serial_number);
00229          pbuffer = &(usb_user_serial_number.bLength);
00230 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00231          f_get_serial_string=TRUE;
00232          data_to_transfer += (SN_LENGTH*4);
00233 #endif
00234          return TRUE;
00235          break;
00236 #endif
00237       }
00238       break;
00239    }
00240    return FALSE;
00241 }


Variable Documentation

code S_usb_device_descriptor usb_dev_desc

Definition at line 69 of file usb_descriptors.c.

code S_usb_user_configuration_descriptor usb_conf_desc

Definition at line 88 of file usb_descriptors.c.

code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor

Definition at line 154 of file usb_descriptors.c.

code S_usb_product_string_descriptor usb_user_product_string_descriptor

Definition at line 163 of file usb_descriptors.c.

code S_usb_serial_number usb_user_serial_number

Definition at line 172 of file usb_descriptors.c.

code S_usb_language_id usb_user_language_id

Definition at line 186 of file usb_descriptors.c.


Generated on Fri Sep 11 14:23:54 2009 for ATMEL by  doxygen 1.5.3