SAMV71 Xplained Ultra Software Package 1.4

USBDDriverDescriptors.c

Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2011, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
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     /* Configuration descriptor */
00108     {
00109         sizeof(USBConfigurationDescriptor),
00110         USBGenericDescriptor_CONFIGURATION,
00111         sizeof(HIDDMouseDriverConfigurationDescriptors),
00112         1, /* One interface in this configuration */
00113         1, /* This is configuration #1 */
00114         0, /* No associated string descriptor */
00115         USBD_BMATTRIBUTES,
00116         USBConfigurationDescriptor_POWER(100)
00117     },
00118     /* Interface descriptor */
00119     {
00120         sizeof(USBInterfaceDescriptor),
00121         USBGenericDescriptor_INTERFACE,
00122         0, /* This is interface #0 */
00123         0, /* This is alternate setting #0 */
00124         1, /* One endpoints used */
00125         HIDInterfaceDescriptor_CLASS,
00126         HIDInterfaceDescriptor_SUBCLASS_NONE,
00127         HIDInterfaceDescriptor_PROTOCOL_MOUSE,
00128         0  /* No associated string descriptor */
00129     },
00130     /* HID descriptor */
00131     {
00132         sizeof(HIDDescriptor1),
00133         HIDGenericDescriptor_HID,
00134         HIDDescriptor_HID1_11,
00135         0, /* Device is not localized, no country code */
00136         1, /* One HID-specific descriptor (apart from this one) */
00137         HIDGenericDescriptor_REPORT,
00138         {HIDDMouseDriver_REPORTDESCRIPTORSIZE}
00139     },
00140     /* Interrupt IN endpoint descriptor */
00141     {
00142         sizeof(USBEndpointDescriptor),
00143         USBGenericDescriptor_ENDPOINT,
00144         USBEndpointDescriptor_ADDRESS(
00145             USBEndpointDescriptor_IN,
00146             HIDDMouseDriverDescriptors_INTERRUPTIN),
00147         USBEndpointDescriptor_INTERRUPT,
00148         sizeof(HIDDMouseInputReport),
00149         HIDDMouseDriverDescriptors_INTERRUPTIN_POLLING
00150     }
00151 };
00152 
00153 /**
00154  *   Variables: String descriptors
00155  *       languageIdDescriptor - Language ID string descriptor.
00156  *       manufacturerDescriptor - Manufacturer name.
00157  *       productDescriptor - Product name.
00158  *       serialNumberDescriptor - Product serial number.
00159  *       stringDescriptors - Array of pointers to string descriptors.
00160  */
00161 static const unsigned char languageIdDescriptor[] = {
00162 
00163     USBStringDescriptor_LENGTH(1),
00164     USBGenericDescriptor_STRING,
00165     USBStringDescriptor_ENGLISH_US
00166 };
00167 
00168 static const unsigned char manufacturerDescriptor[] = {
00169 
00170     USBStringDescriptor_LENGTH(5),
00171     USBGenericDescriptor_STRING,
00172     USBStringDescriptor_UNICODE('A'),
00173     USBStringDescriptor_UNICODE('T'),
00174     USBStringDescriptor_UNICODE('M'),
00175     USBStringDescriptor_UNICODE('E'),
00176     USBStringDescriptor_UNICODE('L')
00177 };
00178 
00179 static const unsigned char productDescriptor[] = {
00180 
00181     USBStringDescriptor_LENGTH(19),
00182     USBGenericDescriptor_STRING,
00183     USBStringDescriptor_UNICODE('A'),
00184     USBStringDescriptor_UNICODE('T'),
00185     USBStringDescriptor_UNICODE('M'),
00186     USBStringDescriptor_UNICODE('E'),
00187     USBStringDescriptor_UNICODE('L'),
00188     USBStringDescriptor_UNICODE(' '),
00189     USBStringDescriptor_UNICODE('A'),
00190     USBStringDescriptor_UNICODE('T'),
00191     USBStringDescriptor_UNICODE('9'),
00192     USBStringDescriptor_UNICODE('1'),
00193     USBStringDescriptor_UNICODE(' '),
00194     USBStringDescriptor_UNICODE('H'),
00195     USBStringDescriptor_UNICODE('I'),
00196     USBStringDescriptor_UNICODE('D'),
00197     USBStringDescriptor_UNICODE(' '),
00198     USBStringDescriptor_UNICODE('M'),
00199     USBStringDescriptor_UNICODE('O'),
00200     USBStringDescriptor_UNICODE('U'),
00201     USBStringDescriptor_UNICODE('S'),
00202     USBStringDescriptor_UNICODE('E'),
00203 };
00204 
00205 static const unsigned char serialNumberDescriptor[] = {
00206 
00207     USBStringDescriptor_LENGTH(12),
00208     USBGenericDescriptor_STRING,
00209     USBStringDescriptor_UNICODE('0'),
00210     USBStringDescriptor_UNICODE('1'),
00211     USBStringDescriptor_UNICODE('2'),
00212     USBStringDescriptor_UNICODE('3'),
00213     USBStringDescriptor_UNICODE('4'),
00214     USBStringDescriptor_UNICODE('5'),
00215     USBStringDescriptor_UNICODE('6'),
00216     USBStringDescriptor_UNICODE('7'),
00217     USBStringDescriptor_UNICODE('8'),
00218     USBStringDescriptor_UNICODE('9'),
00219     USBStringDescriptor_UNICODE('A'),
00220     USBStringDescriptor_UNICODE('F')
00221 };
00222 
00223 static const unsigned char *stringDescriptors[] = {
00224 
00225     languageIdDescriptor,
00226     manufacturerDescriptor,
00227     productDescriptor,
00228     serialNumberDescriptor
00229 };
00230 
00231 /*--------------------------------------------------------------------------- */
00232 /*         Exported variables */
00233 /*--------------------------------------------------------------------------- */
00234 
00235 /** List of descriptors used by the HID keyboard driver. */
00236 USBDDriverDescriptors hiddMouseDriverDescriptors = {
00237 
00238     &deviceDescriptor,
00239     (USBConfigurationDescriptor *) &configurationDescriptors,
00240     &qualifierDescriptor,
00241     0, /* No full-speed other speed configuration */
00242     0, /* No high-speed device descriptor (uses FS one) */
00243     0, /* No high-speed configuration descriptor (uses FS one) */
00244     &qualifierDescriptor,
00245     0, /* No high-speed other speed configuration descriptor */
00246     stringDescriptors,
00247     4 /* Four string descriptors in list */
00248 };
00249 
00250 /**@}*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines