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(usb_conf_desc))
00089  , NB_INTERFACE
00090  , CONF_NB
00091  , CONF_INDEX
00092  , CONF_ATTRIBUTES
00093  , MAX_POWER
00094  }
00095  ,
00096  { sizeof(S_usb_interface_descriptor)
00097  , DESCRIPTOR_INTERFACE
00098  , INTERFACE_NB
00099  , ALTERNATE
00100  , NB_ENDPOINT
00101  , INTERFACE_CLASS
00102  , INTERFACE_SUB_CLASS
00103  , INTERFACE_PROTOCOL
00104  , INTERFACE_INDEX
00105  }
00106  ,
00107  { sizeof(S_usb_endpoint_descriptor)
00108  , DESCRIPTOR_ENDPOINT
00109  , ENDPOINT_NB_1
00110  , EP_ATTRIBUTES_1
00111  , Usb_write_word_enum_struc(EP_SIZE_1)
00112  , EP_INTERVAL_1
00113  }
00114  ,
00115  { sizeof(S_usb_endpoint_descriptor)
00116  , DESCRIPTOR_ENDPOINT
00117  , ENDPOINT_NB_2
00118  , EP_ATTRIBUTES_2
00119  , Usb_write_word_enum_struc(EP_SIZE_2)
00120  , EP_INTERVAL_2
00121  }
00122 
00123 
00124 };
00125 
00126 
00127 
00128                                       // usb_user_manufacturer_string_descriptor
00129 code S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor = {
00130   sizeof(usb_user_manufacturer_string_descriptor)
00131 , DESCRIPTOR_STRING
00132 , USB_MANUFACTURER_NAME
00133 };
00134 
00135 
00136                                       // usb_user_product_string_descriptor
00137 
00138 code S_usb_product_string_descriptor usb_user_product_string_descriptor = {
00139   sizeof(usb_user_product_string_descriptor)
00140 , DESCRIPTOR_STRING
00141 , USB_PRODUCT_NAME
00142 };
00143 
00144 
00145                                       // usb_user_serial_number
00146 #if (USB_DEVICE_SN_USE==ENABLE)
00147 code S_usb_serial_number usb_user_serial_number = {
00148 #if (USE_DEVICE_SN_UNIQUE==ENABLE)
00149   sizeof(usb_user_serial_number)+4*SN_LENGTH
00150 , DESCRIPTOR_STRING
00151 #else
00152 sizeof(usb_user_serial_number)
00153 , DESCRIPTOR_STRING
00154 , USB_SERIAL_NUMBER
00155 #endif
00156 };
00157 #endif
00158 
00159                                       // usb_user_language_id
00160 
00161 code S_usb_language_id usb_user_language_id = {
00162   sizeof(usb_user_language_id)
00163 , DESCRIPTOR_STRING
00164 , Usb_write_word_enum_struc(LANGUAGE_ID)
00165 };
00166 
00167 
00168 

Generated on Fri Oct 31 16:13:16 2008 for ATMEL by  doxygen 1.5.3