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

📄 sinwavegeneral.lst

📁 68013的USB通讯测试程序
💻 LST
字号:
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE SINWAVEGENERAL
OBJECT MODULE PLACED IN SinWaveGeneral.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE SinWaveGeneral.c OPTIMIZE(6,SPEED) DEBUG OBJECTEXTEND

line level    source

   1          #pragma NOIV               // Do not generate interrupt vectors
   2          //-----------------------------------------------------------------------------
   3          //   File:      periph.c
   4          //   Contents:   Hooks required to implement USB peripheral function.
   5          //
   6          //   Copyright (c) 1997 AnchorChips, Inc. All rights reserved
   7          //-----------------------------------------------------------------------------
   8          #include "fx2.h"
   9          #include "fx2regs.h"
  10          #include "Ezusb.h"
  11          #include "fx2sdly.h"
  12          
  13          extern BOOL   GotSUD;         // Received setup data flag
  14          extern BOOL   Sleep;
  15          extern BOOL   Rwuen;
  16          extern BOOL   Selfpwr;
  17          
  18          extern code int sinw[];
  19          char send_flag=0;
  20          char* dat=(char*) sinw;
  21          
  22          BYTE   Configuration;      // Current configuration
  23          BYTE   AlternateSetting;   // Alternate settings
  24          
  25          
  26          //-----------------------------------------------------------------------------
  27          // Task Dispatcher hooks
  28          //   The following hooks are called by the task dispatcher.
  29          //-----------------------------------------------------------------------------
  30          
  31          void TD_Init(void)             // Called once at startup
  32          {
  33   1         BREAKPT &= ~bmBPEN;      // to see BKPT LED go out TGE
  34   1         Rwuen = TRUE;            // Enable remote-wakeup
  35   1         
  36   1            REVCTL = 0x03;    
  37   1      
  38   1         SYNCDELAY;
  39   1         EP2CFG=0xA0;                         //端点2有效,OUT端点,批量,四倍512缓存
  40   1         SYNCDELAY;
  41   1         EP6CFG=0xE0;                         //端点2有效,IN端点,批量,四倍512缓存
  42   1         SYNCDELAY;
  43   1      
  44   1         EP4CFG=0;                            //端点无效
  45   1         SYNCDELAY;
  46   1         EP8CFG=0;                            //端点无效
  47   1         SYNCDELAY;
  48   1      
  49   1         EP2FIFOCFG = 0x00;//AUTO OUT 8-BIT BUS
  50   1         SYNCDELAY; 
  51   1         EP6FIFOCFG = 0x00;//AUTO IN  8-BIT BUS
  52   1         SYNCDELAY; 
  53   1      
  54   1        SYNCDELAY;                    // 
  55   1        FIFORESET = 0x80;             // activate NAK-ALL to avoid race conditions
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 2   

  56   1        SYNCDELAY;                    // 
  57   1        FIFORESET = 0x02;             // reset, FIFO 2
  58   1        SYNCDELAY;                    // 
  59   1        FIFORESET = 0x04;             // reset, FIFO 4
  60   1        SYNCDELAY;                    // 
  61   1        FIFORESET = 0x06;             // reset, FIFO 6
  62   1        SYNCDELAY;                    // 
  63   1        FIFORESET = 0x08;             // reset, FIFO 8
  64   1        SYNCDELAY;                    // 
  65   1        FIFORESET = 0x00;             // deactivate NAK-ALL
  66   1        SYNCDELAY;
  67   1      
  68   1        EPIRQ = 0xFF;
  69   1        SYNCDELAY; 
  70   1        EPIE |= 0x10;     //enable the ep2 inout interrupt
  71   1      
  72   1      OUTPKTEND = 0x82;
  73   1      SYNCDELAY; 
  74   1      
  75   1      
  76   1      
  77   1      
  78   1      }
  79          
  80          void TD_Poll(void)             // Called repeatedly while the device is idle
  81          {
  82   1       int i;
  83   1      
  84   1       if ((EP6CS&0x08)==0 && send_flag==1)                   //查看满标志,未满,且允许发送
  85   1               {
  86   2               for (i=0;i<480;i++)
  87   2                      {
  88   3                       EP6FIFOBUF[i]=*(dat+i);
  89   3                      }
  90   2               //INPKTEND=6;
  91   2      
  92   2               SYNCDELAY;
  93   2               EP6BCH = 480>>8;
  94   2               SYNCDELAY;
  95   2               EP6BCL = 480&0x00ff;
  96   2               INPKTEND = 0x86;
  97   2               }
  98   1      
  99   1      }
 100          
 101          BOOL TD_Suspend(void)          // Called before the device goes into suspend mode
 102          {
 103   1         return(TRUE);
 104   1      }
 105          
 106          BOOL TD_Resume(void)          // Called after the device resumes
 107          {
 108   1         return(TRUE);
 109   1      }
 110          
 111          //-----------------------------------------------------------------------------
 112          // Device Request hooks
 113          //   The following hooks are called by the end point 0 device request parser.
 114          //-----------------------------------------------------------------------------
 115          
 116          BOOL DR_GetDescriptor(void)
 117          {
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 3   

 118   1         return(TRUE);
 119   1      }
 120          
 121          BOOL DR_SetConfiguration(void)   // Called when a Set Configuration command is received
 122          {
 123   1         Configuration = SETUPDAT[2];
 124   1         return(TRUE);            // Handled by user code
 125   1      }
 126          
 127          BOOL DR_GetConfiguration(void)   // Called when a Get Configuration command is received
 128          {
 129   1         EP0BUF[0] = Configuration;
 130   1         EP0BCH = 0;
 131   1         EP0BCL = 1;
 132   1         return(TRUE);            // Handled by user code
 133   1      }
 134          
 135          BOOL DR_SetInterface(void)       // Called when a Set Interface command is received
 136          {
 137   1         AlternateSetting = SETUPDAT[2];
 138   1         return(TRUE);            // Handled by user code
 139   1      }
 140          
 141          BOOL DR_GetInterface(void)       // Called when a Set Interface command is received
 142          {
 143   1         EP0BUF[0] = AlternateSetting;
 144   1         EP0BCH = 0;
 145   1         EP0BCL = 1;
 146   1         return(TRUE);            // Handled by user code
 147   1      }
 148          
 149          BOOL DR_GetStatus(void)
 150          {
 151   1         return(TRUE);
 152   1      }
 153          
 154          BOOL DR_ClearFeature(void)
 155          {
 156   1         return(TRUE);
 157   1      }
 158          
 159          BOOL DR_SetFeature(void)
 160          {
 161   1         return(TRUE);
 162   1      }
 163          
 164          BOOL DR_VendorCmnd(void)
 165          {
 166   1         return(TRUE);
 167   1      }
 168          
 169          //-----------------------------------------------------------------------------
 170          // USB Interrupt Handlers
 171          //   The following functions are called by the USB interrupt jump table.
 172          //-----------------------------------------------------------------------------
 173          
 174          // Setup Data Available Interrupt Handler
 175          void ISR_Sudav(void) interrupt 0
 176          {
 177   1         GotSUD = TRUE;            // Set flag
 178   1         EZUSB_IRQ_CLEAR();
 179   1         USBIRQ = bmSUDAV;         // Clear SUDAV IRQ
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 4   

 180   1      }
 181          
 182          // Setup Token Interrupt Handler
 183          void ISR_Sutok(void) interrupt 0
 184          {
 185   1         EZUSB_IRQ_CLEAR();
 186   1         USBIRQ = bmSUTOK;         // Clear SUTOK IRQ
 187   1      }
 188          
 189          void ISR_Sof(void) interrupt 0
 190          {
 191   1         EZUSB_IRQ_CLEAR();
 192   1         USBIRQ = bmSOF;            // Clear SOF IRQ
 193   1      }
 194          
 195          void ISR_Ures(void) interrupt 0
 196          {
 197   1         // whenever we get a USB reset, we should revert to full speed mode
 198   1         pConfigDscr = pFullSpeedConfigDscr;
 199   1         ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
 200   1         pOtherConfigDscr = pHighSpeedConfigDscr;
 201   1         ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
 202   1         
 203   1         EZUSB_IRQ_CLEAR();
 204   1         USBIRQ = bmURES;         // Clear URES IRQ
 205   1      }
 206          
 207          void ISR_Susp(void) interrupt 0
 208          {
 209   1         Sleep = TRUE;
 210   1         EZUSB_IRQ_CLEAR();
 211   1         USBIRQ = bmSUSP;
 212   1      }
 213          
 214          void ISR_Highspeed(void) interrupt 0
 215          {
 216   1         if (EZUSB_HIGHSPEED())
 217   1         {
 218   2            pConfigDscr = pHighSpeedConfigDscr;
 219   2            ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR;
 220   2            pOtherConfigDscr = pFullSpeedConfigDscr;
 221   2            ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR;
 222   2         }
 223   1      
 224   1         EZUSB_IRQ_CLEAR();
 225   1         USBIRQ = bmHSGRANT;
 226   1      }
 227          void ISR_Ep0ack(void) interrupt 0
 228          {
 229   1      }
 230          void ISR_Stub(void) interrupt 0
 231          {
 232   1      }
 233          void ISR_Ep0in(void) interrupt 0
 234          {
 235   1      }
 236          void ISR_Ep0out(void) interrupt 0
 237          {
 238   1      }
 239          void ISR_Ep1in(void) interrupt 0
 240          {
 241   1      }
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 5   

 242          void ISR_Ep1out(void) interrupt 0
 243          {
 244   1      }
 245          void ISR_Ep2inout(void) interrupt 0
 246          {
 247   1      
 248   1       if (EP2BCH==0)
 249   1       {
 250   2        SYNCDELAY;
 251   2        if (EP2BCL==2)
 252   2              {
 253   3               if (EP2FIFOBUF[0]=='S' && EP2FIFOBUF[1]=='T')          //启动传送
 254   3               {
 255   4                send_flag=1;
 256   4               }
 257   3               if (EP2FIFOBUF[0]=='E' && EP2FIFOBUF[1]=='D')
 258   3               {
 259   4                send_flag=0;
 260   4               }
 261   3              }
 262   2       }
 263   1      
 264   1          OUTPKTEND = 0x82;       
 265   1              EZUSB_IRQ_CLEAR();
 266   1              EPIRQ = 0x10; 
 267   1      }
 268          void ISR_Ep4inout(void) interrupt 0
 269          {
 270   1      }
 271          void ISR_Ep6inout(void) interrupt 0
 272          {
 273   1      }
 274          void ISR_Ep8inout(void) interrupt 0
 275          {
 276   1      }
 277          void ISR_Ibn(void) interrupt 0
 278          {
 279   1      }
 280          void ISR_Ep0pingnak(void) interrupt 0
 281          {
 282   1      }
 283          void ISR_Ep1pingnak(void) interrupt 0
 284          {
 285   1      }
 286          void ISR_Ep2pingnak(void) interrupt 0
 287          {
 288   1      }
 289          void ISR_Ep4pingnak(void) interrupt 0
 290          {
 291   1      }
 292          void ISR_Ep6pingnak(void) interrupt 0
 293          {
 294   1      }
 295          void ISR_Ep8pingnak(void) interrupt 0
 296          {
 297   1      }
 298          void ISR_Errorlimit(void) interrupt 0
 299          {
 300   1      }
 301          void ISR_Ep2piderror(void) interrupt 0
 302          {
 303   1      }
