usb_descriptors.c

Go to the documentation of this file.
00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
00016 
00017 /* Copyright (c) 2007, Atmel Corporation All rights reserved.
00018  *
00019  * Redistribution and use in source and binary forms, with or without
00020  * modification, are permitted provided that the following conditions are met:
00021  *
00022  * 1. Redistributions of source code must retain the above copyright notice,
00023  * this list of conditions and the following disclaimer.
00024  *
00025  * 2. Redistributions in binary form must reproduce the above copyright notice,
00026  * this list of conditions and the following disclaimer in the documentation
00027  * and/or other materials provided with the distribution.
00028  *
00029  * 3. The name of ATMEL may not be used to endorse or promote products derived
00030  * from this software without specific prior written permission.
00031  *
00032  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00033  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00034  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00035  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00036  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00037  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00038  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00039  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00041  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00042  */
00043 
00044 
00045 //_____ I N C L U D E S ____________________________________________________
00046 
00047 #include "config.h"
00048 #include "conf_usb.h"
00049 
00050 #include "lib_mcu/usb/usb_drv.h"
00051 #include "usb_descriptors.h"
00052 #include "modules/usb/device_chap9/usb_standard_request.h"
00053 #include "usb_specific_request.h"
00054 #if ((USB_DEVICE_SN_USE==ENABLE) && (USE_DEVICE_SN_UNIQUE==ENABLE))
00055 #include "lib_mcu/flash/flash_drv.h"
00056 #endif
00057 
00058 //_____ M A C R O S ________________________________________________________
00059 
00060 
00061 
00062 
00063 //_____ D E F I N I T I O N ________________________________________________
00064 
00065 // usb_user_device_descriptor
00066 code S_usb_device_descriptor usb_dev_desc =
00067 {
00068   sizeof(usb_dev_desc)
00069 , DESCRIPTOR_DEVICE
00070 , Usb_write_word_enum_struc(USB_SPECIFICATION)
00071 , DEVICE_CLASS
00072 , DEVICE_SUB_CLASS
00073 , DEVICE_PROTOCOL
00074 , EP_CONTROL_LENGTH
00075 , Usb_write_word_enum_struc(VENDOR_ID)
00076 , Usb_write_word_enum_struc(PRODUCT_ID)
00077 , Usb_write_word_enum_struc(RELEASE_NUMBER)
00078 , MAN_INDEX
00079 , PROD_INDEX
00080 , SN_INDEX
00081 , NB_CONFIGURATION
00082 };
00083 
00084 // usb_user_configuration_descriptor FS
00085 code S_usb_user_configuration_descriptor usb_conf_desc = {
00086  { sizeof(S_usb_configuration_descriptor)
00087  , DESCRIPTOR_CONFIGURATION
00088  , Usb_write_word_enum_struc(sizeof(S_usb_user_configuration_descriptor))
00089  , NB_INTERFACE
00090  , CONF_NB
00091  , CONF_INDEX
00092  , CONF_ATTRIBUTES
00093  , MAX_POWER
00094  }
00095  ,
00096  
00097  //** The first interface is the Control Audio Interface
00098  // The AudioControl (AC) interface descriptors contain all relevant information to fully characterize the corresponding audio function.
00099  { sizeof(S_usb_interface_descriptor)
00100  , DESCRIPTOR_INTERFACE
00101  , AC_INTERFACE_NB
00102  , AC_ALTERNATE
00103  , AC_NB_ENDPOINT
00104  , AC_INTERFACE_CLASS
00105  , AC_INTERFACE_SUB_CLASS
00106  , AC_INTERFACE_PROTOCOL
00107  , AC_INTERFACE_INDEX
00108  }
00109  ,
00110  // Class-Specific AC Interface Descriptor
00111  { sizeof(S_usb_ac_interface_descriptor)
00112  ,DESCRIPTOR_AUDIO_INTERFACE
00113  ,DESCRIPTOR_SUBTYPE_AUDIO_AC_HEADER
00114  ,Usb_write_word_enum_struc(AUDIO_CLASS_REVISION)
00115  ,Usb_write_word_enum_struc(sizeof(S_usb_ac_interface_descriptor)+sizeof(S_usb_in_ter_descriptor)\
00116                +sizeof(S_usb_feature_unit_descriptor)+sizeof(S_usb_out_ter_descriptor))
00117  ,NB_OF_STREAMING_INTERFACE
00118  ,STD_AS_INTERFACE_NB
00119  }
00120  ,
00121  // Class-Specific Input Terminal Descriptor
00122  { sizeof(S_usb_in_ter_descriptor)
00123  ,DESCRIPTOR_AUDIO_INTERFACE
00124  ,DESCRIPTOR_SUBTYPE_AUDIO_AC_INPUT_TERMINAL
00125  ,INPUT_TERMINAL_ID
00126  ,Usb_write_word_enum_struc(INPUT_TERMINAL_TYPE)
00127  ,INPUT_TERMINAL_ASSOCIATION
00128  ,INPUT_TERMINAL_NB_CHANNELS
00129  ,INPUT_TERMINAL_CHANNEL_CONF
00130  ,INPUT_TERMINAL_CH_NAME_ID
00131  ,0x00
00132  }
00133  ,
00134  // Class-Specific Feature Unit Descriptor
00135  { sizeof(S_usb_feature_unit_descriptor)
00136  ,DESCRIPTOR_AUDIO_INTERFACE
00137  ,DESCRIPTOR_SUBTYPE_AUDIO_AC_FEATURE_UNIT
00138  ,FEATURE_UNIT_ID
00139  ,FEATURE_UNIT_SOURCE_ID
00140  ,0x01
00141  ,FEATURE_UNIT_CTRL_CH_MASTER
00142  ,FEATURE_UNIT_CTRL_CH_1
00143  }
00144  ,
00145  // Class-Specific Output Terminal Descriptor
00146  { sizeof(S_usb_out_ter_descriptor)
00147  ,DESCRIPTOR_AUDIO_INTERFACE
00148  ,DESCRIPTOR_SUBTYPE_AUDIO_AC_OUTPUT_TERMINAL
00149  ,OUTPUT_TERMINAL_ID
00150  ,Usb_write_word_enum_struc(OUTPUT_TERMINAL_TYPE)
00151  ,OUTPUT_TERMINAL_ASSOCIATION
00152  ,OUTPUT_TERMINAL_SOURCE_ID
00153  ,0x00
00154  }
00155  ,
00156  
00157  //** The second interface is the Audio Stream Interface (with two alternate interface)
00158  // Standard AS Interface Descriptor (Alternate 0 without endpoint)
00159  { sizeof(S_usb_interface_descriptor)
00160  ,DESCRIPTOR_INTERFACE
00161  ,STD_AS_INTERFACE_NB
00162  ,ALT0_AS_INTERFACE_INDEX
00163  ,ALT0_AS_NB_ENDPOINT
00164  ,ALT0_AS_INTERFACE_CLASS
00165  ,ALT0_AS_INTERFACE_SUB_CLASS
00166  ,ALT0_AS_INTERFACE_PROTOCOL
00167  ,0x00
00168  }
00169  ,
00170  // Standard AS Interface Descriptor (Alternate 1 with 1 endpoint)
00171  { sizeof(S_usb_interface_descriptor)
00172  ,DESCRIPTOR_INTERFACE
00173  ,STD_AS_INTERFACE_NB
00174  ,ALT1_AS_INTERFACE_INDEX
00175  ,ALT1_AS_NB_ENDPOINT
00176  ,ALT1_AS_INTERFACE_CLASS
00177  ,ALT1_AS_INTERFACE_SUB_CLASS
00178  ,ALT1_AS_INTERFACE_PROTOCOL
00179  ,0x00
00180  }
00181  ,
00182  // Class-Specific AS Interface Descriptor
00183  { sizeof(S_usb_as_interface_descriptor)
00184  ,DESCRIPTOR_AUDIO_INTERFACE
00185  ,DESCRIPTOR_SUBTYPE_AUDIO_AS_GENERAL
00186  ,AS_TERMINAL_LINK
00187  ,AS_DELAY
00188  ,Usb_write_word_enum_struc(AS_FORMAT_TAG)
00189  }
00190  ,
00191  { sizeof(S_usb_format_type)
00192  ,DESCRIPTOR_AUDIO_INTERFACE
00193  ,DESCRIPTOR_SUBTYPE_AUDIO_AS_FORMAT_TYPE
00194  ,FORMAT_TYPE
00195  ,FORMAT_NB_CHANNELS
00196  ,FORMAT_FRAME_SIZE
00197  ,FORMAT_BIT_RESOLUTION
00198  ,FORMAT_SAMPLE_FREQ_NB
00199  ,Usb_write_word_enum_struc(FORMAT_LSBYTE_SAMPLE_FREQ)
00200  ,FORMAT_MSBYTE_SAMPLE_FREQ
00201  }
00202  ,
00203  { sizeof(S_usb_endpoint_audio_descriptor)
00204  , DESCRIPTOR_ENDPOINT
00205  , ENDPOINT_NB_1
00206  , EP_ATTRIBUTES_1
00207  , Usb_write_word_enum_struc(EP_SIZE_1)
00208  , EP_INTERVAL_1
00209  , 0x00
00210  , 0x00
00211  }
00212  ,
00213  { sizeof(S_usb_endpoint_audio_specific)
00214  ,DESCRIPTOR_AUDIO_ENDPOINT
00215  ,DESCRIPTOR_SUBTYPE_AUDIO_ENDP_GENERAL
00216  ,AUDIO_EP_ATRIBUTES
00217  ,AUDIO_EP_DELAY_UNIT
00218  ,Usb_write_word_enum_struc(AUDIO_EP_LOCK_DELAY)
00219  }
00220 };
00221 
00222 
00223 
00224                                       // usb_user_manufacturer_string_descriptor
00225 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00226   sizeof(usb_user_manufacturer_string_descriptor)
00227 , DESCRIPTOR_STRING
00228 , USB_MANUFACTURER_NAME
00229 };
00230 
00231 
00232                                       // usb_user_product_string_descriptor
00233 
00234 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00235   sizeof(usb_user_product_string_descriptor)
00236 , DESCRIPTOR_STRING
00237 , USB_PRODUCT_NAME
00238 };
00239 
00240 
00241                                       // usb_user_serial_number
00242 #if (USB_DEVICE_SN_USE==ENABLE)
00243 code S_usb_serial_number usb_user_serial_number = {
00244 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00245   sizeof(usb_user_serial_number)+4*SN_LENGTH
00246 , DESCRIPTOR_STRING
00247 #else
00248 sizeof(usb_user_serial_number)
00249 , DESCRIPTOR_STRING
00250 , USB_SERIAL_NUMBER
00251 #endif
00252 };
00253 #endif
00254 
00255                                       // usb_user_language_id
00256 
00257 code S_usb_language_id usb_user_language_id = {
00258   sizeof(usb_user_language_id)
00259 , DESCRIPTOR_STRING
00260 , Usb_write_word_enum_struc(LANGUAGE_ID)
00261 };
00262 
00263 
00264 
00265 

Generated on Fri Oct 31 15:31:41 2008 for ATMEL by  doxygen 1.5.3