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

📄 tpbulk.lst

📁 51环境下的FAT及FAT32文件系统源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 160      =1  #define SCON_TXINT 0x2
 161      =1  // SPI control 0
 162      =1  #define SPI_LSB    0x1
 163      =1  #define SPI_CPOL   0x2
 164      =1  #define SPI_CPHA   0x4
 165      =1  #define SPI_MST    0x8
 166      =1  #define SPI_TIE    0x10
 167      =1  #define SPI_RIE    0x20
 168      =1  #define SPI_EN     0x40
 169      =1  #define SPI_SSOEN  0x80
 170      =1  // SPI control 1
 171      =1  #define SPI_3M     0x0
 172      =1  #define SPI_1P5M   0x1
 173      =1  #define SPI_750K   0x2
 174      =1  #define SPI_375K   0x3
 175      =1  #define SPI_188K   0x4
C51 COMPILER V8.02   TPBULK                                                                09/19/2006 15:01:23 PAGE 6   

 176      =1  #define SPI_94K    0x5
 177      =1  #define SPI_47K    0x6
 178      =1  #define SPI_23K    0x7 
 179      =1  // SPI status
 180      =1  #define SPI_SPTEF  0x1
 181      =1  #define SPI_RRDY   0x2
 182      =1  #define SPI_WERR   0x4
 183      =1  #define SPI_RERR   0x8
 184      =1  // SD control
 185      =1  #define SD_64B     0x0
 186      =1  #define SD_128B    0x1
 187      =1  #define SD_256B    0x2
 188      =1  #define SD_512B    0x3
 189      =1  #define SD_WR      0x40
 190      =1  #define SD_EN      0x80
 191      =1  // SD status 0
 192      =1  
 193      =1  // SD status 1
 194      =1  #define SD_SDERR   0x1
 195      =1  #define SD_SDINT   0x2
 196      =1  #define SD_CMDEND  0x4
 197      =1  
 198      =1  #define SD_DETECT  0x4
 199      =1  
 200      =1  // Buffer Control
 201      =1  #ifdef OLD_CHIP
 202      =1          #define MCU2MP3    0x03
 203      =1          #define USB2MP3    0x13
 204      =1  #else
           =1         #define MCU2MP3    0x02
           =1     #define USB2MP3    0x12
           =1 #endif
 208      =1  #define USB2MCU    0x10
 209      =1  #define MCU2USB    0x01
 210      =1  #define USBFLSH    0x14
 211      =1  
 212      =1  // function prototypes
 213      =1  unsigned short WordSwap(unsigned short input);
 214      =1  void DelayMs(unsigned int nFactor);
 215      =1  void DelayUs(unsigned char nFactor);
 216      =1  unsigned long SwapINT32(unsigned long dData);
 217      =1  unsigned char SendUart(unsigned char *pUsrBuf, unsigned int num);
 218      =1  
 219      =1  
 220      =1  
   2          #include "usb.h"
   1      =1  #include "ABSACC.H"
   1      =2  /*--------------------------------------------------------------------------
   2      =2  ABSACC.H
   3      =2  
   4      =2  Direct access to 8051, extended 8051 and Philips 80C51MX memory areas.
   5      =2  Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
   6      =2  All rights reserved.
   7      =2  --------------------------------------------------------------------------*/
   8      =2  
   9      =2  #ifndef __ABSACC_H__
           =2 #define __ABSACC_H__
           =2 
           =2 #define CBYTE ((unsigned char volatile code  *) 0)
           =2 #define DBYTE ((unsigned char volatile data  *) 0)
           =2 #define PBYTE ((unsigned char volatile pdata *) 0)
           =2 #define XBYTE ((unsigned char volatile xdata *) 0)
C51 COMPILER V8.02   TPBULK                                                                09/19/2006 15:01:23 PAGE 7   

           =2 
           =2 #define CWORD ((unsigned int volatile code  *) 0)
           =2 #define DWORD ((unsigned int volatile data  *) 0)
           =2 #define PWORD ((unsigned int volatile pdata *) 0)
           =2 #define XWORD ((unsigned int volatile xdata *) 0)
           =2 
           =2 
           =2 #ifdef __CX51__
           =2 #define FVAR(object, addr)   (*((object volatile far *) (addr)))
           =2 #define FARRAY(object, base) ((object volatile far *) (base))
           =2 #define FCVAR(object, addr)   (*((object const far *) (addr)))
           =2 #define FCARRAY(object, base) ((object const far *) (base))
           =2 #else
           =2 #define FVAR(object, addr)    (*((object volatile far *) ((addr)+0x10000L)))
           =2 #define FCVAR(object, addr)   (*((object const far *) ((addr)+0x810000L)))
           =2 #define FARRAY(object, base)  ((object volatile far *) ((base)+0x10000L))
           =2 #define FCARRAY(object, base) ((object const far *) ((base)+0x810000L))
           =2 #endif
           =2 
           =2 #endif
   2      =1  
   3      =1  #define ISO_BIT     0x10
   4      =1  #define MAX_EP          0x05     // maximum number of endpoints (Ep0 + max of 4 data endpoints)
   5      =1  #define INT_CLEAR   0xff
   6      =1  //*****************************************************************************************
   7      =1  // Constant Defines
   8      =1  //*****************************************************************************************
   9      =1  
  10      =1  #define TIMEOUT_RETRY   0x06    // Maximum no. of timeout retries during USB xfer
  11      =1  // USB device descriptors
  12      =1  typedef struct
  13      =1  {
  14      =1      WORD  wVID, wPID;       // Vendor ID and Product ID
  15      =1      BYTE  bClass;           // 
  16      =1      BYTE  bNumOfEPs;        // actual number endpoint from slave
  17      =1      BYTE  iMfg;                         // Manufacturer ID
  18      =1      BYTE  iPdt;                         // Product ID
  19      =1      BYTE  bId1;
  20      =1      BYTE  bId2;
  21      =1      BYTE  bEPAddr[MAX_EP];   // bit 7 = 1 = use PID_IN, 
  22      =1      BYTE  bAttr[MAX_EP];     // ISO | Bulk | Interrupt | Control
  23      =1      WORD  wPayLoad[MAX_EP];  // ISO range: 1-1023, Bulk: 1-64, etc
  24      =1      WORD  bInterval[MAX_EP]; // polling interval (for LS)
  25      =1      BYTE  bData1[MAX_EP];    // DataToggle value
  26      =1  } USBDEV, *pUSBDEV;
  27      =1  
  28      =1  // USB specific request
  29      =1  typedef struct
  30      =1  {
  31      =1      BYTE bmRequest;
  32      =1      BYTE bRequest;
  33      =1      WORD wValue;
  34      =1      WORD wIndex;
  35      =1      WORD wLength;
  36      =1  } SetupPKG, *pSetupPKG;
  37      =1  
  38      =1  typedef struct
  39      =1  {
  40      =1      unsigned char usbaddr;
  41      =1  //    unsigned char endpoint;
  42      =1      unsigned char pid;
  43      =1      unsigned char wPayload;
C51 COMPILER V8.02   TPBULK                                                                09/19/2006 15:01:23 PAGE 8   

  44      =1      unsigned int  wLen;
  45      =1      unsigned char *buffer;      
  46      =1      SetupPKG setup;
  47      =1      unsigned char epbulkin;
  48      =1      unsigned char epbulkout;
  49      =1   
  50      =1  } XXGPKG, *pXXGPKG;
  51      =1  
  52      =1  // Standard Device Descriptor
  53      =1  typedef struct             //14 fields and 18 bytes;
  54      =1  {   BYTE bLength;                  //Descriptor size in bytes  --descriptor
  55      =1      BYTE bDescriptorType;  //The constant DEVICE(01h)  --descriptor
  56      =1      WORD bcdUSB;                   //The USB specification number that the Device and the descriptor comply with;
  57      =1      BYTE bDeviceClass;     //device class
  58      =1      BYTE bDeviceSubClass;
  59      =1      BYTE bDeviceProtocol;
  60      =1      BYTE bMaxPacketSize0;  //maximum packet size for endpoint 0;
  61      =1      WORD idVendor;                 
  62      =1      WORD idProduct;
  63      =1      WORD bcdDevice;                //the device's release number;
  64      =1      BYTE iManufacturer;    //an index that points to a string describing the manufacture;
  65      =1      BYTE iProduct;                 //an index that points to a string describing the product;
  66      =1      BYTE iSerialNumber;     
  67      =1      BYTE bNumConfigurations;   //the number of configuration the device supports;
  68      =1  } sDevDesc, *pDevDesc;
  69      =1  // Standard Configuration Descriptor describes the device's feature and abilities;
  70      =1  typedef struct
  71      =1  {       
  72      =1      BYTE bLength;                // Size of descriptor in Byte
  73      =1          BYTE bType;                                      // the constant Configuration(02h)
  74      =1          WORD wLength;                // the number of data bytes that the device returns,
  75      =1          BYTE bNumIntf;                           // Number of interfaces the configuration supports;
  76      =1          BYTE bCV;                        // bConfigurationValue,identifies the configuration for Get_Configuration and Se
             -t_Configuration;
  77      =1          BYTE bIndex;                     // iConfiguration,index to a string that describes the configuration;
  78      =1          BYTE bAttr;                  // Self power/bus power and remote wakeup;
  79      =1          BYTE bMaxPower;                          // Power config
  80      =1  } sCfgDesc, *pCfgDesc;
  81      =1  
  82      =1  // Standard Interface Descriptor 9 bytes
  83      =1  typedef struct
  84      =1  {       BYTE bLength;       
  85      =1          BYTE bType;                  //the constant INTERFACE(04h);
  86      =1          BYTE iNum;                   //Number identifying this interface;
  87      =1          BYTE iAltString;         //Value used to select an alternate setting;
  88      =1          BYTE bEndPoints;         //Number of endpoints supported in addition to Endpoint0;
  89      =1          BYTE iClass;             //class code
  90      =1          BYTE iSub;                   //subclass code
  91      =1          BYTE iProto;             //protocol code
  92      =1          BYTE iIndex;             //index of string descriptor for interface;
  93      =1  } sIntfDesc, *pIntfDesc;
  94      =1  
  95      =1  // Standard EndPoint Descriptor 7 bytes
  96      =1  typedef struct
  97      =1  {       BYTE bLength;
  98      =1          BYTE bType;                  //the constant endpoint(05h);
  99      =1          BYTE bEPAdd;             //includes the endpoint number(bits 0 through 3) and direction(bit 7);
 100      =1          BYTE bAttr;                  //bits 1 and 0 specify the type of transfer the endpoint supports.00=control,10=bulk...
             -;
 101      =1          WORD wPayLoad;       //maximum packet size supported; low-speed this must be 0x08
 102      =1          BYTE bInterval;      //for full-speed bulk and control transfers,the value is ignored.
 103      =1  } sEPDesc, *pEPDesc;
