📄 periph.lst
字号:
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 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 "serial.h"
13
14 extern BOOL GotSUD; // Received setup data flag
15 extern BOOL Sleep;
16 extern BOOL Rwuen;
17 extern BOOL Selfpwr;
18
19 BYTE Configuration; // Current configuration
20 BYTE AlternateSetting; // Alternate settings
21
22 extern BYTE ReceiveFrameFlag;
23
24 //-----------------------------------------------------------------------------
25 // Task Dispatcher hooks
26 // The following hooks are called by the task dispatcher.
27 //-----------------------------------------------------------------------------
28
29 void TD_Init(void) // Called once at startup
30 {
31 1 BREAKPT &= ~bmBPEN; // to see BKPT LED go out TGE
32 1 Rwuen = TRUE; // Enable remote-wakeup
33 1
34 1 EP1OUTCFG = 0xA0; //EP1OUT VALID BULK
35 1 SYNCDELAY;
36 1 EP1INCFG = 0xA0; //EP1IN VALID BULK
37 1
38 1
39 1 EPIRQ = 0xFF;
40 1 SYNCDELAY;
41 1 EPIE |= 0x0C; //enable the ep1 in out interrupt*/
42 1
43 1 /* SYNCDELAY;
44 1 NAKIRQ = bmBIT0; // clear the global IBN IRQ
45 1 SYNCDELAY;
46 1 NAKIE |= bmBIT0; // enable the global IBN IRQ
47 1
48 1 IBNIRQ = 0xFF; // clear any pending IBN IRQ
49 1 SYNCDELAY;
50 1 IBNIE |= bmEP1IBN; // enable the IBN interrupt for EP1
51 1 */
52 1 EP1OUTBC = 0; //ep1out can receive data
53 1 }
54
55 void TD_Poll(void) // Called repeatedly while the device is idle
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 PAGE 2
56 {
57 1 WORD length,bc;
58 1 BYTE i;
59 1 BYTE xdata *point;
60 1
61 1 point = ReceiveBuf0;
62 1 if(ReceiveFrameFlag == 1)
63 1 {
64 2 ReceiveFrameFlag = 0;
65 2 length = ReceiveCount0;
66 2 while(length) // Move requested data through EP0IN
67 2 {
68 3 // one packet at a time.
69 3 if(length < 64)
70 3 bc = length;
71 3 else
72 3 bc = 64;
73 3 for(i=0; i<bc; i++)
74 3 *(EP1INBUF+i) = *(point+i);
75 3 //set length and arm Endpoint
76 3 EP1INBC = bc;
77 3 length -= bc;
78 3 point += bc;
79 3 while(EP1INCS & bmEPBUSY);
80 3 }
81 2 EP1INBC = 0;
82 2 ReceiveCount0 = 0;
83 2 }
84 1 }
85
86 BOOL TD_Suspend(void) // Called before the device goes into suspend mode
87 {
88 1 return(TRUE);
89 1 }
90
91 BOOL TD_Resume(void) // Called after the device resumes
92 {
93 1 return(TRUE);
94 1 }
95
96 //-----------------------------------------------------------------------------
97 // Device Request hooks
98 // The following hooks are called by the end point 0 device request parser.
99 //-----------------------------------------------------------------------------
100
101 BOOL DR_GetDescriptor(void)
102 {
103 1 return(TRUE);
104 1 }
105
106 BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
107 {
108 1 Configuration = SETUPDAT[2];
109 1 return(TRUE); // Handled by user code
110 1 }
111
112 BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
113 {
114 1 EP0BUF[0] = Configuration;
115 1 EP0BCH = 0;
116 1 EP0BCL = 1;
117 1 return(TRUE); // Handled by user code
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 PAGE 3
118 1 }
119
120 BOOL DR_SetInterface(void) // Called when a Set Interface command is received
121 {
122 1 AlternateSetting = SETUPDAT[2];
123 1 return(TRUE); // Handled by user code
124 1 }
125
126 BOOL DR_GetInterface(void) // Called when a Set Interface command is received
127 {
128 1 EP0BUF[0] = AlternateSetting;
129 1 EP0BCH = 0;
130 1 EP0BCL = 1;
131 1 return(TRUE); // Handled by user code
132 1 }
133
134 BOOL DR_GetStatus(void)
135 {
136 1 return(TRUE);
137 1 }
138
139 BOOL DR_ClearFeature(void)
140 {
141 1 return(TRUE);
142 1 }
143
144 BOOL DR_SetFeature(void)
145 {
146 1 return(TRUE);
147 1 }
148
149 BOOL DR_VendorCmnd(void)
150 {
151 1 return(TRUE);
152 1 }
153
154 //-----------------------------------------------------------------------------
155 // USB Interrupt Handlers
156 // The following functions are called by the USB interrupt jump table.
157 //-----------------------------------------------------------------------------
158
159 // Setup Data Available Interrupt Handler
160 void ISR_Sudav(void) interrupt 0
161 {
162 1 GotSUD = TRUE; // Set flag
163 1 EZUSB_IRQ_CLEAR();
164 1 USBIRQ = bmSUDAV; // Clear SUDAV IRQ
165 1 }
166
167 // Setup Token Interrupt Handler
168 void ISR_Sutok(void) interrupt 0
169 {
170 1 EZUSB_IRQ_CLEAR();
171 1 USBIRQ = bmSUTOK; // Clear SUTOK IRQ
172 1 }
173
174 void ISR_Sof(void) interrupt 0
175 {
176 1 EZUSB_IRQ_CLEAR();
177 1 USBIRQ = bmSOF; // Clear SOF IRQ
178 1 }
179
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 PAGE 4
180 void ISR_Ures(void) interrupt 0
181 {
182 1 // whenever we get a USB reset, we should revert to full speed mode
183 1 pConfigDscr = pFullSpeedConfigDscr;
184 1 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
185 1 pOtherConfigDscr = pHighSpeedConfigDscr;
186 1 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
187 1
188 1 EZUSB_IRQ_CLEAR();
189 1 USBIRQ = bmURES; // Clear URES IRQ
190 1 }
191
192 void ISR_Susp(void) interrupt 0
193 {
194 1 Sleep = TRUE;
195 1 EZUSB_IRQ_CLEAR();
196 1 USBIRQ = bmSUSP;
197 1 }
198
199 void ISR_Highspeed(void) interrupt 0
200 {
201 1 if (EZUSB_HIGHSPEED())
202 1 {
203 2 pConfigDscr = pHighSpeedConfigDscr;
204 2 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
205 2 pOtherConfigDscr = pFullSpeedConfigDscr;
206 2 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
207 2 }
208 1
209 1 EZUSB_IRQ_CLEAR();
210 1 USBIRQ = bmHSGRANT;
211 1 }
212 void ISR_Ep0ack(void) interrupt 0
213 {
214 1 }
215 void ISR_Stub(void) interrupt 0
216 {
217 1 }
218 void ISR_Ep0in(void) interrupt 0
219 {
220 1 }
221 void ISR_Ep0out(void) interrupt 0
222 {
223 1 }
224 void ISR_Ep1in(void) interrupt 0
225 {
226 1 EZUSB_IRQ_CLEAR();
227 1 EPIRQ = 0x04;
228 1 }
229 void ISR_Ep1out(void) interrupt 0
230 {
231 1 Serial_SendString(EP1OUTBUF,EP1OUTBC,0);
232 1 EP1OUTBC = 0;
233 1 EZUSB_IRQ_CLEAR();
234 1 EPIRQ = 0x08;
235 1 }
236 void ISR_Ep2inout(void) interrupt 0
237 {
238 1 }
239 void ISR_Ep4inout(void) interrupt 0
240 {
241 1 }
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 PAGE 5
242 void ISR_Ep6inout(void) interrupt 0
243 {
244 1 }
245 void ISR_Ep8inout(void) interrupt 0
246 {
247 1 }
248 void ISR_Ibn(void) interrupt 0
249 {
250 1 }
251 void ISR_Ep0pingnak(void) interrupt 0
252 {
253 1 }
254 void ISR_Ep1pingnak(void) interrupt 0
255 {
256 1 }
257 void ISR_Ep2pingnak(void) interrupt 0
258 {
259 1 }
260 void ISR_Ep4pingnak(void) interrupt 0
261 {
262 1 }
263 void ISR_Ep6pingnak(void) interrupt 0
264 {
265 1 }
266 void ISR_Ep8pingnak(void) interrupt 0
267 {
268 1 }
269 void ISR_Errorlimit(void) interrupt 0
270 {
271 1 }
272 void ISR_Ep2piderror(void) interrupt 0
273 {
274 1 }
275 void ISR_Ep4piderror(void) interrupt 0
276 {
277 1 }
278 void ISR_Ep6piderror(void) interrupt 0
279 {
280 1 }
281 void ISR_Ep8piderror(void) interrupt 0
282 {
283 1 }
284 void ISR_Ep2pflag(void) interrupt 0
285 {
286 1 }
287 void ISR_Ep4pflag(void) interrupt 0
288 {
289 1 }
290 void ISR_Ep6pflag(void) interrupt 0
291 {
292 1 }
293 void ISR_Ep8pflag(void) interrupt 0
294 {
295 1 }
296 void ISR_Ep2eflag(void) interrupt 0
297 {
298 1 }
299 void ISR_Ep4eflag(void) interrupt 0
300 {
301 1 }
302 void ISR_Ep6eflag(void) interrupt 0
303 {
C51 COMPILER V7.02b PERIPH 06/30/2004 15:14:11 PAGE 6
304 1 }
305 void ISR_Ep8eflag(void) interrupt 0
306 {
307 1 }
308 void ISR_Ep2fflag(void) interrupt 0
309 {
310 1 }
311 void ISR_Ep4fflag(void) interrupt 0
312 {
313 1 }
314 void ISR_Ep6fflag(void) interrupt 0
315 {
316 1 }
317 void ISR_Ep8fflag(void) interrupt 0
318 {
319 1 }
320 void ISR_GpifComplete(void) interrupt 0
321 {
322 1
323 1 }
324 void ISR_GpifWaveform(void) interrupt 0
325 {
326 1
327 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 590 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 2 4
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -