⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fw.lst

📁 呵呵
💻 LST
📖 第 1 页 / 共 2 页
字号:
 230   2                {
 231   3                if(TD_Suspend())
 232   3                    { 
 233   4                    Sleep = FALSE;            // Clear the "go to sleep" flag.  Do it here to prevent any race c
             -ondition between wakeup and the next sleep.
 234   4                    do
 235   4                        {
 236   5                          EZUSB_Susp();         // Place processor in idle mode.
 237   5                        }
 238   4                      while(!Rwuen && EZUSB_EXTWAKEUP());
 239   4                      // Must continue to go back into suspend if the host has disabled remote wakeup
 240   4                      // *and* the wakeup was caused by the external wakeup pin.
C51 COMPILER V7.07   FW                                                                    12/25/2006 14:02:13 PAGE 5   

 241   4                      
 242   4                   // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
 243   4                   EZUSB_Resume();   // If source is the Wakeup# pin, signal the host to Resume.      
 244   4                   TD_Resume();
 245   4                    }   
 246   3                }
 247   2            TD_Poll();
 248   2               // Led_Display();
 249   2                //temp_data = OKey_RP_Scan();
 250   2                //if(temp_data != 0xFF)
 251   2               // {
 252   2                //    OKey_Value = temp_data;
 253   2                //}
 254   2         }
 255   1      }
 256          
 257          // Device request parser
 258          void SetupCommand(void)
 259          {
 260   1         void   *dscr_ptr;
 261   1      
 262   1         switch(SETUPDAT[1])
 263   1         {
 264   2            case SC_GET_DESCRIPTOR:                  // *** Get Descriptor
 265   2               if(DR_GetDescriptor())
 266   2                  switch(SETUPDAT[3])         
 267   2                  {
 268   3                     case GD_DEVICE:            // Device
 269   3                        SUDPTRH = MSB(pDeviceDscr);
 270   3                        SUDPTRL = LSB(pDeviceDscr);
 271   3                        break;
 272   3                     case GD_DEVICE_QUALIFIER:            // Device Qualifier
 273   3                        SUDPTRH = MSB(pDeviceQualDscr);
 274   3                        SUDPTRL = LSB(pDeviceQualDscr);
 275   3                        break;
 276   3                     case GD_CONFIGURATION:         // Configuration
 277   3                        SUDPTRH = MSB(pConfigDscr);
 278   3                        SUDPTRL = LSB(pConfigDscr);
 279   3                        break;
 280   3                     case GD_OTHER_SPEED_CONFIGURATION:  // Other Speed Configuration
 281   3                        SUDPTRH = MSB(pOtherConfigDscr);
 282   3                        SUDPTRL = LSB(pOtherConfigDscr);
 283   3                        break;
 284   3                     case GD_STRING:            // String
 285   3                        if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2]))
 286   3                        {
 287   4                           SUDPTRH = MSB(dscr_ptr);
 288   4                           SUDPTRL = LSB(dscr_ptr);
 289   4                        }
 290   3                        else 
 291   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 292   3                        break;
 293   3                     default:            // Invalid request
 294   3                        EZUSB_STALL_EP0();      // Stall End Point 0
 295   3                  }
 296   2               break;
 297   2            case SC_GET_INTERFACE:                  // *** Get Interface
 298   2               DR_GetInterface();
 299   2               break;
 300   2            case SC_SET_INTERFACE:                  // *** Set Interface
 301   2               DR_SetInterface();
 302   2               break;
C51 COMPILER V7.07   FW                                                                    12/25/2006 14:02:13 PAGE 6   

 303   2            case SC_SET_CONFIGURATION:               // *** Set Configuration
 304   2               DR_SetConfiguration();
 305   2               break;
 306   2            case SC_GET_CONFIGURATION:               // *** Get Configuration
 307   2               DR_GetConfiguration();
 308   2               break;
 309   2            case SC_GET_STATUS:                  // *** Get Status
 310   2               if(DR_GetStatus())
 311   2                  switch(SETUPDAT[0])
 312   2                  {
 313   3                     case GS_DEVICE:            // Device
 314   3                        EP0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr;
 315   3                        EP0BUF[1] = 0;
 316   3                        EP0BCH = 0;
 317   3                        EP0BCL = 2;
 318   3                        break;
 319   3                     case GS_INTERFACE:         // Interface
 320   3                        EP0BUF[0] = 0;
 321   3                        EP0BUF[1] = 0;
 322   3                        EP0BCH = 0;
 323   3                        EP0BCL = 2;
 324   3                        break;
 325   3                     case GS_ENDPOINT:         // End Point
 326   3                        EP0BUF[0] = *(BYTE xdata *) epcs(SETUPDAT[4]) & bmEPSTALL;
 327   3                        EP0BUF[1] = 0;
 328   3                        EP0BCH = 0;
 329   3                        EP0BCL = 2;
 330   3                        break;
 331   3                     default:            // Invalid Command
 332   3                        EZUSB_STALL_EP0();      // Stall End Point 0
 333   3                  }
 334   2               break;
 335   2            case SC_CLEAR_FEATURE:                  // *** Clear Feature
 336   2               if(DR_ClearFeature())
 337   2                  switch(SETUPDAT[0])
 338   2                  {
 339   3                     case FT_DEVICE:            // Device
 340   3                        if(SETUPDAT[2] == 1)
 341   3                           Rwuen = FALSE;       // Disable Remote Wakeup
 342   3                        else
 343   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 344   3                        break;
 345   3                     case FT_ENDPOINT:         // End Point
 346   3                        if(SETUPDAT[2] == 0)
 347   3                        {
 348   4                           *(BYTE xdata *) epcs(SETUPDAT[4]) &= ~bmEPSTALL;
 349   4                           EZUSB_RESET_DATA_TOGGLE( SETUPDAT[4] );
 350   4                        }
 351   3                        else
 352   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 353   3                        break;
 354   3                  }
 355   2               break;
 356   2            case SC_SET_FEATURE:                  // *** Set Feature
 357   2               if(DR_SetFeature())
 358   2                  switch(SETUPDAT[0])
 359   2                  {
 360   3                     case FT_DEVICE:            // Device
 361   3                        if(SETUPDAT[2] == 1)
 362   3                           Rwuen = TRUE;      // Enable Remote Wakeup
 363   3                        else if(SETUPDAT[2] == 2)
 364   3                           // Set Feature Test Mode.  The core handles this request.  However, it is
C51 COMPILER V7.07   FW                                                                    12/25/2006 14:02:13 PAGE 7   

 365   3                           // necessary for the firmware to complete the handshake phase of the
 366   3                           // control transfer before the chip will enter test mode.  It is also
 367   3                           // necessary for FX2 to be physically disconnected (D+ and D-)
 368   3                           // from the host before it will enter test mode.
 369   3                           break;
 370   3                        else
 371   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 372   3                        break;
 373   3                     case FT_ENDPOINT:         // End Point
 374   3                        *(BYTE xdata *) epcs(SETUPDAT[4]) |= bmEPSTALL;
 375   3                        break;
 376   3                  }
 377   2               break;
 378   2            default:                     // *** Invalid Command
 379   2               if(DR_VendorCmnd())
 380   2                  EZUSB_STALL_EP0();            // Stall End Point 0
 381   2         }
 382   1      
 383   1         // Acknowledge handshake phase of device request
 384   1         EP0CS |= bmHSNAK;
 385   1      }
 386          
 387          // Wake-up interrupt handler
 388          void resume_isr(void) interrupt WKUP_VECT
 389          {
 390   1         EZUSB_CLEAR_RSMIRQ();
 391   1      }
 392          
 393          void timer0_isr(void) interrupt TMR0_VECT
 394          {
 395   1        if (((IOD&0x08)!=1)&&((IOB&0x80)!=0)&&(data_enable!=1) )  //IOD.3=low and IOB.7=low
 396   1        { //AD_BUSY low ,clk rasing  
 397   2           switch (AD_State)//(M)
 398   2               {case 0:   //send command word
 399   3                        if(AD_Cfg_State<8)
 400   3                        {
 401   4                                    AD_Cfg_Pin=AD_Cfg_Byte&0x01;   AD_Cfg_Byte=AD_Cfg_Byte>>1;AD_Cfg_State++; }
 402   3                         else
 403   3                         {
 404   4                                AD_Cfg_State=0; AD_State=1; }
 405   3                        IOB=~IOB; 
 406   3                    break;
 407   3                        case 1:   //recive AD result
 408   3                               if(AD_Rec_State<12)
 409   3                       {
 410   4                               AD_Rec_Data=IOD&0x01; tmp_data=(AD_Rec_Data|tmp_data);AD_Rec_State++; }
 411   3                       else
 412   3                       { 
 413   4                                        AD_Rec_State=0; AD_State=0;/*M=1; W2=1;*///enable USB read data
 414   4                        ChannelNum=AD_Channel<<12;
 415   4                                        AD_Result=tmp_data|ChannelNum;
 416   4                                    data_enable=1;
 417   4                        tmp_data=0x0000;//clear
 418   4                                                        //Siwth AD Config Byte
 419   4                       /*     switch (Channel_Cha)
 420   4                               {case 0:
 421   4                                      AD_Channel++; 
 422   4                                              if(AD_Channel>3) {AD_Channel=0;Channel_Cha=1;}
 423   4                                              AD_Cfg_Byte=CON[AD_Channel]; 
 424   4                                               break;
 425   4                             case 1:
 426   4                                      AD_Channel=2;
C51 COMPILER V7.07   FW                                                                    12/25/2006 14:02:13 PAGE 8   

 427   4                                              AD_Cfg_Byte=CON[AD_Channel];
 428   4                                              Channel_Cha=0;
 429   4                          AD_Channel=0;
 430   4                                              break;
 431   4                               }*/
 432   4                                 AD_Channel++;
 433   4                    // AD_Channel=2;
 434   4                                 if(AD_Channel>3) {AD_Channel=0;}
 435   4                                          AD_Cfg_Byte=CON[AD_Channel];
 436   4                            }
 437   3                        tmp_data=tmp_data<<1;  
 438   3                                IOB=~IOB;
 439   3                                break;
 440   3                 }
 441   2       }
 442   1       else 
 443   1         IOB=~IOB;
 444   1      }
 445          
 446          
 447          
 448          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1294    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     34      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 + -