📄 periph.lst
字号:
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE PERIPH
OBJECT MODULE PLACED IN periph.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE periph.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #pragma NOIV // Do not generate interrupt vectors
2 //-----------------------------------------------------------------------------
3 // File: periph.c
4 // Contents: Hooks required to implement USB peripheral function.
5 //
6 // Copyright (c) 1997 AnchorChips, Inc. All rights reserved
7 //-----------------------------------------------------------------------------
8 #include "fx2.h"
9 #include "fx2regs.h"
10 #include "fx2sdly.h"
11 #include "io.h"
12 #include "gpif.h"
13 #include "serial.h"
14
15 extern BOOL GotSUD; // Received setup data flag
16 extern BOOL Sleep;
17 extern BOOL Rwuen;
18 extern BOOL Selfpwr;
19
20 BYTE Configuration; // Current configuration
21 BYTE AlternateSetting; // Alternate settings
22
23 //-----------------------------------------------------------------------------
24 // Task Dispatcher hooks
25 // The following hooks are called by the task dispatcher.
26 //-----------------------------------------------------------------------------
27
28 void TD_Init(void) // Called once at startup
29 {
30 1 BREAKPT &= ~bmBPEN; // to see BKPT LED go out TGE
31 1 Rwuen = TRUE; // Enable remote-wakeup
32 1 GpifInit();
33 1
34 1 // setup INT4 as internal source for GPIF interrupts
35 1 // using INT4CLR (SFR), automatically enabled
36 1 SYNCDELAY;
37 1 INTSETUP |= 0x03; // Enable INT4 FIFO/GPIF Autovectoring
38 1 SYNCDELAY; // used here as "delay"
39 1 EXIF &= ~0x40; // just in case one was pending...
40 1 SYNCDELAY; // used here as "delay"
41 1 GPIFIRQ = 0x03;
42 1 SYNCDELAY; //
43 1 GPIFIE = 0x03; // Enable GPIFDONE interrupt
44 1 SYNCDELAY; //
45 1 EIE |= 0x04; // Enable INT4 ISR, EIE.2(EIEX4=1)
46 1
47 1 }
48
49 void TD_Poll(void) // Called repeatedly while the device is idle
50 {
51 1 }
52
53 BOOL TD_Suspend(void) // Called before the device goes into suspend mode
54 {
55 1 return(TRUE);
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 2
56 1 }
57
58 BOOL TD_Resume(void) // Called after the device resumes
59 {
60 1 return(TRUE);
61 1 }
62
63 //-----------------------------------------------------------------------------
64 // Device Request hooks
65 // The following hooks are called by the end point 0 device request parser.
66 //-----------------------------------------------------------------------------
67
68 BOOL DR_GetDescriptor(void)
69 {
70 1 return(TRUE);
71 1 }
72
73 BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
74 {
75 1 Configuration = SETUPDAT[2];
76 1 return(TRUE); // Handled by user code
77 1 }
78
79 BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
80 {
81 1 EP0BUF[0] = Configuration;
82 1 EP0BCH = 0;
83 1 EP0BCL = 1;
84 1 return(TRUE); // Handled by user code
85 1 }
86
87 BOOL DR_SetInterface(void) // Called when a Set Interface command is received
88 {
89 1 AlternateSetting = SETUPDAT[2];
90 1 return(TRUE); // Handled by user code
91 1 }
92
93 BOOL DR_GetInterface(void) // Called when a Set Interface command is received
94 {
95 1 EP0BUF[0] = AlternateSetting;
96 1 EP0BCH = 0;
97 1 EP0BCL = 1;
98 1 return(TRUE); // Handled by user code
99 1 }
100
101 BOOL DR_GetStatus(void)
102 {
103 1 return(TRUE);
104 1 }
105
106 BOOL DR_ClearFeature(void)
107 {
108 1 return(TRUE);
109 1 }
110
111 BOOL DR_SetFeature(void)
112 {
113 1 return(TRUE);
114 1 }
115
116 BOOL DR_VendorCmnd(void)
117 {
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 3
118 1 return(TRUE);
119 1 }
120
121 //-----------------------------------------------------------------------------
122 // USB Interrupt Handlers
123 // The following functions are called by the USB interrupt jump table.
124 //-----------------------------------------------------------------------------
125
126 // Setup Data Available Interrupt Handler
127 void ISR_Sudav(void) interrupt 0
128 {
129 1 GotSUD = TRUE; // Set flag
130 1 EZUSB_IRQ_CLEAR();
131 1 USBIRQ = bmSUDAV; // Clear SUDAV IRQ
132 1 }
133
134 // Setup Token Interrupt Handler
135 void ISR_Sutok(void) interrupt 0
136 {
137 1 EZUSB_IRQ_CLEAR();
138 1 USBIRQ = bmSUTOK; // Clear SUTOK IRQ
139 1 }
140
141 void ISR_Sof(void) interrupt 0
142 {
143 1 EZUSB_IRQ_CLEAR();
144 1 USBIRQ = bmSOF; // Clear SOF IRQ
145 1 }
146
147 void ISR_Ures(void) interrupt 0
148 {
149 1 // whenever we get a USB reset, we should revert to full speed mode
150 1 pConfigDscr = pFullSpeedConfigDscr;
151 1 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
152 1 pOtherConfigDscr = pHighSpeedConfigDscr;
153 1 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
154 1
155 1 EZUSB_IRQ_CLEAR();
156 1 USBIRQ = bmURES; // Clear URES IRQ
157 1 }
158
159 void ISR_Susp(void) interrupt 0
160 {
161 1 Sleep = TRUE;
162 1 EZUSB_IRQ_CLEAR();
163 1 USBIRQ = bmSUSP;
164 1 }
165
166 void ISR_Highspeed(void) interrupt 0
167 {
168 1 if (EZUSB_HIGHSPEED())
169 1 {
170 2 pConfigDscr = pHighSpeedConfigDscr;
171 2 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
172 2 pOtherConfigDscr = pFullSpeedConfigDscr;
173 2 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
174 2 }
175 1
176 1 EZUSB_IRQ_CLEAR();
177 1 USBIRQ = bmHSGRANT;
178 1 }
179 void ISR_Ep0ack(void) interrupt 0
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 4
180 {
181 1 }
182 void ISR_Stub(void) interrupt 0
183 {
184 1 }
185 void ISR_Ep0in(void) interrupt 0
186 {
187 1 }
188 void ISR_Ep0out(void) interrupt 0
189 {
190 1 }
191 void ISR_Ep1in(void) interrupt 0
192 {
193 1 }
194 void ISR_Ep1out(void) interrupt 0
195 {
196 1 }
197 void ISR_Ep2inout(void) interrupt 0
198 {
199 1 }
200 void ISR_Ep4inout(void) interrupt 0
201 {
202 1 }
203 void ISR_Ep6inout(void) interrupt 0
204 {
205 1 }
206 void ISR_Ep8inout(void) interrupt 0
207 {
208 1 }
209 void ISR_Ibn(void) interrupt 0
210 {
211 1 }
212 void ISR_Ep0pingnak(void) interrupt 0
213 {
214 1 }
215 void ISR_Ep1pingnak(void) interrupt 0
216 {
217 1 }
218 void ISR_Ep2pingnak(void) interrupt 0
219 {
220 1 }
221 void ISR_Ep4pingnak(void) interrupt 0
222 {
223 1 }
224 void ISR_Ep6pingnak(void) interrupt 0
225 {
226 1 }
227 void ISR_Ep8pingnak(void) interrupt 0
228 {
229 1 }
230 void ISR_Errorlimit(void) interrupt 0
231 {
232 1 }
233 void ISR_Ep2piderror(void) interrupt 0
234 {
235 1 }
236 void ISR_Ep4piderror(void) interrupt 0
237 {
238 1 }
239 void ISR_Ep6piderror(void) interrupt 0
240 {
241 1 }
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 5
242 void ISR_Ep8piderror(void) interrupt 0
243 {
244 1 }
245 void ISR_Ep2pflag(void) interrupt 0
246 {
247 1 }
248 void ISR_Ep4pflag(void) interrupt 0
249 {
250 1 }
251 void ISR_Ep6pflag(void) interrupt 0
252 {
253 1 }
254 void ISR_Ep8pflag(void) interrupt 0
255 {
256 1 }
257 void ISR_Ep2eflag(void) interrupt 0
258 {
259 1 }
260 void ISR_Ep4eflag(void) interrupt 0
261 {
262 1 }
263 void ISR_Ep6eflag(void) interrupt 0
264 {
265 1 }
266 void ISR_Ep8eflag(void) interrupt 0
267 {
268 1 }
269 void ISR_Ep2fflag(void) interrupt 0
270 {
271 1 }
272 void ISR_Ep4fflag(void) interrupt 0
273 {
274 1 }
275 void ISR_Ep6fflag(void) interrupt 0
276 {
277 1 }
278 void ISR_Ep8fflag(void) interrupt 0
279 {
280 1 }
281 void ISR_GpifComplete(void) interrupt 0
282 {
283 1 // Serial_SendString((BYTE xdata *)"done\r",5,0);
284 1 EXIF &= ~0x40;
285 1 INT4CLR = 0xFF; // automatically enabled at POR
286 1 }
287 void ISR_GpifWaveform(void) interrupt 0
288 {
289 1 // Serial_SendString((BYTE xdata *)"int\r",4,0);
290 1 EXIF &= ~0x40;
291 1 INT4CLR = 0xFF; // automatically enabled at POR
292 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 373 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILER V7.02b PERIPH 07/11/2004 12:05:27 PAGE 6
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -