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

📄 periph.lst

📁 部分USB学习资料
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 1   


C51 COMPILER V7.00, COMPILATION OF MODULE PERIPH
OBJECT MODULE PLACED IN PERIPH.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE PERIPH.C OPTIMIZE(9,SIZE) DEBUG OBJECTEXTEND

stmt 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 <ezusb.h>
   9          #include <ezregs.h>
  10          #include <intrins.h>
  11          
  12          extern BOOL     GotSUD;                 // Received setup data flag
  13          extern BOOL     Sleep;
  14          extern BOOL     Rwuen;
  15          extern BOOL     Selfpwr;
  16          
  17          BYTE    Configuration;          // Current configuration
  18          BYTE    AlternateSetting;       // Alternate settings
  19          BYTE  suspCount;
  20          
  21          bit Peripheral_SingleWordWrite( BYTE gaddr, WORD gdata );
  22          bit Peripheral_SingleWordRead( BYTE gaddr, WORD xdata *gdata );
  23          //-----------------------------------------------------------------------------
  24          // Task Dispatcher hooks
  25          //      The following hooks are called by the task dispatcher.
  26          //-----------------------------------------------------------------------------
  27          
  28          void TD_Init(void)                              // Called once at startup
  29          {
  30   1              // Enable endpoints 0-7 IN and OUT
  31   1              IN07VAL |= bmEP1 + bmEP2 + bmEP3 + bmEP4 + bmEP5 + bmEP6 + bmEP7;
  32   1              OUT07VAL |= bmEP1 + bmEP2 + bmEP3 + bmEP4 + bmEP5 + bmEP6 + bmEP7;
  33   1      
  34   1         // Enable interrupts for the OUT endpoints
  35   1         OUT07IEN |= bmEP1 + bmEP2 + bmEP3 + bmEP4 + bmEP5 + bmEP6 + bmEP7;
  36   1      
  37   1         suspCount = 1;
  38   1      
  39   1         OEA = 0xFF;
  40   1      
  41   1         Rwuen = TRUE;                                // Enable remote-wakeup
  42   1      }
  43          
  44          void TD_Poll(void)                              // Called repeatedly while the device is idle
  45          {
  46   1        bit bResult1,bResult2;
  47   1        WORD xdata wData;
  48   1        while(1)
  49   1        {
  50   2           bResult1 = Peripheral_SingleWordWrite( 0x00, 0x00FF );
  51   2           if (bResult1 == 1)
  52   2             bResult2 = Peripheral_SingleWordRead( 0x00, &wData );
  53   2      
  54   2            /*_nop_ ();
  55   2                _nop_ ();
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 2   

  56   2                _nop_ ();
  57   2                _nop_ ();
  58   2                _nop_ ();
  59   2                _nop_ ();
  60   2                _nop_ ();
  61   2                _nop_ ();
  62   2                _nop_ ();
  63   2                _nop_ ();
  64   2                _nop_ ();
  65   2                _nop_ ();
  66   2                _nop_ ();
  67   2                _nop_ ();
  68   2                _nop_ ();
  69   2                _nop_ ();
  70   2                _nop_ ();
  71   2                _nop_ ();
  72   2                _nop_ ();
  73   2                _nop_ ();
  74   2            _nop_ ();
  75   2                _nop_ ();
  76   2                _nop_ ();
  77   2                _nop_ ();
  78   2                _nop_ ();
  79   2                _nop_ ();
  80   2                _nop_ ();
  81   2                _nop_ ();
  82   2                _nop_ ();
  83   2                _nop_ ();
  84   2                _nop_ ();
  85   2                _nop_ ();
  86   2                _nop_ ();
  87   2                _nop_ ();
  88   2                _nop_ ();
  89   2                _nop_ ();
  90   2                _nop_ ();
  91   2                _nop_ ();
  92   2                _nop_ ();
  93   2                _nop_ ();
  94   2            _nop_ ();
  95   2                _nop_ ();
  96   2                _nop_ ();
  97   2                _nop_ ();
  98   2                _nop_ ();
  99   2                _nop_ ();
 100   2                _nop_ ();
 101   2                _nop_ ();
 102   2                _nop_ ();
 103   2                _nop_ ();
 104   2                _nop_ ();
 105   2                _nop_ ();
 106   2                _nop_ ();
 107   2                _nop_ ();
 108   2                _nop_ ();
 109   2                _nop_ ();
 110   2                _nop_ ();
 111   2                _nop_ ();
 112   2                _nop_ ();
 113   2                _nop_ ();
 114   2            _nop_ ();
 115   2                _nop_ ();
 116   2                _nop_ ();
 117   2                _nop_ ();
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 3   

 118   2                _nop_ ();
 119   2                _nop_ ();
 120   2                _nop_ ();
 121   2                _nop_ ();
 122   2                _nop_ ();
 123   2                _nop_ ();
 124   2                _nop_ ();
 125   2                _nop_ ();
 126   2                _nop_ ();
 127   2                _nop_ ();
 128   2                _nop_ ();
 129   2                _nop_ ();
 130   2                _nop_ ();
 131   2                _nop_ ();
 132   2                _nop_ ();
 133   2                _nop_ ();
 134   2          Peripheral_SingleWordWrite( 0x00, 0x0000 );
 135   2                    _nop_ ();
 136   2                _nop_ ();
 137   2                _nop_ ();
 138   2                _nop_ ();
 139   2                _nop_ ();
 140   2                _nop_ ();
 141   2                _nop_ ();
 142   2                _nop_ ();
 143   2                _nop_ ();
 144   2                _nop_ ();
 145   2                _nop_ ();
 146   2                _nop_ ();
 147   2                _nop_ ();
 148   2                _nop_ ();
 149   2                _nop_ ();
 150   2                _nop_ ();
 151   2                _nop_ ();
 152   2                _nop_ ();
 153   2                _nop_ ();
 154   2                _nop_ ();
 155   2            _nop_ ();
 156   2                _nop_ ();
 157   2                _nop_ ();
 158   2                _nop_ ();
 159   2                _nop_ ();
 160   2                _nop_ ();
 161   2                _nop_ ();
 162   2                _nop_ ();
 163   2                _nop_ ();
 164   2                _nop_ ();
 165   2                _nop_ ();
 166   2                _nop_ ();
 167   2                _nop_ ();
 168   2                _nop_ ();
 169   2                _nop_ ();
 170   2                _nop_ ();
 171   2                _nop_ ();
 172   2                _nop_ ();
 173   2                _nop_ ();
 174   2                _nop_ ();
 175   2            _nop_ ();
 176   2                _nop_ ();
 177   2                _nop_ ();
 178   2                _nop_ ();
 179   2                _nop_ ();
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 4   

 180   2                _nop_ ();
 181   2                _nop_ ();
 182   2                _nop_ ();
 183   2                _nop_ ();
 184   2                _nop_ ();
 185   2                _nop_ ();
 186   2                _nop_ ();
 187   2                _nop_ ();
 188   2                _nop_ ();
 189   2                _nop_ ();
 190   2                _nop_ ();
 191   2                _nop_ ();
 192   2                _nop_ ();
 193   2                _nop_ ();
 194   2                _nop_ ();
 195   2            _nop_ ();
 196   2                _nop_ ();
 197   2                _nop_ ();
 198   2                _nop_ ();
 199   2                _nop_ ();
 200   2                _nop_ ();
 201   2                _nop_ ();
 202   2                _nop_ ();
 203   2                _nop_ ();
 204   2                _nop_ ();
 205   2                _nop_ ();
 206   2                _nop_ ();
 207   2                _nop_ ();
 208   2                _nop_ ();
 209   2                _nop_ ();
 210   2                _nop_ ();
 211   2                _nop_ ();
 212   2                _nop_ ();
 213   2                _nop_ ();
 214   2                _nop_ ();*/
 215   2        }
 216   1      }
 217          
 218          BOOL TD_Suspend(void)                   // Called before the device goes into suspend mode
 219          {
 220   1              return(TRUE);
 221   1      }
 222          
 223          BOOL TD_Resume(void)                    // Called after the device resumes
 224          {
 225   1              return(TRUE);
 226   1      }
 227          
 228          //-----------------------------------------------------------------------------
 229          // Device Request hooks
 230          //      The following hooks are called by the end point 0 device request parser.
 231          //-----------------------------------------------------------------------------
 232          
 233          BOOL DR_GetDescriptor(void)
 234          {
 235   1              return(TRUE);
 236   1      }
 237          
 238          BOOL DR_SetConfiguration(void)  // Called when a Set Configuration command is received
 239          {
 240   1              Configuration = SETUPDAT[2];
 241   1              return(TRUE);                           // Handled by user code
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 5   

 242   1      }
 243          
 244          BOOL DR_GetConfiguration(void)  // Called when a Get Configuration command is received
 245          {
 246   1              IN0BUF[0] = Configuration;
 247   1              EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
 248   1              return(TRUE);                           // Handled by user code
 249   1      }
 250          
 251          BOOL DR_SetInterface(void)              // Called when a Set Interface command is received
 252          {
 253   1              AlternateSetting = SETUPDAT[2];
 254   1              return(TRUE);                           // Handled by user code
 255   1      }
 256          
 257          BOOL DR_GetInterface(void)              // Called when a Set Interface command is received
 258          {
 259   1              IN0BUF[0] = AlternateSetting;
 260   1              EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
 261   1              return(TRUE);                           // Handled by user code
 262   1      }
 263          
 264          BOOL DR_GetStatus(void)
 265          {
 266   1              return(TRUE);
 267   1      }
 268          
 269          BOOL DR_ClearFeature(void)
 270          {
 271   1              return(TRUE);
 272   1      }
 273          
 274          BOOL DR_SetFeature(void)
 275          {
 276   1              return(TRUE);
 277   1      }
 278          
 279          #define EZUSB_UNARM_EP(ep_id)                   EPIO[ep_id].cntrl = bmEPBUSY
 280          
 281          BOOL DR_VendorCmnd(void)
 282          {
 283   1         return(TRUE);
 284   1      }
 285          
 286          //-----------------------------------------------------------------------------
 287          // USB Interrupt Handlers
 288          //      The following functions are called by the USB interrupt jump table.
 289          //-----------------------------------------------------------------------------
 290          
 291          
 292          // Setup Data Available Interrupt Handler
 293          void ISR_Sudav(void) interrupt 0
 294          {
 295   1              GotSUD = TRUE;                          // Set flag
 296   1      
 297   1      
 298   1              EZUSB_IRQ_CLEAR();
 299   1              USBIRQ = bmSUDAV;                       // Clear SUDAV IRQ
 300   1      }
 301          
 302          // Setup Token Interrupt Handler
 303          void ISR_Sutok(void) interrupt 0
C51 COMPILER V7.00  PERIPH                                                                 09/27/2002 10:11:22 PAGE 6   

 304          {
 305   1              EZUSB_IRQ_CLEAR();
 306   1              USBIRQ = bmSUTOK;                       // Clear SUTOK IRQ
 307   1      }
 308          
 309          void ISR_Sof(void) interrupt 0
 310          {
 311   1              EZUSB_IRQ_CLEAR();

⌨️ 快捷键说明

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