C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 6   

 304          void ISR_Ep4piderror(void) interrupt 0
 305          {
 306   1      }
 307          void ISR_Ep6piderror(void) interrupt 0
 308          {
 309   1      }
 310          void ISR_Ep8piderror(void) interrupt 0
 311          {
 312   1      }
 313          void ISR_Ep2pflag(void) interrupt 0
 314          {
 315   1      }
 316          void ISR_Ep4pflag(void) interrupt 0
 317          {
 318   1      }
 319          void ISR_Ep6pflag(void) interrupt 0
 320          {
 321   1      }
 322          void ISR_Ep8pflag(void) interrupt 0
 323          {
 324   1      }
 325          void ISR_Ep2eflag(void) interrupt 0
 326          {
 327   1      }
 328          void ISR_Ep4eflag(void) interrupt 0
 329          {
 330   1      }
 331          void ISR_Ep6eflag(void) interrupt 0
 332          {
 333   1      }
 334          void ISR_Ep8eflag(void) interrupt 0
 335          {
 336   1      }
 337          void ISR_Ep2fflag(void) interrupt 0
 338          {
 339   1      }
 340          void ISR_Ep4fflag(void) interrupt 0
 341          {
 342   1      }
 343          void ISR_Ep6fflag(void) interrupt 0
 344          {
 345   1      }
 346          void ISR_Ep8fflag(void) interrupt 0
 347          {
 348   1      }
 349          void ISR_GpifComplete(void) interrupt 0
 350          {
 351   1      }
 352          void ISR_GpifWaveform(void) interrupt 0
 353          {
 354   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    596    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      6    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.

C51 COMPILER V7.50   SINWAVEGENERAL                                                        06/12/2008 15:13:28 PAGE 7   


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

⌨️ 快捷键说明

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