C51 COMPILER V8.02   TPBULK                                                                09/19/2006 15:01:23 PAGE 9   

 104      =1  
 105      =1  /*-------------------------------------------------------------------------
 106      =1   * Standard Chapter 9 definition
 107      =1   *-------------------------------------------------------------------------
 108      =1   */
 109      =1  #define GET_STATUS      0x00                                                                                                                              
 110      =1  #define CLEAR_FEATURE   0x01
 111      =1  #define SET_FEATURE     0x03
 112      =1  #define SET_ADDRESS     0x05
 113      =1  #define GET_DESCRIPTOR  0x06
 114      =1  #define SET_DESCRIPTOR  0x07
 115      =1  #define GET_CONFIG      0x08
 116      =1  #define SET_CONFIG      0x09
 117      =1  #define GET_INTERFACE   0x0a
 118      =1  #define SET_INTERFACE   0x0b
 119      =1  #define SYNCH_FRAME     0x0c
 120      =1  
 121      =1  
 122      =1  #define DEVICE          0x01
 123      =1  #define CONFIGURATION   0x02
 124      =1  #define STRING          0x03
 125      =1  #define INTERFACE       0x04
 126      =1  #define ENDPOINT        0x05
 127      =1  
 128      =1  #define STDCLASS        0x00
 129      =1  /*-------------------------------------------------------------------------
 130      =1   * USB Host control command definitions
 131      =1   *-------------------------------------------------------------------------
 132      =1   */
 133      =1   //cmd                       
 134      =1  #define WRITE0      0x42
 135      =1  #define WRITE1      0xc2   
 136      =1  #define READ        0x04
 137      =1  
 138      =1  #define SETUP       0x41
 139      =1  #define SEND_ACK    0x20
 140      =1  //pid
 141      =1  #define PID_SETUP   0xD0 
 142      =1  #define PID_IN      0x90
 143      =1  #define PID_OUT     0x10
 144      =1  //flag
 145      =1  #define DEV_TGL     0x01
 146      =1  #define PKT_VLD     0x04
 147      =1  #define PKT_ERR         0x02
 148      =1  #define PKT_DATA    0x40
 149      =1  #define PKT_SENT    0x02
 150      =1  #define DEV_ACK     0x20
 151      =1  #define DEV_NAK     0x10
 152      =1  #define DEV_STALL   0x08
 153      =1  #define DEV_TO      0x80
 154      =1  
 155      =1  
 156      =1  // Alarms
 157      =1  #define MP3_REQ         0x02
 158      =1  
 159      =1  void usbBufRead(unsigned char *s, unsigned char c);
 160      =1  void usbBufWrite(unsigned char *s, unsigned char c);
 161      =1  void usbReset(void);
 162      =1  unsigned char usbXfer(unsigned char endPoint);
 163      =1  unsigned char ep0Xfer(void);
 164      =1  unsigned char epBulkSend(unsigned char *pBuffer,unsigned int len);
 165      =1  unsigned char epBulkRcv(unsigned char *pBuffer,unsigned int len);
