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

📄 f3xx_usb0_descriptor.lst

📁 HID Mouse source code 屬於Silabs C8051F326/F327,可以做一個USB 鼠標
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   F3XX_USB0_DESCRIPTOR                                                  06/22/2006 17:45:43 PAGE 1   


C51 COMPILER V7.50, 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 DB OE LARGE

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 V7.50   F3XX_USB0_DESCRIPTOR                                                  06/22/2006 17:45:43 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 V7.50   F3XX_USB0_DESCRIPTOR                                                  06/22/2006 17:45:43 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          /*
 128              0x05, 0x01,                        // Usage Page (Generic Desktop)
 129              0x09, 0x02,                        // Usage (Mouse)
 130              0xA1, 0x01,                        // Collection (Application)
 131              0x09, 0x01,                        //   Usage (Pointer)
 132              0xA1, 0x00,                        //   Collection (Physical)
 133              0x05, 0x09,                        //     Usage Page (Buttons)
 134              0x19, 0x01,                        //     Usage Minimum (01)
 135              0x29, 0x01,                        //     Usage Maximum (01)
 136              0x15, 0x00,                        //     Logical Minimum (0)
 137              0x25, 0x01,                        //     Logical Maximum (1)
 138              0x95, 0x01,                        //     Report Count (1)
 139              0x75, 0x01,                        //     Report Size (1)
 140              0x81, 0x02,                        //     Input (Data, Variable, Absolute)
 141              0x95, 0x01,                        //     Report Count (1)
 142              0x75, 0x07,                        //     Report Size (7)
 143              0x81, 0x01,                        //     Input (Constant) for padding
 144              0x05, 0x01,                        //     Usage Page (Generic Desktop)
 145              0x09, 0x30,                        //     Usage (X)
 146              0x09, 0x31,                        //     Usage (Y)
 147              0x15, 0x81,                        //     Logical Minimum (-127)
 148              0x25, 0x7F,                        //     Logical Maximum (127)
 149              0x75, 0x08,                        //     Report Size (8)
 150              0x95, 0x02,                        //     Report Count (2)
 151              0x81, 0x06,                        //     Input (Data, Variable, Relative)
 152              0xC0,                              //   End Collection (Physical)
 153              0xC0,                               // End Collection (Application)
 154          
 155          */
 156          
 157                  0x05,0x01,              //usage page (generic desktop)

⌨️ 快捷键说明

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