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

📄 f3xx_usb0_descriptor.lst

📁 利用51单片机做的USB 应用实例
💻 LST
字号:
C51 COMPILER V8.02   F3XX_USB0_DESCRIPTOR                                                  06/27/2007 22:26:26 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE F3XX_USB0_DESCRIPTOR
OBJECT MODULE PLACED IN F3xx_USB0_Descriptor.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE F3xx_USB0_Descriptor.c COMPACT BROWSE DEBUG OBJECTEXTEND

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:            3XX000031
  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.3
  24          //    - Changes by PD, GP
  25          //    - Modified Descriptors
  26          //    - Changed name from USB_Descriptor.c
  27          //    - 07 December 2005
  28          // Release 1.0
  29          //    -Initial Revision (DM)
  30          //    -22 NOV 2002
  31          //
  32          //-----------------------------------------------------------------------------
  33          // Includes
  34          //-----------------------------------------------------------------------------
  35          #include "F3xx_USB0_Register.h"
  36          #include "F3xx_USB0_InterruptServiceRoutine.h"
  37          #include "F3xx_USB0_Descriptor.h"
  38          
  39          //-----------------------------------------------------------------------------
  40          // Descriptor Declarations
  41          //-----------------------------------------------------------------------------
  42          
  43          const device_descriptor DEVICEDESC =
  44          {
  45             18,                                 // bLength
  46             0x01,                               // bDescriptorType
  47             0x1001,                             // bcdUSB
  48             0x00,                               // bDeviceClass
  49             0x00,                               // bDeviceSubClass
  50             0x00,                               // bDeviceProtocol
  51             EP0_PACKET_SIZE,                    // bMaxPacketSize0
  52             0xC410,                             // idVendor
  53             0xB981,                             // idProduct
  54             0x0000,                             // bcdDevice
  55             0x01,                               // iManufacturer
C51 COMPILER V8.02   F3XX_USB0_DESCRIPTOR                                                  06/27/2007 22:26:26 PAGE 2   

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

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

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


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   ----    ----
   CONSTANT SIZE    =    143    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =     77    ----
   DATA SIZE        =   ----    ----
   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 + -