C51 COMPILER V8.02   TPBULK                                                                09/19/2006 15:01:23 PAGE 10  

 166      =1  unsigned char setAddress(unsigned char addr);
 167      =1  unsigned char setConfiguration(void);
 168      =1  unsigned char setDesc(void);
 169      =1  unsigned char enumUsbDev(BYTE usbaddr);
 170      =1  void usbInit(void);
 171      =1  void checkKeyLED(void);
 172      =1  
   3          #include "tpbulk.h"
   1      =1  #include "rbccmd.h"
   1      =2  /*
   2      =2  // RBC commands
   3      =2  */
   4      =2  #define RBC_CMD_FORMAT                                          0x04
   5      =2  #define RBC_CMD_READ10                                          0x28
   6      =2  #define RBC_CMD_READCAPACITY                            0x25
   7      =2  #define RBC_CMD_STARTSTOPUNIT                           0x1B
   8      =2  #define RBC_CMD_SYNCCACHE                                       0x35
   9      =2  #define RBC_CMD_VERIFY10                                        0x2F
  10      =2  #define RBC_CMD_WRITE10                                         0x2A
  11      =2  
  12      =2  /*
  13      =2  // SPC-2 commands
  14      =2  */
  15      =2  #define SPC_CMD_INQUIRY                                         0x12
  16      =2  #define SPC_CMD_MODESELECT6                                     0x15
  17      =2  #define SPC_CMD_MODESENSE6                                      0x1A
  18      =2  #define SPC_CMD_PERSISTANTRESERVIN                      0x5E
  19      =2  #define SPC_CMD_PERSISTANTRESERVOUT                     0x5F
  20      =2  #define SPC_CMD_PRVENTALLOWMEDIUMREMOVAL        0x1E
  21      =2  #define SPC_CMD_RELEASE6                                        0x17

⌨️ 快捷键说明

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