fw.i

来自「Loops back EP2OUT to EP6IN and EP4OUT to」· I 代码 · 共 1,676 行 · 第 1/2 页

I
1,676
字号
 sbit OV    = 0xD0+2; sbit RS0   = 0xD0+3; sbit RS1   = 0xD0+4; sbit F0    = 0xD0+5; sbit AC    = 0xD0+6; sbit CY    = 0xD0+7; sfr EICON  = 0xD8;    sbit INT6  = 0xD8+3; sbit RESI  = 0xD8+4; sbit ERESI = 0xD8+5; sbit SMOD1 = 0xD8+7; sfr ACC    = 0xE0; sfr EIE    = 0xE8;    sbit EUSB    = 0xE8+0; sbit EI2C    = 0xE8+1; sbit EIEX4   = 0xE8+2; sbit EIEX5   = 0xE8+3; sbit EIEX6   = 0xE8+4; sfr B      = 0xF0; sfr EIP    = 0xF8;    sbit PUSB    = 0xF8+0; sbit PI2C    = 0xF8+1; sbit EIPX4   = 0xF8+2; sbit EIPX5   = 0xF8+3; sbit EIPX6   = 0xF8+4;                                                                                                                                                        #line 14 "fw.c" /0                                  #line 1 "fx2sdly.h" /0           #line 1 "C:\KEIL\C51\INC\INTRINS.H" /0      extern void          _nop_     (void); extern bit           _testbit_ (bit); extern unsigned char _cror_    (unsigned char, unsigned char); extern unsigned int  _iror_    (unsigned int,  unsigned char); extern unsigned long _lror_    (unsigned long, unsigned char); extern unsigned char _crol_    (unsigned char, unsigned char); extern unsigned int  _irol_    (unsigned int,  unsigned char); extern unsigned long _lrol_    (unsigned long, unsigned char); extern unsigned char _chkfloat_(float); extern void          _push_    (unsigned char _sfr); extern void          _pop_     (unsigned char _sfr);   #line 10 "fx2sdly.h" /0                     #line 31 "fx2sdly.h" /1   #line 33 "fx2sdly.h" /0   #line 36 "fx2sdly.h" /1   #line 38 "fx2sdly.h" /0  #line 40 "fx2sdly.h" /1  #line 42 "fx2sdly.h" /0  #line 44 "fx2sdly.h" /1  #line 46 "fx2sdly.h" /0  #line 48 "fx2sdly.h" /1      #line 54 "fx2sdly.h" /0     #line 59 "fx2sdly.h" /1   #line 61 "fx2sdly.h" /0  #line 63 "fx2sdly.h" /1   #line 66 "fx2sdly.h" /0      #line 74 "fx2sdly.h" /1   #line 79 "fx2sdly.h" /0  #line 81 "fx2sdly.h" /1   #line 87 "fx2sdly.h" /0  #line 89 "fx2sdly.h" /1   #line 96 "fx2sdly.h" /0  #line 98 "fx2sdly.h" /1   #line 106 "fx2sdly.h" /0  #line 108 "fx2sdly.h" /1   #line 117 "fx2sdly.h" /0  #line 119 "fx2sdly.h" /1   #line 129 "fx2sdly.h" /0  #line 131 "fx2sdly.h" /1   #line 142 "fx2sdly.h" /0  #line 144 "fx2sdly.h" /1   #line 156 "fx2sdly.h" /0  #line 158 "fx2sdly.h" /1   #line 171 "fx2sdly.h" /0  #line 173 "fx2sdly.h" /1   #line 187 "fx2sdly.h" /0  #line 189 "fx2sdly.h" /1   #line 204 "fx2sdly.h" /0  #line 206 "fx2sdly.h" /1   #line 222 "fx2sdly.h" /0  #line 224 "fx2sdly.h" /1   #line 46 "fw.c" /0#line 46 "fw.c" /0      volatile BOOL   GotSUD; BOOL      Rwuen; BOOL      Selfpwr; volatile BOOL   Sleep;                     WORD   pDeviceDscr;     WORD   pDeviceQualDscr; WORD   pHighSpeedConfigDscr; WORD   pFullSpeedConfigDscr;    WORD   pConfigDscr; WORD   pOtherConfigDscr;    WORD   pStringDscr;        void SetupCommand(void); void TD_Init(void); void TD_Poll(void); BOOL TD_Suspend(void); BOOL TD_Resume(void);  BOOL DR_GetDescriptor(void); BOOL DR_SetConfiguration(void); BOOL DR_GetConfiguration(void); BOOL DR_SetInterface(void); BOOL DR_GetInterface(void); BOOL DR_GetStatus(void); BOOL DR_ClearFeature(void); BOOL DR_SetFeature(void); BOOL DR_VendorCmnd(void);   const char code  EPCS_Offset_Lookup_Table[] = { 0,      1,      2,      2,      3,      3,      4,      4,      5,      5,      };          void main(void) { DWORD   i; WORD   offset; DWORD   DevDescrLen; DWORD   j=0; WORD   IntDescrAddr; WORD   ExtDescrAddr;   Sleep = 0;                 Rwuen = 0;                 Selfpwr = 0;              GotSUD = 0;                   TD_Init();        pDeviceDscr = (WORD)&DeviceDscr; pDeviceQualDscr = (WORD)&DeviceQualDscr; pHighSpeedConfigDscr = (WORD)&HighSpeedConfigDscr; pFullSpeedConfigDscr = (WORD)&FullSpeedConfigDscr; pStringDscr = (WORD)&StringDscr;  if ((WORD)&DeviceDscr & 0xe000) { IntDescrAddr = 0x0080; ExtDescrAddr = (WORD)&DeviceDscr; DevDescrLen = (WORD)&UserDscr - (WORD)&DeviceDscr + 2; for (i = 0; i < DevDescrLen; i++) *((BYTE xdata *)IntDescrAddr+i) = 0xCD; for (i = 0; i < DevDescrLen; i++) *((BYTE xdata *)IntDescrAddr+i) = *((BYTE xdata *)ExtDescrAddr+i); pDeviceDscr = IntDescrAddr; offset = (WORD)&DeviceDscr - 0x0080; pDeviceQualDscr -= offset; pConfigDscr -= offset; pOtherConfigDscr -= offset; pHighSpeedConfigDscr -= offset; pFullSpeedConfigDscr -= offset; pStringDscr -= offset; }   EUSB = 1;               (EICON |= 0x20);               INTSETUP |= (0x08 | 0x01);        USBIE |= 0x01 | 0x04 | 0x08 | 0x10 | 0x20;     EA = 1;                         if(!(USBCS & 0x02)) { EZUSB_Discon(1);     }      USBCS &=~0x08;  CKCON = (CKCON&(~0x07)) | 0x0;     Sleep = 0;   while(1)                 { if(GotSUD)              { SetupCommand();            GotSUD = 0;              }       if (Sleep) { if(TD_Suspend()) {  Sleep = 0;              do { EZUSB_Susp();           } while(!Rwuen && (((WAKEUPCS & 0x80) && (WAKEUPCS & 0x02)) || ((WAKEUPCS & 0x40) && (WAKEUPCS & 0x01))));     EZUSB_Resume();     TD_Resume(); }    } TD_Poll(); } }   void SetupCommand(void) { void   *dscr_ptr;  switch(SETUPDAT[1]) { case 0x06:                    if(DR_GetDescriptor()) switch(SETUPDAT[3])          { case 0x01:              SUDPTRH = (BYTE)(((WORD)(pDeviceDscr) >> 8) & 0xff); SUDPTRL = (BYTE)((WORD)(pDeviceDscr) & 0xff); break; case 0x06:              SUDPTRH = (BYTE)(((WORD)(pDeviceQualDscr) >> 8) & 0xff); SUDPTRL = (BYTE)((WORD)(pDeviceQualDscr) & 0xff); break; case 0x02:           SUDPTRH = (BYTE)(((WORD)(pConfigDscr) >> 8) & 0xff); SUDPTRL = (BYTE)((WORD)(pConfigDscr) & 0xff); break; case 0x07:    SUDPTRH = (BYTE)(((WORD)(pOtherConfigDscr) >> 8) & 0xff); SUDPTRL = (BYTE)((WORD)(pOtherConfigDscr) & 0xff); break; case 0x03:              if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2])) { SUDPTRH = (BYTE)(((WORD)(dscr_ptr) >> 8) & 0xff); SUDPTRL = (BYTE)((WORD)(dscr_ptr) & 0xff); } else   EP0CS |= 0x01;     break; default:               EP0CS |= 0x01;        } break; case 0x0a:                    DR_GetInterface(); break; case 0x0b:                    DR_SetInterface(); break; case 0x09:                 DR_SetConfiguration(); break; case 0x08:                 DR_GetConfiguration(); break; case 0x00:                    if(DR_GetStatus()) switch(SETUPDAT[0]) { case 0x80:              EP0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr; EP0BUF[1] = 0; EP0BCH = 0; EP0BCL = 2; break; case 0x81:           EP0BUF[0] = 0; EP0BUF[1] = 0; EP0BCH = 0; EP0BCL = 2; break; case 0x82:           EP0BUF[0] = *(BYTE xdata *) (EPCS_Offset_Lookup_Table[(SETUPDAT[4] & 0x7E) | (SETUPDAT[4] > 128)] + 0xE6A1) & 0x01; EP0BUF[1] = 0; EP0BCH = 0; EP0BCL = 2; break; default:               EP0CS |= 0x01;        } break; case 0x01:                    if(DR_ClearFeature()) switch(SETUPDAT[0]) { case 0x00:              if(SETUPDAT[2] == 1) Rwuen = 0;         else  EP0CS |= 0x01;     break; case 0x02:           if(SETUPDAT[2] == 0) { *(BYTE xdata *) (EPCS_Offset_Lookup_Table[(SETUPDAT[4] & 0x7E) | (SETUPDAT[4] > 128)] + 0xE6A1) &= ~0x01;  TOGCTL = (((SETUPDAT[4] & 0x80) >> 3) + (SETUPDAT[4] & 0x0F)); TOGCTL |= 0x20; } else  EP0CS |= 0x01;     break; } break; case 0x03:                    if(DR_SetFeature()) switch(SETUPDAT[0]) { case 0x00:              if(SETUPDAT[2] == 1) Rwuen = 1;        else if(SETUPDAT[2] == 2)      break; else  EP0CS |= 0x01;     break; case 0x02:           *(BYTE xdata *) (EPCS_Offset_Lookup_Table[(SETUPDAT[4] & 0x7E) | (SETUPDAT[4] > 128)] + 0xE6A1) |= 0x01; break; } break; default:                       if(DR_VendorCmnd())  EP0CS |= 0x01;              }   EP0CS |= 0x80; }   void resume_isr(void) interrupt 6 {  (EICON &= ~0x10); }  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?