📄 fw.lst
字号:
C51 COMPILER V8.06 FW 11/12/2007 15:20:26 PAGE 1
C51 COMPILER V8.06, COMPILATION OF MODULE FW
OBJECT MODULE PLACED IN fw.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE fw.c BROWSE DEBUG OBJECTEXTEND LISTINCLUDE TABS(3)
line level source
1 //====================================================
2 // File: fw.c
3 //====================================================
4 #include "fx2.h"
1 =1 #ifndef FX2_H
2 =1 #define FX2_H
3 =1
4 =1 #define INTERNAL_DSCR_ADDR 0x0080 // Relocate Descriptors to 0x80
5 =1 #define bmSTRETCH 0x07
6 =1 #define FW_STRETCH_VALUE 0x0 // Set stretch to 0 in frameworks
7 =1 // Note: a RevE eratta states that stretch must=0 to set OUTxBC
8 =1 //====================================================================
9 =1 // Constants
10 =1 //====================================================================
11 =1 #define TRUE 1
12 =1 #define FALSE 0
13 =1
14 =1 #define bmBIT0 0x01
15 =1 #define bmBIT1 0x02
16 =1 #define bmBIT2 0x04
17 =1 #define bmBIT3 0x08
18 =1 #define bmBIT4 0x10
19 =1 #define bmBIT5 0x20
20 =1 #define bmBIT6 0x40
21 =1 #define bmBIT7 0x80
22 =1
23 =1 #define DEVICE_DSCR 0x01 // Descriptor type: Device
24 =1 #define CONFIG_DSCR 0x02 // Descriptor type: Configuration
25 =1 #define STRING_DSCR 0x03 // Descriptor type: String
26 =1 #define INTRFC_DSCR 0x04 // Descriptor type: Interface
27 =1 #define ENDPNT_DSCR 0x05 // Descriptor type: End Point
28 =1 #define DEVQUAL_DSCR 0x06 // Descriptor type: Device Qualifier
29 =1 #define OTHERSPEED_DSCR 0x07 // Descriptor type: Other Speed Configuration
30 =1
31 =1 #define bmBUSPWR bmBIT7 // Config. attribute: Bus powered
32 =1 #define bmSELFPWR bmBIT6 // Config. attribute: Self powered
33 =1 #define bmRWU bmBIT5 // Config. attribute: Remote Wakeup
34 =1
35 =1 #define bmEPOUT bmBIT7
36 =1 #define bmEPIN 0x00
37 =1
38 =1 #define EP_CONTROL 0x00 // End Point type: Control
39 =1 #define EP_ISO 0x01 // End Point type: Isochronous
40 =1 #define EP_BULK 0x02 // End Point type: Bulk
41 =1 #define EP_INT 0x03 // End Point type: Interrupt
42 =1
43 =1 #define SUD_SIZE 8 // Setup data packet size
44 =1
45 =1 //====================================================================
46 =1 //Added for HID
47 =1
48 =1 #define SETUP_MASK 0x60 //Used to mask off request type
49 =1 #define SETUP_STANDARD_REQUEST 0 //Standard Request
50 =1 #define SETUP_CLASS_REQUEST 0x20 //Class Request
51 =1 #define SETUP_VENDOR_REQUEST 0x40 //Vendor Request
C51 COMPILER V8.06 FW 11/12/2007 15:20:26 PAGE 2
52 =1 #define SETUP_RESERVED_REQUEST 0x60 //Reserved or illegal request
53 =1 //====================================================================
54 =1
55 =1
56 =1 #define SC_GET_STATUS 0x00 // Setup command: Get Status
57 =1 #define SC_CLEAR_FEATURE 0x01 // Setup command: Clear Feature
58 =1 #define SC_RESERVED 0x02 // Setup command: Reserved
59 =1 #define SC_SET_FEATURE 0x03 // Setup command: Set Feature
60 =1 #define SC_SET_ADDRESS 0x05 // Setup command: Set Address
61 =1 #define SC_GET_DESCRIPTOR 0x06 // Setup command: Get Descriptor
62 =1 #define SC_SET_DESCRIPTOR 0x07 // Setup command: Set Descriptor
63 =1 #define SC_GET_CONFIGURATION 0x08 // Setup command: Get Configuration
64 =1 #define SC_SET_CONFIGURATION 0x09 // Setup command: Set Configuration
65 =1 #define SC_GET_INTERFACE 0x0a // Setup command: Get Interface
66 =1 #define SC_SET_INTERFACE 0x0b // Setup command: Set Interface
67 =1 #define SC_SYNC_FRAME 0x0c // Setup command: Sync Frame
68 =1 #define SC_ANCHOR_LOAD 0xa0 // Setup command: Anchor load
69 =1
70 =1 #define GD_DEVICE 0x01 // Get descriptor: Device
71 =1 #define GD_CONFIGURATION 0x02 // Get descriptor: Configuration
72 =1 #define GD_STRING 0x03 // Get descriptor: String
73 =1 #define GD_INTERFACE 0x04 // Get descriptor: Interface
74 =1 #define GD_ENDPOINT 0x05 // Get descriptor: Endpoint
75 =1 #define GD_DEVICE_QUALIFIER 0x06 // Get descriptor: Device Qualifier
76 =1 #define GD_OTHER_SPEED_CONFIGURATION 0x07 // Get descriptor: Other Configuration
77 =1 #define GD_INTERFACE_POWER 0x08 // Get descriptor: Interface Power
78 =1 #define GD_HID 0x21 // Get descriptor: HID
79 =1 #define GD_REPORT 0x22 // Get descriptor: Report
80 =1
81 =1 #define GS_DEVICE 0x80 // Get Status: Device
82 =1 #define GS_INTERFACE 0x81 // Get Status: Interface
83 =1 #define GS_ENDPOINT 0x82 // Get Status: End Point
84 =1
85 =1 #define FT_DEVICE 0x00 // Feature: Device
86 =1 #define FT_ENDPOINT 0x02 // Feature: End Point
87 =1
88 =1 #define I2C_IDLE 0 // I2C Status: Idle mode
89 =1 #define I2C_SENDING 1 // I2C Status: I2C is sending data
90 =1 #define I2C_RECEIVING 2 // I2C Status: I2C is receiving data
91 =1 #define I2C_PRIME 3 // I2C Status: I2C is receiving the first byte of a string
92 =1 #define I2C_STOP 5 // I2C Status: I2C waiting for stop completion
93 =1 #define I2C_BERROR 6 // I2C Status: I2C error; Bit Error
94 =1 #define I2C_NACK 7 // I2C Status: I2C error; No Acknowledge
95 =1 #define I2C_OK 8 // I2C positive return code
96 =1 #define I2C_WAITSTOP 9 // I2C Status: Wait for STOP complete
97 =1
98 =1
99 =1 #define MSB(word) (BYTE)(((WORD)(word) >> 8) & 0xff)
100 =1 #define LSB(word) (BYTE)((WORD)(word) & 0xff)
101 =1
102 =1 #define SWAP_ENDIAN(word) ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1];\
103 =1 ((BYTE*)&word)[1] ^= ((BYTE*)&word)[0];\
104 =1 ((BYTE*)&word)[0] ^= ((BYTE*)&word)[1]
105 =1
106 =1 #define EZUSB_IRQ_ENABLE() EUSB = 1
107 =1 #define EZUSB_IRQ_DISABLE() EUSB = 0
108 =1 #define EZUSB_IRQ_CLEAR() EXIF &= ~0x10 // IE2_
109 =1
110 =1 #define EZUSB_STALL_EP0() EP0CS |= bmEPSTALL
111 =1 #define EZUSB_STALL_EP(ep_id) // fx2bug
112 =1 #define EZUSB_UNSTALL_EP(ep_id) // fx2bug
113 =1 #define EZUSB_GET_EP_STATUS(ep_id) // fx2bug
C51 COMPILER V8.06 FW 11/12/2007 15:20:26 PAGE 3
114 =1 #define EZUSB_SET_EP_BYTES(ep_id,count) // fx2bug
115 =1
116 =1
117 =1 // WRITEDELAY() has been replaced by SYNCDELAY; macro in fx2sdly.h
118 =1 // ...it is here for backwards compatibility...
119 =1
120 =1 // the WRITEDELAY macro compiles to the time equivalent of 3 NOPs.
121 =1 // It is used in the frameworks to allow for write recovery time
122 =1 // requirements of certain registers. This is only necessary for
123 =1 // EZ-USB FX parts. See the EZ-USB FX TRM for
124 =1 // more information on write recovery time issues.
125 =1 #define WRITEDELAY() {char writedelaydummy = 0;}
126 =1 // if this firmware will never run on an EZ-USB FX part replace
127 =1 // with:
128 =1 // #define WRITEDELAY()
129 =1
130 =1 // macro to reset and endpoint data toggle
131 =1 #define EZUSB_RESET_DATA_TOGGLE(ep) TOGCTL = (((ep & 0x80) >> 3) + (ep & 0x0F));\
132 =1 TOGCTL |= bmRESETTOGGLE
133 =1
134 =1
135 =1 #define EZUSB_ENABLE_RSMIRQ() (EICON |= 0x20) // Enable Resume Interrupt (EPFI_)
136 =1 #define EZUSB_DISABLE_RSMIRQ() (EICON &= ~0x20) // Disable Resume Interrupt (EPFI_)
137 =1 #define EZUSB_CLEAR_RSMIRQ() (EICON &= ~0x10) // Clear Resume Interrupt Flag (PFI_)
138 =1
139 =1 #define EZUSB_GETI2CSTATUS() (I2CPckt.status)
140 =1 #define EZUSB_CLEARI2CSTATUS() if((I2CPckt.status == I2C_BERROR) || (I2CPckt.status == I2C_NACK))\
141 =1 I2CPckt.status = I2C_IDLE;
142 =1
143 =1 #define EZUSB_ENABLEBP() (BREAKPT |= bmBPEN) // TGE fx2bug
144 =1 #define EZUSB_DISABLEBP() (BREAKPT &= ~bmBPEN) // TGE fx2bug
145 =1 #define EZUSB_CLEARBP() (BREAKPT |= bmBREAK) // TGE fx2bug
146 =1 #define EZUSB_BP(addr) BPADDRH = (BYTE)(((WORD)addr >> 8) & 0xff);\
147 =1 BPADDRL = (BYTE)addr // TGE fx2bug
148 =1
149 =1 #define EZUSB_EXTWAKEUP() (((WAKEUPCS & bmWU2) && (WAKEUPCS & bmWU2EN)) ||\
150 =1 ((WAKEUPCS & bmWU) && (WAKEUPCS & bmWUEN)))
151 =1 #define EZUSB_HIGHSPEED() (USBCS & bmHSM)
152 =1
153 =1 //====================================================================
154 =1 // Datatypes
155 =1 //====================================================================
156 =1 typedef unsigned char BYTE;
157 =1 typedef unsigned short WORD;
158 =1 typedef unsigned long DWORD;
159 =1 typedef bit BOOL;
160 =1
161 =1 #define INT0_VECT 0
162 =1 #define TMR0_VECT 1
163 =1 #define INT1_VECT 2
164 =1 #define TMR1_VECT 3
165 =1 #define COM0_VECT 4
166 =1 #define TMR2_VECT 5
167 =1 #define WKUP_VECT 6
168 =1 #define COM1_VECT 7
169 =1 #define USB_VECT 8
170 =1 #define I2C_VECT 9
171 =1 #define INT4_VECT 10
172 =1 #define INT5_VECT 11
173 =1 #define INT6_VECT 12
174 =1
175 =1
C51 COMPILER V8.06 FW 11/12/2007 15:20:26 PAGE 4
176 =1 // TGE fx2bug
177 =1 #define SUDAV_USBVECT (0 << 2)
178 =1 #define SOF_USBVECT (1 << 2)
179 =1 #define SUTOK_USBVECT (2 << 2)
180 =1 #define SUSP_USBVECT (3 << 2)
181 =1 #define URES_USBVECT (4 << 2)
182 =1 #define HS_USBVECT (5 << 2)
183 =1 #define EP0ACK_USBVECT (6 << 2)
184 =1 #define SPARE0_USBVECT (7 << 2)
185 =1 #define IN0BUF_USBVECT (8 << 2)
186 =1 #define OUT0BUF_USBVECT (9 << 2)
187 =1 #define IN1BUF_USBVECT (10 << 2)
188 =1 #define OUT1BUF_USBVECT (11 << 2)
189 =1 #define INOUT2BUF_USBVECT (12 << 2)
190 =1 #define INOUT4BUF_USBVECT (13 << 2)
191 =1 #define INOUT6BUF_USBVECT (14 << 2)
192 =1 #define INOUT8BUF_USBVECT (15 << 2)
193 =1 #define IBN_USBVECT (16 << 2)
194 =1 #define SPARE1_USBVECT (17 << 2)
195 =1 #define EP0PINGNAK_USBVECT (18 << 2)
196 =1 #define EP1PINGNAK_USBVECT (19 << 2)
197 =1 #define EP2PINGNAK_USBVECT (20 << 2)
198 =1 #define EP4PINGNAK_USBVECT (21 << 2)
199 =1 #define EP6PINGNAK_USBVECT (22 << 2)
200 =1 #define EP8PINGNAK_USBVECT (23 << 2)
201 =1 #define ERRLIM_USBVECT (24 << 2)
202 =1 #define SPARE2_USBVECT (25 << 2)
203 =1 #define SPARE3_USBVECT (26 << 2)
204 =1 #define SPARE4_USBVECT (27 << 2)
205 =1 #define EP2PIDERR_USBVECT (28 << 2)
206 =1 #define EP4PIDERR_USBVECT (29 << 2)
207 =1 #define EP6PIDERR_USBVECT (30 << 2)
208 =1 #define EP8PIDERR_USBVECT (31 << 2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -