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

📄 fw.lst

📁 keil环境下编译,产生hex文件,通过EZ-USB Control Panel下载到USB芯片CY7C68013上运行
💻 LST
📖 第 1 页 / 共 2 页
字号:
 182   1         // Task Dispatcher
 183   1         while(TRUE)               // Main Loop
 184   1         {
 185   2            if(GotSUD)            // Wait for SUDAV
 186   2            {
 187   3               SetupCommand();          // Implement setup command
 188   3                 GotSUD = FALSE;            // Clear SUDAV flag
 189   3            }
 190   2      
 191   2            // Poll User Device
 192   2            // NOTE: Idle mode stops the processor clock.  There are only two
 193   2            // ways out of idle mode, the WAKEUP pin, and detection of the USB
 194   2            // resume state on the USB bus.  The timers will stop and the
 195   2            // processor will not wake up on any other interrupts.
 196   2            if (Sleep)
 197   2                {
 198   3                if(TD_Suspend())
 199   3                    { 
 200   4                    Sleep = FALSE;            // Clear the "go to sleep" flag.  Do it here to prevent any race c
             -ondition between wakeup and the next sleep.
 201   4                    do
 202   4                        {
 203   5                          EZUSB_Susp();         // Place processor in idle mode.
 204   5                        }
 205   4                      while(!Rwuen && EZUSB_EXTWAKEUP());
 206   4                      // Must continue to go back into suspend if the host has disabled remote wakeup
 207   4                      // *and* the wakeup was caused by the external wakeup pin.
 208   4                      
 209   4                   // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
 210   4                   EZUSB_Resume();   // If source is the Wakeup# pin, signal the host to Resume.      
 211   4                   TD_Resume();
 212   4                    }   
 213   3                }
 214   2            TD_Poll();
 215   2         }
 216   1      }
 217          
 218          // Device request parser
 219          void SetupCommand(void)
 220          {
 221   1         void   *dscr_ptr;
 222   1      
 223   1         switch(SETUPDAT[1])
 224   1         {
 225   2            case SC_GET_DESCRIPTOR:                  // *** Get Descriptor
 226   2               if(DR_GetDescriptor())
 227   2                  switch(SETUPDAT[3])         
 228   2                  {
 229   3                     case GD_DEVICE:            // Device
 230   3                        SUDPTRH = MSB(pDeviceDscr);
 231   3                        SUDPTRL = LSB(pDeviceDscr);
 232   3                        break;
 233   3                     case GD_DEVICE_QUALIFIER:            // Device Qualifier
 234   3                        SUDPTRH = MSB(pDeviceQualDscr);
 235   3                        SUDPTRL = LSB(pDeviceQualDscr);
 236   3                        break;
 237   3                     case GD_CONFIGURATION:         // Configuration
 238   3                        SUDPTRH = MSB(pConfigDscr);
 239   3                        SUDPTRL = LSB(pConfigDscr);
 240   3                        break;
C51 COMPILER V6.10  FW                                                                     06/04/2008 20:29:43 PAGE 5   

 241   3                     case GD_OTHER_SPEED_CONFIGURATION:  // Other Speed Configuration
 242   3                        SUDPTRH = MSB(pOtherConfigDscr);
 243   3                        SUDPTRL = LSB(pOtherConfigDscr);
 244   3                        break;
 245   3                     case GD_STRING:            // String
 246   3                        if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2]))
 247   3                        {
 248   4                           SUDPTRH = MSB(dscr_ptr);
 249   4                           SUDPTRL = LSB(dscr_ptr);
 250   4                        }
 251   3                        else 
 252   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 253   3                        break;
 254   3                     default:            // Invalid request
 255   3                        EZUSB_STALL_EP0();      // Stall End Point 0
 256   3                  }
 257   2               break;
 258   2            case SC_GET_INTERFACE:                  // *** Get Interface
 259   2               DR_GetInterface();
 260   2               break;
 261   2            case SC_SET_INTERFACE:                  // *** Set Interface
 262   2               DR_SetInterface();
 263   2               break;
 264   2            case SC_SET_CONFIGURATION:               // *** Set Configuration
 265   2               DR_SetConfiguration();
 266   2               break;
 267   2            case SC_GET_CONFIGURATION:               // *** Get Configuration
 268   2               DR_GetConfiguration();
 269   2               break;
 270   2            case SC_GET_STATUS:                  // *** Get Status
 271   2               if(DR_GetStatus())
 272   2                  switch(SETUPDAT[0])
 273   2                  {
 274   3                     case GS_DEVICE:            // Device
 275   3                        EP0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr;
 276   3                        EP0BUF[1] = 0;
 277   3                        EP0BCH = 0;
 278   3                        EP0BCL = 2;
 279   3                        break;
 280   3                     case GS_INTERFACE:         // Interface
 281   3                        EP0BUF[0] = 0;
 282   3                        EP0BUF[1] = 0;
 283   3                        EP0BCH = 0;
 284   3                        EP0BCL = 2;
 285   3                        break;
 286   3                     case GS_ENDPOINT:         // End Point
 287   3                        EP0BUF[0] = *(BYTE xdata *) epcs(SETUPDAT[4]) & bmEPSTALL;
 288   3                        EP0BUF[1] = 0;
 289   3                        EP0BCH = 0;
 290   3                        EP0BCL = 2;
 291   3                        break;
 292   3                     default:            // Invalid Command
 293   3                        EZUSB_STALL_EP0();      // Stall End Point 0
 294   3                  }
 295   2               break;
 296   2            case SC_CLEAR_FEATURE:                  // *** Clear Feature
 297   2               if(DR_ClearFeature())
 298   2                  switch(SETUPDAT[0])
 299   2                  {
 300   3                     case FT_DEVICE:            // Device
 301   3                        if(SETUPDAT[2] == 1)
 302   3                           Rwuen = FALSE;       // Disable Remote Wakeup
C51 COMPILER V6.10  FW                                                                     06/04/2008 20:29:43 PAGE 6   

 303   3                        else
 304   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 305   3                        break;
 306   3                     case FT_ENDPOINT:         // End Point
 307   3                        if(SETUPDAT[2] == 0)
 308   3                        {
 309   4                           *(BYTE xdata *) epcs(SETUPDAT[4]) &= ~bmEPSTALL;
 310   4                           EZUSB_RESET_DATA_TOGGLE( SETUPDAT[4] );
 311   4                        }
 312   3                        else
 313   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 314   3                        break;
 315   3                  }
 316   2               break;
 317   2            case SC_SET_FEATURE:                  // *** Set Feature
 318   2               if(DR_SetFeature())
 319   2                  switch(SETUPDAT[0])
 320   2                  {
 321   3                     case FT_DEVICE:            // Device
 322   3                        if(SETUPDAT[2] == 1)
 323   3                           Rwuen = TRUE;      // Enable Remote Wakeup
 324   3                        else if(SETUPDAT[2] == 2)
 325   3                           // Set Feature Test Mode.  The core handles this request.  However, it is
 326   3                           // necessary for the firmware to complete the handshake phase of the
 327   3                           // control transfer before the chip will enter test mode.  It is also
 328   3                           // necessary for FX2 to be physically disconnected (D+ and D-)
 329   3                           // from the host before it will enter test mode.
 330   3                           break;
 331   3                        else
 332   3                           EZUSB_STALL_EP0();   // Stall End Point 0
 333   3                        break;
 334   3                     case FT_ENDPOINT:         // End Point
 335   3                        *(BYTE xdata *) epcs(SETUPDAT[4]) |= bmEPSTALL;
 336   3                        break;
 337   3                  }
 338   2               break;
 339   2            default:                     // *** Invalid Command
 340   2               if(DR_VendorCmnd())
 341   2                  EZUSB_STALL_EP0();            // Stall End Point 0
 342   2         }
 343   1      
 344   1         // Acknowledge handshake phase of device request
 345   1         EP0CS |= bmHSNAK;
 346   1      }
 347          
 348          // Wake-up interrupt handler
 349          void resume_isr(void) interrupt WKUP_VECT
 350          {
 351   1         EZUSB_CLEAR_RSMIRQ();
 352   1      }
 353          
 354          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1095    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     14      16
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      4    ----
C51 COMPILER V6.10  FW                                                                     06/04/2008 20:29:43 PAGE 7   

END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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