Data Structures | Functions | Variables

usb_specific_request.h File Reference

Specific enumeration process requests header file. More...

#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.

Data Structures

struct  S_usb_hid_report_descriptor_mouse
 Usb HID Report Descriptor Mouse. More...

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)
 This function configures the endpoints.
U8 usb_user_interface_get (U16 wInterface)
 This function returns the interface alternate setting.
void usb_user_interface_reset (U16 wInterface, U8 alternate_setting)
 This function selects (and resets) the interface 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.

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

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:
typecorresponding at bmRequestType (see USB specification)
requestcorresponding 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 89 of file usb_specific_request.c.

References DESCRIPTOR_HID, DESCRIPTOR_PHYSICAL, DESCRIPTOR_REPORT, FALSE, hid_get_hid_descriptor(), hid_get_report_descriptor(), REPORT_TYPE_FEATURE, REPORT_TYPE_INPUT, REPORT_TYPE_OUTPUT, SETUP_GET_DESCRIPTOR, SETUP_HID_GET_IDLE, SETUP_HID_GET_PROTOCOL, SETUP_HID_GET_REPORT, SETUP_HID_SET_IDLE, SETUP_HID_SET_PROTOCOL, SETUP_HID_SET_REPORT, TRUE, usb_hid_get_idle(), usb_hid_set_idle(), usb_hid_set_report_ouput(), Usb_read_byte, USB_SETUP_GET_CLASS_INTER, USB_SETUP_GET_STAND_INTERFACE, and USB_SETUP_SET_CLASS_INTER.

Referenced by usb_process_request().

{
   U8    wValue_msb;
   U8    wValue_lsb;

   // Read wValue
   wValue_lsb = Usb_read_byte();
   wValue_msb = Usb_read_byte();

   //** Specific request from Class HID
   if( USB_SETUP_GET_STAND_INTERFACE == type )
   {
      switch( request )
      {
         case SETUP_GET_DESCRIPTOR:
         switch( wValue_msb ) // Descriptor ID
         {
            case DESCRIPTOR_HID:
            hid_get_hid_descriptor();
            return TRUE;
            break;
   
            case DESCRIPTOR_REPORT:
            hid_get_report_descriptor();
            return TRUE;
   
            case DESCRIPTOR_PHYSICAL:
            // TODO
            break;
         }
         break;
      }
   }
   if( USB_SETUP_SET_CLASS_INTER == type )
   {
      switch( request )
      {
         case SETUP_HID_SET_REPORT:
         // The MSB wValue field specifies the Report Type
         // The LSB wValue field specifies the Report ID
         switch (wValue_msb)
         {
            case REPORT_TYPE_INPUT:
            // TODO
            break;
            
            case REPORT_TYPE_OUTPUT:
            usb_hid_set_report_ouput();
            return TRUE;
            break;

            case REPORT_TYPE_FEATURE:
            break;
         }
         break;

         case SETUP_HID_SET_IDLE:
         usb_hid_set_idle(wValue_lsb,wValue_msb);
         return TRUE;
   
         case SETUP_HID_SET_PROTOCOL:
         // TODO
         break;
      }
   }
   if( USB_SETUP_GET_CLASS_INTER == type )
   {
      switch( request )
      {
         case SETUP_HID_GET_REPORT:
         // TODO
         break;
         case SETUP_HID_GET_IDLE:
         usb_hid_get_idle(wValue_lsb);
         return TRUE;
         case SETUP_HID_GET_PROTOCOL:
         // TODO
         break;
      }
   }
   return FALSE;  // No supported request
}

Here is the call graph for this function:

Here is the caller graph for this function:

void usb_user_endpoint_init ( U8  conf_nb )

This function configures the endpoints.

Parameters:
conf_nbconfiguration number choosed by USB host

Definition at line 177 of file usb_specific_request.c.

References DIRECTION_IN, EP_MOUSE_IN, NYET_ENABLED, ONE_BANK, SIZE_8, TYPE_INTERRUPT, and usb_configure_endpoint.

Referenced by usb_set_configuration().

Here is the caller graph for this function:

U8 usb_user_interface_get ( U16  wInterface )

This function returns the interface alternate setting.

Parameters:
wInterfaceInterface selected
Returns:
alternate setting configurated

Definition at line 194 of file usb_specific_request.c.

Referenced by usb_get_interface().

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

Here is the caller graph for this function:

void usb_user_interface_reset ( U16  wInterface,
U8  alternate_setting 
)

This function selects (and resets) the interface alternate setting.

Parameters:
wInterfaceInterface selected
alternate_settingalternate setting selected

Definition at line 205 of file usb_specific_request.c.

References EP_MOUSE_IN, INTERFACE_NB_MOUSE, Usb_disable_stall_handshake, Usb_reset_data_toggle, Usb_reset_endpoint, and Usb_select_endpoint.

Referenced by usb_set_interface().

{  
   // default setting selected = reset data toggle
   if( INTERFACE_NB_MOUSE == wInterface )
   {
      // Interface mouse
      Usb_select_endpoint(EP_MOUSE_IN);
      Usb_disable_stall_handshake();
      Usb_reset_endpoint(EP_MOUSE_IN);
      Usb_reset_data_toggle();
   }
}

Here is the caller graph for this function:

Bool usb_user_get_descriptor ( U8  type,
U8  string 
)

This function fills the global descriptor.

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

Definition at line 226 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, 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.

Referenced by usb_get_descriptor().

{
   switch(type)
   {
      case DESCRIPTOR_STRING:
      switch (string)
      {
         case LANG_ID:
         data_to_transfer = sizeof (usb_user_language_id);
         pbuffer = &(usb_user_language_id.bLength);
         return TRUE;
         break;
        
         case MAN_INDEX:
         data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor);
         pbuffer = &(usb_user_manufacturer_string_descriptor.bLength);
         return TRUE;
         break;
        
         case PROD_INDEX:
         data_to_transfer = sizeof (usb_user_product_string_descriptor);
         pbuffer = &(usb_user_product_string_descriptor.bLength);
         return TRUE;
         break;
           
#if (USB_DEVICE_SN_USE==ENABLE)              
         case SN_INDEX:
         data_to_transfer = sizeof (usb_user_serial_number);
         pbuffer = &(usb_user_serial_number.bLength);
#if (USE_DEVICE_SN_UNIQUE==ENABLE)
         f_get_serial_string=TRUE;
         data_to_transfer += (SN_LENGTH*4);
#endif
         return TRUE;
         break;
#endif
      }
      break;
   }
   return FALSE;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 68 of file usb_descriptors.c.

Definition at line 87 of file usb_descriptors.c.

Referenced by hid_get_hid_descriptor().

Definition at line 134 of file usb_descriptors.c.

Referenced by usb_user_get_descriptor().

Definition at line 143 of file usb_descriptors.c.

Referenced by usb_user_get_descriptor().

Definition at line 152 of file usb_descriptors.c.

Referenced by usb_user_get_descriptor().

Definition at line 166 of file usb_descriptors.c.

Referenced by usb_user_get_descriptor().