SAMV71 Xplained Ultra Software Package 1.5

USBDDriverDescriptors.c

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /**\file
00031  * Declaration of the descriptors used by the HID device keyboard driver.
00032  */
00033 
00034 /** \addtogroup usbd_hid_mouse
00035  *@{
00036  */
00037 
00038 /*------------------------------------------------------------------------------
00039  *         Headers
00040  *----------------------------------------------------------------------------*/
00041 
00042 #include <USBD_Config.h>
00043 
00044 #include <HIDDMouseDriver.h>
00045 
00046 /*------------------------------------------------------------------------------
00047  *         Definitions
00048  *----------------------------------------------------------------------------*/
00049 
00050 /** \addtogroup usbd_hid_mouse_id
00051  *      @{
00052  *
00053  * \section IDs
00054  * - HIDDMouseDriverDescriptors_PRODUCTID
00055  * - HIDDMouseDriverDescriptors_VENDORID
00056  * - HIDDMouseDriverDescriptors_RELEASE
00057  */
00058 
00059 /** Device product ID. */
00060 #define HIDDMouseDriverDescriptors_PRODUCTID       USBD_PID_HIDMOUSE
00061 /** Device vendor ID. */
00062 #define HIDDMouseDriverDescriptors_VENDORID        USBD_VID_ATMEL
00063 /** Device release number. */
00064 #define HIDDMouseDriverDescriptors_RELEASE         USBD_RELEASE_1_00
00065 /**      @}*/
00066 
00067 /*------------------------------------------------------------------------------
00068  *         Internal variables
00069  *----------------------------------------------------------------------------*/
00070 
00071 /** Device descriptor. */
00072 static const USBDeviceDescriptor deviceDescriptor = {
00073 
00074     sizeof(USBDeviceDescriptor),
00075     USBGenericDescriptor_DEVICE,
00076     USBDeviceDescriptor_USB2_00,
00077     HIDDeviceDescriptor_CLASS,
00078     HIDDeviceDescriptor_SUBCLASS,
00079     HIDDeviceDescriptor_PROTOCOL,
00080     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00081     HIDDMouseDriverDescriptors_VENDORID,
00082     HIDDMouseDriverDescriptors_PRODUCTID,
00083     HIDDMouseDriverDescriptors_RELEASE,
00084     1, /* Index of manufacturer description */
00085     2, /* Index of product description */
00086     3, /* Index of serial number description */
00087     1  /* One possible configuration */
00088 };
00089 
00090 /** Device qualifier descriptor (Necessary to pass USB test). */
00091 static const USBDeviceQualifierDescriptor qualifierDescriptor = {
00092 
00093     sizeof(USBDeviceQualifierDescriptor),
00094     USBGenericDescriptor_DEVICEQUALIFIER,
00095     USBDeviceDescriptor_USB2_00,
00096     HIDDeviceDescriptor_CLASS,
00097     HIDDeviceDescriptor_SUBCLASS,
00098     HIDDeviceDescriptor_PROTOCOL,
00099     CHIP_USB_ENDPOINTS_MAXPACKETSIZE(0),
00100     0, // Device has one possible configuration.
00101     0x00
00102 };
00103 
00104 /** Configuration descriptor. */
00105 static const HIDDMouseDriverConfigurationDescriptors configurationDescriptors
00106 = {
00107 
00108     /* Configuration descriptor */
00109     {
00110         sizeof(USBConfigurationDescriptor),
00111         USBGenericDescriptor_CONFIGURATION,
00112         sizeof(HIDDMouseDriverConfigurationDescriptors),
00113         1, /* One interface in this configuration */
00114         1, /* This is configuration #1 */
00115         0, /* No associated string descriptor */
00116         USBD_BMATTRIBUTES,
00117         USBConfigurationDescriptor_POWER(100)
00118     },
00119     /* Interface descriptor */
00120     {
00121         sizeof(USBInterfaceDescriptor),
00122         USBGenericDescriptor_INTERFACE,
00123         0, /* This is interface #0 */
00124         0, /* This is alternate setting #0 */
00125         1, /* One endpoints used */
00126         HIDInterfaceDescriptor_CLASS,
00127         HIDInterfaceDescriptor_SUBCLASS_NONE,
00128         HIDInterfaceDescriptor_PROTOCOL_MOUSE,
00129         0  /* No associated string descriptor */
00130     },
00131     /* HID descriptor */
00132     {
00133         sizeof(HIDDescriptor1),
00134         HIDGenericDescriptor_HID,
00135         HIDDescriptor_HID1_11,
00136         0, /* Device is not localized, no country code */
00137         1, /* One HID-specific descriptor (apart from this one) */
00138         HIDGenericDescriptor_REPORT,
00139         {HIDDMouseDriver_REPORTDESCRIPTORSIZE}
00140     },
00141     /* Interrupt IN endpoint descriptor */
00142     {
00143         sizeof(USBEndpointDescriptor),
00144         USBGenericDescriptor_ENDPOINT,
00145         USBEndpointDescriptor_ADDRESS(
00146             USBEndpointDescriptor_IN,
00147             HIDDMouseDriverDescriptors_INTERRUPTIN),
00148         USBEndpointDescriptor_INTERRUPT,
00149         sizeof(HIDDMouseInputReport),
00150         HIDDMouseDriverDescriptors_INTERRUPTIN_POLLING
00151     }
00152 };
00153 
00154 /**
00155  *   Variables: String descriptors
00156  *       languageIdDescriptor - Language ID string descriptor.
00157  *       manufacturerDescriptor - Manufacturer name.
00158  *       productDescriptor - Product name.
00159  *       serialNumberDescriptor - Product serial number.
00160  *       stringDescriptors - Array of pointers to string descriptors.
00161  */
00162 static const unsigned char languageIdDescriptor[] = {
00163 
00164     USBStringDescriptor_LENGTH(1),
00165     USBGenericDescriptor_STRING,
00166     USBStringDescriptor_ENGLISH_US
00167 };
00168 
00169 static const unsigned char manufacturerDescriptor[] = {
00170 
00171     USBStringDescriptor_LENGTH(5),
00172     USBGenericDescriptor_STRING,
00173     USBStringDescriptor_UNICODE('A'),
00174     USBStringDescriptor_UNICODE('T'),
00175     USBStringDescriptor_UNICODE('M'),
00176     USBStringDescriptor_UNICODE('E'),
00177     USBStringDescriptor_UNICODE('L')
00178 };
00179 
00180 static const unsigned char productDescriptor[] = {
00181 
00182     USBStringDescriptor_LENGTH(19),
00183     USBGenericDescriptor_STRING,
00184     USBStringDescriptor_UNICODE('A'),
00185     USBStringDescriptor_UNICODE('T'),
00186     USBStringDescriptor_UNICODE('M'),
00187     USBStringDescriptor_UNICODE('E'),
00188     USBStringDescriptor_UNICODE('L'),
00189     USBStringDescriptor_UNICODE(' '),
00190     USBStringDescriptor_UNICODE('A'),
00191     USBStringDescriptor_UNICODE('T'),
00192     USBStringDescriptor_UNICODE('9'),
00193     USBStringDescriptor_UNICODE('1'),
00194     USBStringDescriptor_UNICODE(' '),
00195     USBStringDescriptor_UNICODE('H'),
00196     USBStringDescriptor_UNICODE('I'),
00197     USBStringDescriptor_UNICODE('D'),
00198     USBStringDescriptor_UNICODE(' '),
00199     USBStringDescriptor_UNICODE('M'),
00200     USBStringDescriptor_UNICODE('O'),
00201     USBStringDescriptor_UNICODE('U'),
00202     USBStringDescriptor_UNICODE('S'),
00203     USBStringDescriptor_UNICODE('E'),
00204 };
00205 
00206 static const unsigned char serialNumberDescriptor[] = {
00207 
00208     USBStringDescriptor_LENGTH(12),
00209     USBGenericDescriptor_STRING,
00210     USBStringDescriptor_UNICODE('0'),
00211     USBStringDescriptor_UNICODE('1'),
00212     USBStringDescriptor_UNICODE('2'),
00213     USBStringDescriptor_UNICODE('3'),
00214     USBStringDescriptor_UNICODE('4'),
00215     USBStringDescriptor_UNICODE('5'),
00216     USBStringDescriptor_UNICODE('6'),
00217     USBStringDescriptor_UNICODE('7'),
00218     USBStringDescriptor_UNICODE('8'),
00219     USBStringDescriptor_UNICODE('9'),
00220     USBStringDescriptor_UNICODE('A'),
00221     USBStringDescriptor_UNICODE('F')
00222 };
00223 
00224 static const unsigned char *stringDescriptors[] = {
00225 
00226     languageIdDescriptor,
00227     manufacturerDescriptor,
00228     productDescriptor,
00229     serialNumberDescriptor
00230 };
00231 
00232 /*--------------------------------------------------------------------------- */
00233 /*         Exported variables */
00234 /*--------------------------------------------------------------------------- */
00235 
00236 /** List of descriptors used by the HID keyboard driver. */
00237 USBDDriverDescriptors hiddMouseDriverDescriptors = {
00238 
00239     &deviceDescriptor,
00240     (USBConfigurationDescriptor *) &configurationDescriptors,
00241     &qualifierDescriptor,
00242     0, /* No full-speed other speed configuration */
00243     0, /* No high-speed device descriptor (uses FS one) */
00244     0, /* No high-speed configuration descriptor (uses FS one) */
00245     &qualifierDescriptor,
00246     0, /* No high-speed other speed configuration descriptor */
00247     stringDescriptors,
00248     4 /* Four string descriptors in list */
00249 };
00250 
00251 /**@}*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines