📄 fw.lst
字号:
198 5 EZUSB_Susp(); // Place processor in idle mode.
199 5 }
200 4 while(!Rwuen && EZUSB_EXTWAKEUP());
201 4 // above. Must continue to go back into suspend if the host has disabled remote wakeup
202 4 // *and* the wakeup was caused by the external wakeup pin.
203 4
204 4 // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
205 4 EZUSB_Resume(); // If source is the Wakeup# pin, signal the host to Resume.
206 4 TD_Resume();
207 4 }
208 3 }
209 2
210 2 }
211 1 }
212
213 BOOL HighSpeedCapable()
214 {
215 1 // this function determines if the chip is high-speed capable.
216 1 // FX2 and FX2LP are high-speed capable. FX1 is not - it does
217 1 // not have a high-speed transceiver. The frameworks determines
218 1 // the chip's speed capability at run time to allow fx2lp and
219 1 // fx1 object code compatibilty.
220 1
221 1 if (REVID & 0xF0) // check for fx2lp/fx1 v. fx2.
222 1 {
223 2
224 2 // this is a fx2lp or fx1 because non-zero upper nibble in chip rev
225 2 // now check the capabilities register
226 2 if (GPCR2 & bmHIGHSPEEDCAPABLE)
227 2 return TRUE;
228 2 else
229 2 return FALSE;
230 2 }
231 1 else
232 1 {
233 2 // fx2 is always high-speed capable
234 2 return TRUE;
235 2 }
236 1 }
237
238 // Device request parser
239 void SetupCommand(void)
240 {
C51 COMPILER V8.08 FW 01/03/2009 20:31:02 PAGE 5
241 1 void *dscr_ptr;
242 1
243 1 switch(SETUPDAT[1])
244 1 {
245 2 case SC_GET_DESCRIPTOR: // *** Get Descriptor
246 2 if(DR_GetDescriptor())
247 2 switch(SETUPDAT[3])
248 2 {
249 3 case GD_DEVICE: // Device
250 3 SUDPTRH = MSB(pDeviceDscr);
251 3 SUDPTRL = LSB(pDeviceDscr);
252 3 break;
253 3 case GD_DEVICE_QUALIFIER: // Device Qualifier
254 3 // only retuen a device qualifier if this is a high speed
255 3 // capable chip.
256 3 if (HighSpeedCapable())
257 3 {
258 4 SUDPTRH = MSB(pDeviceQualDscr);
259 4 SUDPTRL = LSB(pDeviceQualDscr);
260 4 }
261 3 else
262 3 {
263 4 EZUSB_STALL_EP0();
264 4 }
265 3 break;
266 3 case GD_CONFIGURATION: // Configuration
267 3 SUDPTRH = MSB(pConfigDscr);
268 3 SUDPTRL = LSB(pConfigDscr);
269 3 break;
270 3 case GD_OTHER_SPEED_CONFIGURATION: // Other Speed Configuration
271 3 SUDPTRH = MSB(pOtherConfigDscr);
272 3 SUDPTRL = LSB(pOtherConfigDscr);
273 3 break;
274 3 case GD_STRING: // String
275 3 if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2]))
276 3 {
277 4 SUDPTRH = MSB(dscr_ptr);
278 4 SUDPTRL = LSB(dscr_ptr);
279 4 }
280 3 else
281 3 EZUSB_STALL_EP0(); // Stall End Point 0
282 3 break;
283 3 default: // Invalid request
284 3 EZUSB_STALL_EP0(); // Stall End Point 0
285 3 }
286 2 break;
287 2 case SC_GET_INTERFACE: // *** Get Interface
288 2 DR_GetInterface();
289 2 break;
290 2 case SC_SET_INTERFACE: // *** Set Interface
291 2 DR_SetInterface();
292 2 break;
293 2 case SC_SET_CONFIGURATION: // *** Set Configuration
294 2 DR_SetConfiguration();
295 2 break;
296 2 case SC_GET_CONFIGURATION: // *** Get Configuration
297 2 DR_GetConfiguration();
298 2 break;
299 2 case SC_GET_STATUS: // *** Get Status
300 2 if(DR_GetStatus())
301 2 switch(SETUPDAT[0])
302 2 {
C51 COMPILER V8.08 FW 01/03/2009 20:31:02 PAGE 6
303 3 case GS_DEVICE: // Device
304 3 EP0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr;
305 3 EP0BUF[1] = 0;
306 3 EP0BCH = 0;
307 3 EP0BCL = 2;
308 3 break;
309 3 case GS_INTERFACE: // Interface
310 3 EP0BUF[0] = 0;
311 3 EP0BUF[1] = 0;
312 3 EP0BCH = 0;
313 3 EP0BCL = 2;
314 3 break;
315 3 case GS_ENDPOINT: // End Point
316 3 EP0BUF[0] = *(BYTE xdata *) epcs(SETUPDAT[4]) & bmEPSTALL;
317 3 EP0BUF[1] = 0;
318 3 EP0BCH = 0;
319 3 EP0BCL = 2;
320 3 break;
321 3 default: // Invalid Command
322 3 EZUSB_STALL_EP0(); // Stall End Point 0
323 3 }
324 2 break;
325 2 case SC_CLEAR_FEATURE: // *** Clear Feature
326 2 if(DR_ClearFeature())
327 2 switch(SETUPDAT[0])
328 2 {
329 3 case FT_DEVICE: // Device
330 3 if(SETUPDAT[2] == 1)
331 3 Rwuen = FALSE; // Disable Remote Wakeup
332 3 else
333 3 EZUSB_STALL_EP0(); // Stall End Point 0
334 3 break;
335 3 case FT_ENDPOINT: // End Point
336 3 if(SETUPDAT[2] == 0)
337 3 {
338 4 *(BYTE xdata *) epcs(SETUPDAT[4]) &= ~bmEPSTALL;
339 4 EZUSB_RESET_DATA_TOGGLE( SETUPDAT[4] );
340 4 }
341 3 else
342 3 EZUSB_STALL_EP0(); // Stall End Point 0
343 3 break;
344 3 }
345 2 break;
346 2 case SC_SET_FEATURE: // *** Set Feature
347 2 if(DR_SetFeature())
348 2 switch(SETUPDAT[0])
349 2 {
350 3 case FT_DEVICE: // Device
351 3 if(SETUPDAT[2] == 1)
352 3 Rwuen = TRUE; // Enable Remote Wakeup
353 3 else if(SETUPDAT[2] == 2)
354 3 // Set Feature Test Mode. The core handles this request. However, it is
355 3 // necessary for the firmware to complete the handshake phase of the
356 3 // control transfer before the chip will enter test mode. It is also
357 3 // necessary for FX2 to be physically disconnected (D+ and D-)
358 3 // from the host before it will enter test mode.
359 3 break;
360 3 else
361 3 EZUSB_STALL_EP0(); // Stall End Point 0
362 3 break;
363 3 case FT_ENDPOINT: // End Point
364 3 *(BYTE xdata *) epcs(SETUPDAT[4]) |= bmEPSTALL;
C51 COMPILER V8.08 FW 01/03/2009 20:31:02 PAGE 7
365 3 break;
366 3 default:
367 3 EZUSB_STALL_EP0(); // Stall End Point 0
368 3 }
369 2 break;
370 2 case SC_SetData:
371 2 DR_SetData();
372 2 break;
373 2 default: // *** Invalid Command
374 2 if(DR_VendorCmnd())
375 2 EZUSB_STALL_EP0(); // Stall End Point 0
376 2 }
377 1
378 1 // Acknowledge handshake phase of device request
379 1 EP0CS |= bmHSNAK;
380 1 }
381
382 // Wake-up interrupt handler
383 void resume_isr(void) interrupt WKUP_VECT
384 {
385 1 EZUSB_CLEAR_RSMIRQ();
386 1 }
387
388
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 940 ----
CONSTANT SIZE = 10 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 14 16
IDATA SIZE = ---- ----
BIT SIZE = 4 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -