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

📄 cdc_enumerate.lst

📁 关于usb的一段程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.31A/W32 EVALUATION    28/Feb/2007  15:58:47 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\work\AC-530\software\my                           #
#                       usb\AT91SAM7S-USART_USB_SAM7S\src\cdc_enumerate.c    #
#    Command line    =  "D:\work\AC-530\software\my                          #
#                       usb\AT91SAM7S-USART_USB_SAM7S\src\cdc_enumerate.c"   #
#                       -lC "D:\work\AC-530\software\my                      #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\Binary\List\"   #
#                       -o "D:\work\AC-530\software\my                       #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\Binary\Obj\"    #
#                       -z9 --debug --cpu_mode thumb --endian little --cpu   #
#                       ARM7TDMI --stack_align 4 --interwork -e --fpu None   #
#                       --dlib_config "C:\Program Files\IAR                  #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\arm\LIB\dl4tptinl8n.h" -I                 #
#                       "D:\work\AC-530\software\my                          #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcIAR\" -I     #
#                       "D:\work\AC-530\software\my                          #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\..\src\" -I     #
#                       "D:\work\AC-530\software\my                          #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\..\..\" -I      #
#                       "C:\Program Files\IAR Systems\Embedded Workbench     #
#                       4.0 Evaluation\arm\INC\"                             #
#    List file       =  D:\work\AC-530\software\my                           #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\Binary\List\cdc #
#                       _enumerate.lst                                       #
#    Object file     =  D:\work\AC-530\software\my                           #
#                       usb\AT91SAM7S-USART_USB_SAM7S\Compil\Binary\Obj\cdc_ #
#                       enumerate.r79                                        #
#                                                                            #
#                                                                            #
##############################################################################

