⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f3xx_usb0_descriptor.lst

📁 基于344单片机的HID设备的USB鼠标代码
💻 LST
字号:
C51 COMPILER V8.05a   F3XX_USB0_DESCRIPTOR                                                 10/16/2008 16:50:25 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE F3XX_USB0_DESCRIPTOR
OBJECT MODULE PLACED IN F3xx_USB0_Descriptor.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\c51.exe F3xx_USB0_Descriptor.c DB OE

line level    source

   1          //-----------------------------------------------------------------------------
   2          // F3xx_USB0_Descriptor.c
   3          //-----------------------------------------------------------------------------
   4          // Copyright 2005 Silicon Laboratories, Inc.
   5          // http://www.silabs.com
   6          //
   7          // Program Description:
   8          //
   9          // Source file for USB firmware. Includes descriptor data.
  10          //
  11          //
  12          // How To Test:    See Readme.txt
  13          //
  14          //
  15          // FID
  16          // Target:         C8051F32x/C8051F340
  17          // Tool chain:     Keil C51 7.50 / Keil EVAL C51
  18          //                 Silicon Laboratories IDE version 2.6
  19          // Command Line:   See Readme.txt
  20          // Project Name:   F3xx_MouseExample
  21          //
  22          //
  23          // Release 1.1
  24          //    -Minor code comment changes
  25          //    -16 NOV 2006
  26          // Release 1.0
  27          //    -Initial Revision (PD)
  28          //    -07 DEC 2005
  29          //
  30          //-----------------------------------------------------------------------------
  31          // Includes
  32          //-----------------------------------------------------------------------------
  33          #include "F3xx_USB0_Register.h"
  34          #include "F3xx_USB0_InterruptServiceRoutine.h"
  35          #include "F3xx_USB0_Descriptor.h"
  36          
  37          //-----------------------------------------------------------------------------
  38          // Descriptor Declarations
  39          //-----------------------------------------------------------------------------
  40          
  41          const device_descriptor code DEVICEDESC =
  42          {
  43             18,                                 // bLength
  44             0x01,                               // bDescriptorType
  45             0x1001,                             // bcdUSB
  46             0x00,                               // bDeviceClass
  47             0x00,                               // bDeviceSubClass
  48             0x00,                               // bDeviceProtocol
  49             EP0_PACKET_SIZE,                    // bMaxPacketSize0
  50             0xC410,                             // idVendor
  51             0xB981,                             // idProduct
  52             0x0000,                             // bcdDevice
  53             0x01,                               // iManufacturer
  54             0x02,                               // iProduct
  55             0x00,                               // iSerialNumber
C51 COMPILER V8.05a   F3XX_USB0_DESCRIPTOR                                                 10/16/2008 16:50:25 PAGE 2   

  56             0x01                                // bNumConfigurations
  57          }; //end of DEVICEDESC
  58          
  59          // From "USB Device Class Definition for Human Interface Devices (HID)".
  60          // Section 7.1:
  61          // "When a Get_Descriptor(Configuration) request is issued,
  62          // it returns the Configuration descriptor, all Interface descriptors,
  63          // all Endpoint descriptors, and the HID descriptor for each interface."
  64          const hid_configuration_descriptor code HIDCONFIGDESC =
  65          {
  66          
  67          { // configuration_descriptor hid_configuration_descriptor
  68             0x09,                               // Length
  69             0x02,                               // Type
  70             0x2200,                             // Totallength (= 9+9+9+7)
  71             0x01,                               // NumInterfaces
  72             0x01,                               // bConfigurationValue
  73             0x00,                               // iConfiguration
  74             0x80,                               // bmAttributes
  75             0x20                                // MaxPower (in 2mA units)
  76          },
  77          
  78          { // interface_descriptor hid_interface_descriptor
  79             0x09,                               // bLength
  80             0x04,                               // bDescriptorType
  81             0x00,                               // bInterfaceNumber
  82             0x00,                               // bAlternateSetting
  83             0x01,                               // bNumEndpoints
  84             0x03,                               // bInterfaceClass (3 = HID)
  85             0x01,                               // bInterfaceSubClass
  86             0x02,                               // bInterfaceProcotol
  87             0x00                                // iInterface
  88          },
  89          
  90          { // class_descriptor hid_descriptor
  91                  0x09,                                 // bLength
  92                  0x21,                                 // bDescriptorType
  93                  0x0101,                            // bcdHID
  94                  0x00,                                 // bCountryCode
  95                  0x01,                                 // bNumDescriptors
  96                  0x22,                               // bDescriptorType
  97                  HID_REPORT_DESCRIPTOR_SIZE_LE       // wItemLength (tot. len. of report
  98                                                 // descriptor)
  99          },
 100          
 101          // IN endpoint (mandatory for HID)
 102          { // endpoint_descriptor hid_endpoint_in_descriptor
 103             0x07,                               // bLength
 104             0x05,                               // bDescriptorType
 105             0x81,                               // bEndpointAddress
 106             0x03,                               // bmAttributes
 107             EP1_PACKET_SIZE_LE,                 // MaxPacketSize (LITTLE ENDIAN)
 108             10                                  // bInterval
 109          },
 110          
 111          // OUT endpoint (optional for HID)
 112          { // endpoint_descriptor hid_endpoint_out_descriptor
 113             0x07,                               // bLength
 114             0x05,                               // bDescriptorType
 115             0x01,                               // bEndpointAddress
 116             0x03,                               // bmAttributes
 117             EP2_PACKET_SIZE_LE,                 // MaxPacketSize (LITTLE ENDIAN)
C51 COMPILER V8.05a   F3XX_USB0_DESCRIPTOR                                                 10/16/2008 16:50:25 PAGE 3   

 118             10                                  // bInterval
 119          }
 120          
 121          };
 122          
 123          const hid_report_descriptor code HIDREPORTDESC =
 124          {
 125              0x05, 0x01,                        // Usage Page (Generic Desktop)
 126              0x09, 0x02,                        // Usage (Mouse)
 127              0xA1, 0x01,                        // Collection (Application)
 128              0x09, 0x01,                        //   Usage (Pointer)
 129              0xA1, 0x00,                        //   Collection (Physical)
 130              0x05, 0x09,                        //     Usage Page (Buttons)
 131              0x19, 0x01,                        //     Usage Minimum (01)
 132              0x29, 0x01,                        //     Usage Maximum (01)
 133              0x15, 0x00,                        //     Logical Minimum (0)
 134              0x25, 0x01,                        //     Logical Maximum (1)
 135              0x95, 0x01,                        //     Report Count (1)
 136              0x75, 0x01,                        //     Report Size (1)
 137              0x81, 0x02,                        //     Input (Data, Variable, Absolute)
 138              0x95, 0x01,                        //     Report Count (1)
 139              0x75, 0x07,                        //     Report Size (7)
 140              0x81, 0x01,                        //     Input (Constant) for padding
 141              0x05, 0x01,                        //     Usage Page (Generic Desktop)
 142              0x09, 0x30,                        //     Usage (X)
 143              0x09, 0x31,                        //     Usage (Y)
 144              0x15, 0x81,                        //     Logical Minimum (-127)
 145              0x25, 0x7F,                        //     Logical Maximum (127)
 146              0x75, 0x08,                        //     Report Size (8)
 147              0x95, 0x02,                        //     Report Count (2)
 148              0x81, 0x06,                        //     Input (Data, Variable, Relative)
 149              0xC0,                              //   End Collection (Physical)
 150              0xC0                               // End Collection (Application)
 151          };
 152          
 153          #define STR0LEN 4
 154          
 155          code const unsigned char String0Desc [STR0LEN] =
 156          {
 157             STR0LEN, 0x03, 0x09, 0x04
 158          }; //end of String0Desc
 159          
 160          #define STR1LEN sizeof ("SILICON LABORATORIES") * 2
 161          
 162          code const unsigned char String1Desc [STR1LEN] =
 163          {
 164             STR1LEN, 0x03,
 165             'S', 0,
 166             'I', 0,
 167             'L', 0,
 168             'I', 0,
 169             'C', 0,
 170             'O', 0,
 171             'N', 0,
 172             ' ', 0,
 173             'L', 0,
 174             'A', 0,
 175             'B', 0,
 176             'O', 0,
 177             'R', 0,
 178             'A', 0,
 179             'T', 0,
C51 COMPILER V8.05a   F3XX_USB0_DESCRIPTOR                                                 10/16/2008 16:50:25 PAGE 4   

 180             'O', 0,
 181             'R', 0,
 182             'I', 0,
 183             'E', 0,
 184             'S', 0
 185          }; //end of String1Desc
 186          
 187          #define STR2LEN sizeof ("C8051F320 Development Board") * 2
 188          
 189          code const unsigned char String2Desc [STR2LEN] =
 190          {
 191             STR2LEN, 0x03,
 192             'C', 0,
 193             '8', 0,
 194             '0', 0,
 195             '5', 0,
 196             '1', 0,
 197             'F', 0,
 198             '3', 0,
 199             'x', 0,
 200             'x', 0,
 201             ' ', 0,
 202             'D', 0,
 203             'e', 0,
 204             'v', 0,
 205             'e', 0,
 206             'l', 0,
 207             'o', 0,
 208             'p', 0,
 209             'm', 0,
 210             'e', 0,
 211             'n', 0,
 212             't', 0,
 213             ' ', 0,
 214             'B', 0,
 215             'o', 0,
 216             'a', 0,
 217             'r', 0,
 218             'd', 0
 219          }; //end of String2Desc
 220          
 221          unsigned char* const STRINGDESCTABLE [] =
 222          {
 223             String0Desc,
 224             String1Desc,
 225             String2Desc
 226          };


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   ----    ----
   CONSTANT SIZE    =    211    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      9    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -