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

📄 protodma.lst

📁 飞利浦usb D12芯片fireware 源程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 158      =1     //*************************************************************************
 159      =1     // USB utility functions
C51 COMPILER V8.02   PROTODMA                                                              07/27/2007 11:10:49 PAGE 10  

 160      =1     //*************************************************************************
 161      =1  */
 162      =1  #ifndef __C51__
           =1 void interrupt timer_isr(void);
           =1 void interrupt usb_isr(void);
           =1 #endif
 166      =1  
 167      =1  void fn_usb_isr();
 168      =1  
 169      =1  extern void suspend_change(void);
 170      =1  extern void stall_ep0(void);
 171      =1  extern void disconnect_USB(void);
 172      =1  extern void connect_USB(void);
 173      =1  extern void reconnect_USB(void);
 174      =1  extern void init_unconfig(void);
 175      =1  extern void init_config(void);
 176      =1  extern void single_transmit(unsigned char * pData, unsigned char len);
 177      =1  extern void code_transmit(unsigned char code * pRomData, unsigned short len);
 178      =1  
 179      =1  extern void control_handler();
 180      =1  extern void check_key_LED(void);
 181      =1  extern void setup_dma();
 182      =1  #ifndef __C51__
           =1 extern void setup_io(); // V2.1, x86 only
           =1 #endif
 185      =1  
 186      =1  void dma_start(PIO_REQUEST);
 187      =1  
 188      =1  #define IN_TOKEN_DMA    1
 189      =1  #define OUT_TOKEN_DMA   0
 190      =1  
 191      =1  #ifndef __C51__
           =1         #define DMA_BUFFER_SIZE         64000
           =1 #else
 194      =1          #define DMA_BUFFER_SIZE         16384
 195      =1  #endif
 196      =1  
 197      =1  #define DMA_IDLE        0
 198      =1  #define DMA_RUNNING     1
 199      =1  #define DMA_PENDING     2
 200      =1  
 201      =1  #define SETUP_DMA_REQUEST               0x0471
 202      =1  #define GET_FIRMWARE_VERSION    0x0472
 203      =1  #define GET_SET_TWAIN_REQUEST   0x0473
 204      =1  
 205      =1  typedef struct _TWAIN_FILEINFO {
 206      =1          unsigned char   bPage;    // bPage bit 7 - 5 map to uSize bit 18 - 16
 207      =1          unsigned char   uSizeH;    // uSize bit 15 - 8
 208      =1          unsigned char   uSizeL;    // uSize bit 7 - 0
 209      =1  } TWAIN_FILEINFO, *PTWAIN_FILEINFO;
 210      =1  
 211      =1  #endif
 212      =1  
  30          #include "usb100.h"
   1      =1  #ifndef   __USB100_H__
   2      =1  #define   __USB100_H__
   3      =1  
   4      =1  
   5      =1  #define MAXIMUM_USB_STRING_LENGTH 255
   6      =1  
   7      =1  // values for the bits returned by the USB GET_STATUS command
   8      =1  #define USB_GETSTATUS_SELF_POWERED                0x01
C51 COMPILER V8.02   PROTODMA                                                              07/27/2007 11:10:49 PAGE 11  

   9      =1  #define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED       0x02
  10      =1  
  11      =1  
  12      =1  #define USB_DEVICE_DESCRIPTOR_TYPE                0x01
  13      =1  #define USB_CONFIGURATION_DESCRIPTOR_TYPE         0x02
  14      =1  #define USB_STRING_DESCRIPTOR_TYPE                0x03
  15      =1  #define USB_INTERFACE_DESCRIPTOR_TYPE             0x04
  16      =1  #define USB_ENDPOINT_DESCRIPTOR_TYPE              0x05
  17      =1  #define USB_POWER_DESCRIPTOR_TYPE                 0x06
  18      =1  
  19      =1  #define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d<<8 | i))
  20      =1  
  21      =1  //
  22      =1  // Values for bmAttributes field of an
  23      =1  // endpoint descriptor
  24      =1  //
  25      =1  
  26      =1  #define USB_ENDPOINT_TYPE_MASK                    0x03
  27      =1  
  28      =1  #define USB_ENDPOINT_TYPE_CONTROL                 0x00
  29      =1  #define USB_ENDPOINT_TYPE_ISOCHRONOUS             0x01
  30      =1  #define USB_ENDPOINT_TYPE_BULK                    0x02
  31      =1  #define USB_ENDPOINT_TYPE_INTERRUPT               0x03
  32      =1  
  33      =1  
  34      =1  //
  35      =1  // definitions for bits in the bmAttributes field of a 
  36      =1  // configuration descriptor.
  37      =1  //
  38      =1  #define USB_CONFIG_POWERED_MASK                   0xc0
  39      =1  
  40      =1  #define USB_CONFIG_BUS_POWERED                    0x80
  41      =1  #define USB_CONFIG_SELF_POWERED                   0x40
  42      =1  #define USB_CONFIG_REMOTE_WAKEUP                  0x20
  43      =1  
  44      =1  //
  45      =1  // Endpoint direction bit, stored in address
  46      =1  //
  47      =1  
  48      =1  #define USB_ENDPOINT_DIRECTION_MASK               0x80
  49      =1  
  50      =1  // test direction bit in the bEndpointAddress field of
  51      =1  // an endpoint descriptor.
  52      =1  #define USB_ENDPOINT_DIRECTION_OUT(addr)          (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
  53      =1  #define USB_ENDPOINT_DIRECTION_IN(addr)           ((addr) & USB_ENDPOINT_DIRECTION_MASK)
  54      =1  
  55      =1  //
  56      =1  // USB defined request codes
  57      =1  // see chapter 9 of the USB 1.0 specifcation for
  58      =1  // more information.
  59      =1  //
  60      =1  
  61      =1  // These are the correct values based on the USB 1.0
  62      =1  // specification
  63      =1  
  64      =1  #define USB_REQUEST_GET_STATUS                    0x00
  65      =1  #define USB_REQUEST_CLEAR_FEATURE                 0x01
  66      =1  
  67      =1  #define USB_REQUEST_SET_FEATURE                   0x03
  68      =1  
  69      =1  #define USB_REQUEST_SET_ADDRESS                   0x05
  70      =1  #define USB_REQUEST_GET_DESCRIPTOR                0x06
C51 COMPILER V8.02   PROTODMA                                                              07/27/2007 11:10:49 PAGE 12  

  71      =1  #define USB_REQUEST_SET_DESCRIPTOR                0x07
  72      =1  #define USB_REQUEST_GET_CONFIGURATION             0x08
  73      =1  #define USB_REQUEST_SET_CONFIGURATION             0x09
  74      =1  #define USB_REQUEST_GET_INTERFACE                 0x0A
  75      =1  #define USB_REQUEST_SET_INTERFACE                 0x0B
  76      =1  #define USB_REQUEST_SYNC_FRAME                    0x0C
  77      =1  
  78      =1  
  79      =1  //
  80      =1  // defined USB device classes
  81      =1  //
  82      =1  
  83      =1  
  84      =1  #define USB_DEVICE_CLASS_RESERVED           0x00
  85      =1  #define USB_DEVICE_CLASS_AUDIO              0x01
  86      =1  #define USB_DEVICE_CLASS_COMMUNICATIONS     0x02
  87      =1  #define USB_DEVICE_CLASS_HUMAN_INTERFACE    0x03
  88      =1  #define USB_DEVICE_CLASS_MONITOR            0x04
  89      =1  #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
  90      =1  #define USB_DEVICE_CLASS_POWER              0x06
  91      =1  #define USB_DEVICE_CLASS_PRINTER            0x07
  92      =1  #define USB_DEVICE_CLASS_STORAGE            0x08
  93      =1  #define USB_DEVICE_CLASS_HUB                0x09
  94      =1  #define USB_DEVICE_CLASS_VENDOR_SPECIFIC    0xFF
  95      =1  
  96      =1  //
  97      =1  // USB defined Feature selectors
  98      =1  //
  99      =1  
 100      =1  #define USB_FEATURE_ENDPOINT_STALL          0x0000
 101      =1  #define USB_FEATURE_REMOTE_WAKEUP           0x0001
 102      =1  #define USB_FEATURE_POWER_D0                0x0002
 103      =1  #define USB_FEATURE_POWER_D1                0x0003
 104      =1  #define USB_FEATURE_POWER_D2                0x0004
 105      =1  #define USB_FEATURE_POWER_D3                0x0005
 106      =1  
 107      =1  typedef struct _USB_DEVICE_DESCRIPTOR {
 108      =1      UCHAR bLength;
 109      =1      UCHAR bDescriptorType;
 110      =1      USHORT bcdUSB;
 111      =1      UCHAR bDeviceClass;
 112      =1      UCHAR bDeviceSubClass;
 113      =1      UCHAR bDeviceProtocol;
 114      =1      UCHAR bMaxPacketSize0;
 115      =1      USHORT idVendor;
 116      =1      USHORT idProduct;
 117      =1      USHORT bcdDevice;
 118      =1      UCHAR iManufacturer;
 119      =1      UCHAR iProduct;
 120      =1      UCHAR iSerialNumber;
 121      =1      UCHAR bNumConfigurations;
 122      =1  } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
 123      =1  
 124      =1  typedef struct _USB_ENDPOINT_DESCRIPTOR {
 125      =1      UCHAR bLength;
 126      =1      UCHAR bDescriptorType;
 127      =1      UCHAR bEndpointAddress;
 128      =1      UCHAR bmAttributes;
 129      =1      USHORT wMaxPacketSize;
 130      =1      UCHAR bInterval;
 131      =1  } USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
 132      =1  
C51 COMPILER V8.02   PROTODMA                                                              07/27/2007 11:10:49 PAGE 13  

 133      =1  //
 134      =1  // values for bmAttributes Field in
 135      =1  // USB_CONFIGURATION_DESCRIPTOR
 136      =1  //
 137      =1  
 138      =1  #define BUS_POWERED                           0x80
 139      =1  #define SELF_POWERED                          0x40
 140      =1  #define REMOTE_WAKEUP                         0x20
 141      =1  
 142      =1  typedef struct _USB_CONFIGURATION_DESCRIPTOR {
 143      =1      UCHAR bLength;
 144      =1      UCHAR bDescriptorType;
 145      =1      USHORT wTotalLength;
 146      =1      UCHAR bNumInterfaces;
 147      =1      UCHAR bConfigurationValue;
 148      =1      UCHAR iConfiguration;
 149      =1      UCHAR bmAttributes;
 150      =1      UCHAR MaxPower;
 151      =1  } USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
 152      =1  
 153      =1  typedef struct _USB_INTERFACE_DESCRIPTOR {
 154      =1      UCHAR bLength;
 155      =1      UCHAR bDescriptorType;
 156      =1      UCHAR bInterfaceNumber;
 157      =1      UCHAR bAlternateSetting;
 158      =1      UCHAR bNumEndpoints;
 159      =1      UCHAR bInterfaceClass;
 160      =1      UCHAR bInterfaceSubClass;
 161      =1      UCHAR bInterfaceProtocol;
 162      =1      UCHAR iInterface;
 163      =1  } USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
 164      =1  
 165      =1  typedef struct _USB_STRING_DESCRIPTOR {
 166      =1      UCHAR bLength;
 167      =1      UCHAR bDescriptorType;
 168      =1      UCHAR bString[1];
 169      =1  } USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
 170      =1  
 171      =1  //
 172      =1  // USB power descriptor added to core specification
 173      =1  //
 174      =1  
 175      =1  #define USB_SUPPORT_D0_COMMAND      0x01
 176      =1  #define USB_SUPPORT_D1_COMMAND      0x02
 177      =1  #define USB_SUPPORT_D2_COMMAND      0x04
 178      =1  #define USB_SUPPORT_D3_COMMAND      0x08
 179      =1  
 180      =1  #define USB_SUPPORT_D1_WAKEUP       0x10
 181      =1  #define USB_SUPPORT_D2_WAKEUP       0x20
 182      =1  
 183      =1  
 184      =1  typedef struct _USB_POWER_DESCRIPTOR {
 185      =1      UCHAR bLength;
 186      =1      UCHAR bDescriptorType;
 187      =1      UCHAR bCapabilitiesFlags;
 188      =1      USHORT EventNotification;
 189      =1      USHORT D1LatencyTime;
 190      =1      USHORT D2LatencyTime;
 191      =1      USHORT D3LatencyTime;
 192      =1      UCHAR PowerUnit;
 193      =1      USHORT D0PowerConsumption;
 194      =1      USHORT D1PowerConsumption;
C51 COMPILER V8.02   PROTODMA                                                              07/27/2007 11:10:49 PAGE 14  

 195      =1      USHORT D2PowerConsumption;
 196      =1  } USB_POWER_DESCRIPTOR, *PUSB_POWER_DESCRIPTOR;
 197      =1  
 198      =1  
 199      =1  typedef struct _USB_COMMON_DESCRIPTOR {
 200      =1      UCHAR bLength;
 201      =1      UCHAR bDescriptorType;
 202      =1  } USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
 203      =1  
 204      =1  
 205      =1  //
 206      =1  // Standard USB HUB definitions 
 207      =1  //
 208      =1  // See Chapter 11
 209      =1  //
 210      =1  
 211      =1  typedef struct _USB_HUB_DESCRIPTOR {
 212      =1      UCHAR        bDescriptorLength;      // Length of this descriptor
 213      =1      UCHAR        bDescriptorType;        // Hub configuration type
 214      =1      UCHAR        bNumberOfPorts;         // number of ports on this hub
 215      =1      USHORT       wHubCharacteristics;    // Hub Charateristics
 216      =1      UCHAR        bPowerOnToPowerGood;    // port power on till power good in 2ms
 217      =1      UCHAR        bHubControlCurrent;     // max current in mA
 218      =1      //
 219      =1      // room for 255 ports power control and removable bitmask
 220      =1      UCHAR        bRemoveAndPowerMask[64];
 221      =1  } USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;

⌨️ 快捷键说明

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