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

📄 fw.lst

📁 基于MSP430的CYpress USB芯片68013的开发
💻 LST
📖 第 1 页 / 共 2 页
字号:
 187   3               { 
 188   4                  Sleep = FALSE;     // Clear the "go to sleep" flag.  Do it here to prevent any race condition 
             -between wakeup and the next sleep.
 189   4                  do
 190   4                  {
 191   5                     EZUSB_Susp();         // Place processor in idle mode.
 192   5                  }
 193   4                  while(!Rwuen && EZUSB_EXTWAKEUP());
 194   4                  // above.  Must continue to go back into suspend if the host has disabled remote wakeup
 195   4                  // *and* the wakeup was caused by the external wakeup pin.
 196   4      
 197   4                  // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
 198   4                  EZUSB_Resume();   // If source is the Wakeup# pin, signal the host to Resume.      
 199   4                  TD_Resume();
 200   4               }   
 201   3            }
 202   2      
 203   2         }
 204   1      }
 205          
 206          BOOL HighSpeedCapable()
 207          {
 208   1         // this function determines if the chip is high-speed capable.
 209   1         // FX2 and FX2LP are high-speed capable. FX1 is not - it does
 210   1         // not have a high-speed transceiver.
 211   1      
 212   1         if (GPCR2 & bmFULLSPEEDONLY)
 213   1            return FALSE;
 214   1         else
 215   1            return TRUE;
 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                                        // only retuen a device qualifier if this is a high speed
 235   3                                        // capable chip.
 236   3                                        if (HighSpeedCapable())
 237   3                                        {
 238   4                                SUDPTRH = MSB(pDeviceQualDscr);
 239   4                                SUDPTRL = LSB(pDeviceQualDscr);
 240   4                                        }
C51 COMPILER V7.50   FW                                                                    03/02/2008 15:20:03 PAGE 5   

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

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

 365          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    941    ----
   CONSTANT SIZE    =      4    ----
   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 + -