📄 usb.lst
字号:
109 =1
110 =1 //usb registers' address definition
111 =1 #define SieCtrl XBYTE[0xF800]
112 =1 #define SieStat0 XBYTE[0xF801]
113 =1 #define SieStat1 XBYTE[0xF802]
C51 COMPILER V8.02 USB 09/19/2006 15:01:22 PAGE 5
114 =1 #define TxCtrl XBYTE[0xF803]
115 =1 #define TxEpnum XBYTE[0xF804]
116 =1 #define TxAddr XBYTE[0xF805]
117 =1 #define TxPktlen XBYTE[0xF806]
118 =1 #define XferCnt XBYTE[0xF807]
119 =1 #define Ualarm XBYTE[0xF808]
120 =1 #define UalarmEn XBYTE[0xF809]
121 =1 #define UalarmTest XBYTE[0xF80A]
122 =1 #define BufSel XBYTE[0xF80B]
123 =1 #define BufRst XBYTE[0xF80C]
124 =1 #define BufStatusAddr XBYTE[0xF80D]
125 =1 #define BufAddr XBYTE[0xF80E]
126 =1 #define Scratch XBYTE[0xF80F]
127 =1 //
128 =1 // ava110 User SFRs
129 =1 // extra GPIO port
130 =1 sfr P4 = 0xA1;
131 =1 // port output enable force
132 =1 sfr P0_DDR = 0xA2;
133 =1 sfr P1_DDR = 0xA3;
134 =1 sfr P2_DDR = 0xA4;
135 =1 sfr P3_DDR = 0xA5;
136 =1 sfr P4_DDR = 0xA6;
137 =1 // port pull-up/down
138 =1 sfr P_PU = 0xA7;
139 =1 sfr P_PD = 0xA9;
140 =1 // watchdog timer
141 =1 sfr WDT = 0xAA;
142 =1 // SPI port
143 =1 sfr SPI_DATA= 0x91;
144 =1 sfr SPI_CTL0= 0x92;
145 =1 sfr SPI_CTL1= 0x93;
146 =1 sfr SPI_STA0= 0x94;
147 =1 // SD interface
148 =1 sfr SD_CTL0= 0x95;
149 =1 sfr SD_STA0= 0x96;
150 =1 sfr SD_STA1= 0x97;
151 =1
152 =1 // The following defines bit maps for serial and spi port
153 =1 // control & status masks
154 =1 // serial port control
155 =1 #define SCON_SLOW 0x10
156 =1 #define SCON_FAST 0x50
157 =1 #define SCON_9BIT 0x80
158 =1 // serial port status
159 =1 #define SCON_RXINT 0x1
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 USB 09/19/2006 15:01:22 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 USB 09/19/2006 15:01:22 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 USB 09/19/2006 15:01:22 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -