usb_descriptors.c

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00016 
00017 /* Copyright (c) 2009 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  * 4. This software may only be redistributed and used in connection with an Atmel
00033  * AVR product.
00034  *
00035  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00037  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00038  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00039  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00040  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00041  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00042  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00043  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00044  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00045  */
00046 
00047 
00048 //_____ I N C L U D E S ____________________________________________________
00049 
00050 #include "config.h"
00051 #include "conf_usb.h"
00052 
00053 #include "lib_mcu/usb/usb_drv.h"
00054 #include "usb_descriptors.h"
00055 #include "modules/usb/device_chap9/usb_standard_request.h"
00056 #include "usb_specific_request.h"
00057 #if ((USB_DEVICE_SN_USE==ENABLE) && (USE_DEVICE_SN_UNIQUE==ENABLE))
00058 #include "lib_mcu/flash/flash_drv.h"
00059 #endif
00060 
00061 //_____ M A C R O S ________________________________________________________
00062 
00063 
00064 
00065 
00066 //_____ D E F I N I T I O N ________________________________________________
00067 
00068 // usb_user_device_descriptor
00069 code S_usb_device_descriptor usb_dev_desc =
00070 {
00071   sizeof(usb_dev_desc)
00072 , DESCRIPTOR_DEVICE
00073 , Usb_write_word_enum_struc(USB_SPECIFICATION)
00074 , DEVICE_CLASS
00075 , DEVICE_SUB_CLASS
00076 , DEVICE_PROTOCOL
00077 , EP_CONTROL_LENGTH
00078 , Usb_write_word_enum_struc(VENDOR_ID)
00079 , Usb_write_word_enum_struc(PRODUCT_ID)
00080 , Usb_write_word_enum_struc(RELEASE_NUMBER)
00081 , MAN_INDEX
00082 , PROD_INDEX
00083 , SN_INDEX
00084 , NB_CONFIGURATION
00085 };
00086 
00087 // usb_user_configuration_descriptor FS
00088 code S_usb_user_configuration_descriptor usb_conf_desc = {
00089  { sizeof(S_usb_configuration_descriptor)
00090  , DESCRIPTOR_CONFIGURATION
00091  , Usb_write_word_enum_struc(sizeof(S_usb_configuration_descriptor)\
00092        +sizeof(S_usb_interface_descriptor)   \
00093        +sizeof(S_usb_endpoint_descriptor)   \
00094        +sizeof(S_usb_endpoint_descriptor))  \
00095        +sizeof(S_usb_interface_descriptor)  \
00096        +sizeof(S_usb_endpoint_descriptor)
00097  , NB_INTERFACE
00098  , CONF_NB
00099  , CONF_INDEX
00100  , CONF_ATTRIBUTES
00101  , MAX_POWER
00102  }
00103  ,
00104  { sizeof(S_usb_interface_descriptor)
00105  , DESCRIPTOR_INTERFACE
00106  , INTERFACE_NB_TEMP
00107  , ALTERNATE_TEMP
00108  , NB_ENDPOINT_TEMP
00109  , INTERFACE_CLASS_TEMP
00110  , INTERFACE_SUB_CLASS_TEMP
00111  , INTERFACE_PROTOCOL_TEMP
00112  , INTERFACE_INDEX_TEMP
00113  }
00114  ,
00115  { sizeof(S_usb_endpoint_descriptor)
00116  , DESCRIPTOR_ENDPOINT
00117  , ENDPOINT_NB_TEMP1
00118  , EP_ATTRIBUTES_TEMP1
00119  , Usb_write_word_enum_struc(EP_SIZE_TEMP1)
00120  , EP_INTERVAL_TEMP1
00121  }
00122  ,
00123  { sizeof(S_usb_endpoint_descriptor)
00124  , DESCRIPTOR_ENDPOINT
00125  , ENDPOINT_NB_TEMP2
00126  , EP_ATTRIBUTES_TEMP2
00127  , Usb_write_word_enum_struc(EP_SIZE_TEMP2)
00128  , EP_INTERVAL_TEMP2
00129  }
00130  ,
00131  { sizeof(S_usb_interface_descriptor)
00132  , DESCRIPTOR_INTERFACE
00133  , INTERFACE_NB_SECOND_TEMP
00134  , ALTERNATE_SECOND_TEMP
00135  , NB_ENDPOINT_SECOND_TEMP
00136  , INTERFACE_CLASS_SECOND_TEMP
00137  , INTERFACE_SUB_CLASS_SECOND_TEMP
00138  , INTERFACE_PROTOCOL_SECOND_TEMP
00139  , INTERFACE_INDEX_SECOND_TEMP
00140  }
00141  ,
00142  { sizeof(S_usb_endpoint_descriptor)
00143  , DESCRIPTOR_ENDPOINT
00144  , ENDPOINT_NB_TEMP3
00145  , EP_ATTRIBUTES_TEMP3
00146  , Usb_write_word_enum_struc(EP_SIZE_TEMP3)
00147  , EP_INTERVAL_TEMP3
00148  }
00149 };
00150 
00151 
00152 
00153                                       // usb_user_manufacturer_string_descriptor
00154 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00155   sizeof(usb_user_manufacturer_string_descriptor)
00156 , DESCRIPTOR_STRING
00157 , USB_MANUFACTURER_NAME
00158 };
00159 
00160 
00161                                       // usb_user_product_string_descriptor
00162 
00163 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00164   sizeof(usb_user_product_string_descriptor)
00165 , DESCRIPTOR_STRING
00166 , USB_PRODUCT_NAME
00167 };
00168 
00169 
00170                                       // usb_user_serial_number
00171 #if (USB_DEVICE_SN_USE==ENABLE)
00172 code S_usb_serial_number usb_user_serial_number = {
00173 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00174   sizeof(usb_user_serial_number)+4*SN_LENGTH
00175 , DESCRIPTOR_STRING
00176 #else
00177 sizeof(usb_user_serial_number)
00178 , DESCRIPTOR_STRING
00179 , USB_SERIAL_NUMBER
00180 #endif
00181 };
00182 #endif
00183 
00184                                       // usb_user_language_id
00185 
00186 code S_usb_language_id usb_user_language_id = {
00187   sizeof(usb_user_language_id)
00188 , DESCRIPTOR_STRING
00189 , Usb_write_word_enum_struc(LANGUAGE_ID)
00190 };
00191 

Generated on Fri Sep 11 15:02:35 2009 for ATMEL by  doxygen 1.5.3