D:\work\AC-530\software\my usb\AT91SAM7S-USART_USB_SAM7S\src\cdc_enumerate.c
      1          //*----------------------------------------------------------------------------
      2          //*      ATMEL Microcontroller Software Support  -  ROUSSET  -
      3          //*----------------------------------------------------------------------------
      4          //* The software is delivered "AS IS" without warranty or condition of any
      5          //* kind, either express, implied or statutory. This includes without
      6          //* limitation any warranty or condition with respect to merchantability or
      7          //* fitness for any particular purpose, or against the infringements of
      8          //* intellectual property rights of others.
      9          //*----------------------------------------------------------------------------
     10          //* File Name           : cdc_enumerate.c
     11          //* Object              : Handle CDC enumeration
     12          //*
     13          //* 1.0 Apr 20 200 	: ODi Creation
     14          //* 1.1 14/Sep/2004 JPP : Minor change
     15          //* 1.1 15/12/2004  JPP : suppress warning
     16          //* 1.2 30-Jun-2006 JPP : Set in AT91C_UDP_EPTYPE_INT_IN
     17          //* 1.3 2007-02-28  Hogo: Change for APS
     18          //*----------------------------------------------------------------------------
     19          #include "Project.h"
     20          #include "cdc_enumerate.h"
     21          
     22          
     23          typedef unsigned char  uchar;
     24          typedef unsigned short ushort;
     25          typedef unsigned int   uint;
     26          
     27          #define MIN(a, b) (((a) < (b)) ? (a) : (b))
     28          
     29          #define AT91C_EP_IN_SIZE 0x40
     30          
     31          #define APS_CODE
     32          
     33          #ifdef APS_CODE
     34          
     35          /* macros to deal with endianness problems ***********************************/
     36          //#define LITTLE_ENDIAN(w)  CONST_LSB(w),CONST_MSB(w)
     37          #endif
     38          
     39          
     40          #ifndef APS_CODE
     41          const char devDescriptor[] = {
     42          	/* Device descriptor */
     43          	0x12,   // bLength
     44          	0x01,   // bDescriptorType
     45          	0x10,   // bcdUSBL
     46          	0x01,   //
     47          	0x02,   // bDeviceClass:    CDC class code
     48          	0x00,   // bDeviceSubclass: CDC class sub code
     49          	0x00,   // bDeviceProtocol: CDC Device protocol
     50          	0x08,   // bMaxPacketSize0
     51          	0xEB,   // idVendorL
     52          	0x03,   //
     53          	0x24,   // idProductL
     54          	0x61,   //
     55          	0x10,   // bcdDeviceL
     56          	0x01,   //
     57          	0x00,   // iManufacturer    // 0x01
     58          	0x00,   // iProduct
     59          	0x00,   // SerialNumber
     60          	0x01    // bNumConfigs
     61          };
     62          #else
     63          /* descriptor types **********************************************************/
     64          
     65          #define USB_DESC_DEVICE         1
     66          #define USB_DESC_CONFIG         2
     67          #define USB_DESC_STRING         3
     68          #define USB_DESC_INTERFACE      4
     69          #define USB_DESC_ENDPOINT       5
     70          
     71          /* device descriptor *********************************************************/
     72          #define USB_DESC_DEVICE_SIZE 18  /* bytes */
     73          

   \                                 In segment DATA_C, align 4, align-sorted
     74          const char devDescriptor[] = {
   \                     devDescriptor:
   \   00000000   120110010000       DC8 18, 1, 16, 1, 0, 0, 0, 8, 113, 4, 2, 0, 0, 1, 1, 2, 0, 1, 0, 0
   \              000871040200
   \              000101020001
   \              0000        
     75          	/* Device descriptor */
     76          	USB_DESC_DEVICE_SIZE,   // bLength
     77          	USB_DESC_DEVICE,   // bDescriptorType
     78          	0x10,   // bcdUSBL
     79          	0x01,   //
     80          	0x00,   // bDeviceClass:
     81          	0x00,   // bDeviceSubclass: CDC class sub code
     82          	0x00,   // bDeviceProtocol: CDC Device protocol
     83          	0x08,   // bMaxPacketSize0
     84          	0x71,   // idVendorL  Read CP 324HRS : 0x0471
     85          	0x04,   //
     86          	0x02,   // idProductL
     87          	0x00,   //
     88          	0x00,   // bcdDeviceL
     89          	0x01,   //
     90          	0x01,   // iManufacturer    // 0x01
     91          	0x02,   // iProduct
     92          	0x00,   // SerialNumber
     93          	0x01    // bNumConfigs
     94          };
     95          
     96          #endif
     97          
     98          
     99          #ifndef APS_CODE
    100          const char cfgDescriptor[] = {
    101          	/* ============== CONFIGURATION 1 =========== */
    102          	/* Configuration 1 descriptor */
    103          	0x09,   // CbLength
    104          	0x02,   // CbDescriptorType
    105          	0x43,   // CwTotalLength 2 EP + Control
    106          	0x00,
    107          	0x02,   // CbNumInterfaces
    108          	0x01,   // CbConfigurationValue
    109          	0x00,   // CiConfiguration
    110          	0xC0,   // CbmAttributes 0xA0
    111          	0x00,   // CMaxPower
    112          
    113          	/* Communication Class Interface Descriptor Requirement */
    114          	0x09, // bLength
    115          	0x04, // bDescriptorType
    116          	0x00, // bInterfaceNumber
    117          	0x00, // bAlternateSetting
    118          	0x01, // bNumEndpoints
    119          	0x02, // bInterfaceClass
    120          	0x02, // bInterfaceSubclass
    121          	0x00, // bInterfaceProtocol
    122          	0x00, // iInterface
    123          
    124          	/* Header Functional Descriptor */
    125          	0x05, // bFunction Length
    126          	0x24, // bDescriptor type: CS_INTERFACE
    127          	0x00, // bDescriptor subtype: Header Func Desc
    128          	0x10, // bcdCDC:1.1
    129          	0x01,
    130          
    131          	/* ACM Functional Descriptor */
    132          	0x04, // bFunctionLength
    133          	0x24, // bDescriptor Type: CS_INTERFACE
    134          	0x02, // bDescriptor Subtype: ACM Func Desc
    135          	0x00, // bmCapabilities
    136          
    137          	/* Union Functional Descriptor */
    138          	0x05, // bFunctionLength
    139          	0x24, // bDescriptorType: CS_INTERFACE
    140          	0x06, // bDescriptor Subtype: Union Func Desc
    141          	0x00, // bMasterInterface: Communication Class Interface
    142          	0x01, // bSlaveInterface0: Data Class Interface
    143          
    144          	/* Call Management Functional Descriptor */
    145          	0x05, // bFunctionLength
    146          	0x24, // bDescriptor Type: CS_INTERFACE
    147          	0x01, // bDescriptor Subtype: Call Management Func Desc
    148          	0x00, // bmCapabilities: D1 + D0
    149          	0x01, // bDataInterface: Data Class Interface 1
    150          
    151          	/* Endpoint 1 descriptor */
    152          	0x07,   // bLength
    153          	0x05,   // bDescriptorType
    154          	0x83,   // bEndpointAddress, Endpoint 03 - IN
    155          	0x03,   // bmAttributes      INT
    156          	0x08,   // wMaxPacketSize
    157          	0x00,
    158          	0xFF,   // bInterval
    159          
    160          	/* Data Class Interface Descriptor Requirement */
    161          	0x09, // bLength
    162          	0x04, // bDescriptorType
    163          	0x01, // bInterfaceNumber
    164          	0x00, // bAlternateSetting
    165          	0x02, // bNumEndpoints
    166          	0x0A, // bInterfaceClass
    167          	0x00, // bInterfaceSubclass
    168          	0x00, // bInterfaceProtocol
    169          	0x00, // iInterface
    170          
    171          	/* First alternate setting */
    172          	/* Endpoint 1 descriptor */
    173          	0x07,   // bLength
    174          	0x05,   // bDescriptorType
    175          	0x01,   // bEndpointAddress, Endpoint 01 - OUT
    176          	0x02,   // bmAttributes      BULK
    177          	AT91C_EP_OUT_SIZE,   // wMaxPacketSize
    178          	0x00,
    179          	0x00,   // bInterval
    180          
    181          	/* Endpoint 2 descriptor */
    182          	0x07,   // bLength
    183          	0x05,   // bDescriptorType
    184          	0x82,   // bEndpointAddress, Endpoint 02 - IN
    185          	0x02,   // bmAttributes      BULK
    186          	AT91C_EP_IN_SIZE,   // wMaxPacketSize
    187          	0x00,
    188          	0x00    // bInterval
    189          };
    190          #else
    191          /* refer to USB specification revision 2.0 page 264-273 */

⌨️ 快捷键说明

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