/*********************************************************************************** Filename: usb_hid_descriptor.s51 Description: USB descriptor for HID-devices. ***********************************************************************************/ #define ASM_FILE #include "../library/usb_descriptor.h" MODULE usb_descriptor RSEG RCODE PUBLIC usbDescStart; PUBLIC usbDescEnd; PUBLIC deviceDesc; PUBLIC configDesc; PUBLIC interface0Desc; PUBLIC endpoint0Desc; PUBLIC endpoint1Desc; PUBLIC hid0Desc; PUBLIC entity0Desc; PUBLIC entity0DescEnd; PUBLIC string0Desc; PUBLIC string1Desc; PUBLIC string2Desc; PUBLIC string3Desc; PUBLIC usbDescLut; PUBLIC usbDescLutEnd; PUBLIC usbDblbufLut; PUBLIC usbDblbufLutEnd; ;;------------------------------------------------------------------------------------------------------- ;; USB descriptors usbDescStart: deviceDesc: ; Device descriptor DB deviceDescEnd - deviceDesc ; bLength DB DESC_TYPE_DEVICE ; bDescriptorType DW 0200H ; bcdUSB (USB 2.0) DB 00H ; bDeviceClass (given by interface) DB 00H ; bDeviceSubClass DB 00H ; bDeviceProtocol DB EP0_PACKET_SIZE DW 0451H ; idVendor (Texas Instruments) DW 16B4H ; idProduct (CC2540 HID) DW 0100H ; bcdDevice (v1.0) DB 01H ; iManufacturer DB 02H ; iProduct DB 03H ; iSerialNumber DB 01H ; bNumConfigurations deviceDescEnd: config1LengthStart: configDesc: ; Configuration descriptor DB configDescEnd - configDesc ; bLength DB DESC_TYPE_CONFIG ; bDescriptorType DW config1LengthEnd - config1LengthStart ; wTotalLength DB 01H ; bNumInterfaces DB 01H ; bConfigurationValue DB 00H ; iConfiguration DB 0xA0 ; bmAttributes (bit 5 remote wakeup) DB 25 ; bMaxPower (max 2 * 25 = 50 mA) configDescEnd: interface0Desc: ; Keyboard interface descriptor DB interface0DescEnd - interface0Desc ; bLength DB DESC_TYPE_INTERFACE ; bDescriptorType DB 00H ; bInterfaceNumber DB 00H ; bAlternateSetting (none) DB 02H ; bNumEndpoints DB 03H ; bInterfaceClass (HID) DB 00H ; bInterfaceSubClass (Boot) DB 00H ; bInterfaceProcotol (none) DB 00H ; iInterface interface0DescEnd: hid0Desc: ; Keyboard HID descriptor DB hid0DescEnd - hid0Desc ; bLength DB DESC_TYPE_HID ; bDescriptorType DW 0111H ; bcdHID (HID v1.11) DB 00H ; bCountryCode (not localized) DB 01H ; bNumDescriptors DB DESC_TYPE_HIDREPORT ; bDescriptorType DW entity0DescEnd - entity0Desc ; wDescriptorLength hid0DescEnd: endpoint0Desc: ; Keyboard endpoint descriptor (EP4 IN) DB endpoint0DescEnd - endpoint0Desc ; bLength DB DESC_TYPE_ENDPOINT ; bDescriptorType DB 84H ; bEndpointAddress DB EP_ATTR_BULK ; bmAttributes (INT) DB 40H, 00H ; wMaxPacketSize DB 0AH ; bInterval (10 full-speed frames = 10 ms) endpoint0DescEnd: endpoint1Desc: ; Keyboard endpoint descriptor (EP4 OUT) DB endpoint1DescEnd - endpoint1Desc DB DESC_TYPE_ENDPOINT ; bDescriptorType DB 04H ; bEndpointAddress DB EP_ATTR_BULK ; bmAttributes (INT) DB 40H, 00H ; wMaxPacketSize DB 0AH ; bInterval endpoint1DescEnd: config1LengthEnd: ;;------------------------------------------------------------------------------------------------------- ;;------------------------------------------------------------------------------------------------------- ;; String descriptors string0Desc: ; Language ID DB string0DescEnd - string0Desc ; bLength DB DESC_TYPE_STRING ; bDescriptorType DW 0409H ; wLangID (English-US) string0DescEnd: string1Desc: ; Manufacturer DB string1DescEnd - string1Desc ; bLength DB DESC_TYPE_STRING ; bDescriptorType DB 'T', 0 ; unicode string DB 'e', 0 DB 'x', 0 DB 'a', 0 DB 's', 0 DB ' ', 0 DB 'I', 0 DB 'n', 0 DB 's', 0 DB 't', 0 DB 'r', 0 DB 'u', 0 DB 'm', 0 DB 'e', 0 DB 'n', 0 DB 't', 0 DB 's', 0 string1DescEnd: string2Desc: ; Product DB string2DescEnd - string2Desc ; bLength DB DESC_TYPE_STRING ; bDescriptorType DB 'U', 0 ; unicode string DB 'S', 0 DB 'B', 0 DB ' ', 0 DB 'C', 0 DB 'C', 0 DB '2', 0 DB '5', 0 DB '4', 0 DB '0', 0 DB ' ', 0 DB 'H', 0 DB 'I', 0 DB 'D', 0 string2DescEnd: ; To enable multiple HID dongles to connect to a PC, ; program a unique serial number for each dongle. string3Desc: ; Serial Number DB string3DescEnd - string3Desc DB DESC_TYPE_STRING ; bDescriptorType DB '0', 0 DB '0', 0 DB '1', 0 string3DescEnd: usbDescEnd: ;;------------------------------------------------------------------------------------------------------- ;;------------------------------------------------------------------------------------------------------- ;; HID report descriptors entity0Desc: ; Keyboard report descriptor (using format for Boot interface descriptor) DB 0005H, 0008H ; Usage Pg (LED Page) DB 0009H, 0001H ; Usage (NUM Lock) DB 00A1H, 0001H ; Collection: (Application) DB 0095H, 0040H ; Report Count (64) DB 0075H, 0008H ; Report Size (8) DB 0015H, 0000H ; Log Min (0) DB 0025H, 00FFH ; Log Max (255) DB 0081H, 0003H ; Input: (Data, Variable, Absolute) DB 0095H, 0040H ; Report Count (64) DB 0075H, 0008H ; Report Size (8) DB 0015H, 0000H ; Log Min (0) DB 0025H, 00FFH ; Log Max (255) DB 0009H, 0001H ; Usage (NUM Lock) DB 0091H, 0003H ; Output: (Data, Variable, Absolute) DB 0095H, 0010H ; Report Count (16) DB 0075H, 0008H ; Report Size (8) DB 0009H, 0001H ; Usage (NUM Lock) DB 00B1H, 0002H ; HID Feature DB 00C0H ; End Collection entity0DescEnd: ;;------------------------------------------------------------------------------------------------------- ;;------------------------------------------------------------------------------------------------------- ;; Look-up table for descriptors that are not returned through requests for DSC_DEVICE, DSC_CONFIG or ;; DSC_STRING (e.g. HID report descriptors) usbDescLut: DB DESC_TYPE_HIDREPORT, 00H ; value (MSB:LSB) DB 00H, 00H ; index (MSB:LSB) DW entity0Desc ; pDesc DW entity0DescEnd - entity0Desc ; length DB DESC_TYPE_HID, 00H ; value (MSB:LSB) DB 00H, 00H ; index (MSB:LSB) DW hid0Desc ; pDesc DW hid0DescEnd - hid0Desc ; length usbDescLutEnd: ;;------------------------------------------------------------------------------------------------------- ;;------------------------------------------------------------------------------------------------------- ;; Look-up table for double buffer settings (one set of bit masks for each defined interface) usbDblbufLut: DW interface0Desc ; pInterface DB 00H ; inMask DB 00H ; outMask usbDblbufLutEnd: ;;------------------------------------------------------------------------------------------------------- END; /* +------------------------------------------------------------------------------ | Copyright 2004-2013 Texas Instruments Incorporated. All rights reserved. | | IMPORTANT: Your use of this Software is limited to those specific rights | granted under the terms of a software license agreement between the user who | downloaded the software, his/her employer (which must be your employer) and | Texas Instruments Incorporated (the "License"). You may not use this Software | unless you agree to abide by the terms of the License. The License limits | your use, and you acknowledge, that the Software may not be modified, copied | or distributed unless embedded on a Texas Instruments microcontroller or used | solely and exclusively in conjunction with a Texas Instruments radio | frequency transceiver, which is integrated into your product. Other than for | the foregoing purpose, you may not use, reproduce, copy, prepare derivative | works of, modify, distribute, perform, display or sell this Software and/or | its documentation for any purpose. | | YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE | PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, | INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, | NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL | TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, | NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER | LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING | BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR | CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF | SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES | (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. | | Should you have any questions regarding your right to use this Software, | contact Texas Instruments Incorporated at www.TI.com. | +------------------------------------------------------------------------------ |The default USB descriptor defines a minimum configuration, with no endpoints |apart from EP0. The application can define 3 IN and OUT endpoints, and override |the configuration and interface descriptor (only one of each). |The device and string descriptors are locked. +------------------------------------------------------------------------------*/