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

📄 periph.lst

📁 基于an2131的usb程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.01  PERIPH                                                                 12/08/2004 16:34:04 PAGE 1   


C51 COMPILER V7.01, COMPILATION OF MODULE PERIPH
OBJECT MODULE PLACED IN PERIPH.OBJ
COMPILER INVOKED BY: c:\Keil\C51\BIN\C51.EXE PERIPH.C OPTIMIZE(6,SPEED) INCDIR(e:\Cypress\USB\Target\Inc) DEBUG OBJECTEX
                    -TEND

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 <fx.h>
  11          #include "ABSACC.H"
  12          
  13          
  14          extern BOOL     GotSUD;                 // Received setup data flag
  15          extern BOOL     Sleep;
  16          extern BOOL     Rwuen;
  17          extern BOOL     Selfpwr;
  18               
  19          
  20          int             nTimes=0;
  21          
  22          
  23          int             nCount=-1;
  24          int             i;
  25          //int           nCount1=-1;
  26          int     flag1,flag2;
  27          int     flag3,flag4;
  28          int     flag5,flag6;
  29          int     flag7,flag8;
  30          int     flagin4=1;////////////////////////////////
  31          //int     flagin5=1; //////////////////////////////
  32          
  33          xdata  char  HPICL  _at_  0x8000;
  34          xdata  char  HPICH  _at_  0x8002;
  35          xdata  char  HPIAL  _at_  0x8004;
  36          xdata  char  HPIAH _at_  0x8006;
  37          xdata  char  HPIDRL _at_  0x800d; //0x8009;/
  38          xdata  char  HPIDRH  _at_  0x800f; ///0x800b;
  39          xdata   char  HPIDWL  _at_  0x800c; //0x8008;
  40          xdata   char  HPIDWH _at_   0x800e; //0x800a;
  41          xdata  char  HPIDRLAUTO _at_  0x8009;
  42          xdata  char  HPIDRHAUTO  _at_  0x800b;
  43          xdata   char  HPIDWLAUTO  _at_  0x8008;
  44          xdata   char  HPIDWHAUTO _at_   0x800a;
  45          //int    flag3;
  46          
  47          //extern  void a();
  48          BYTE    Configuration;          // Current configuration
  49          BYTE    AlternateSetting;       // Alternate settings
  50          BYTE  suspCount;
  51          
  52          typedef struct _ISO_REPORT
  53          {
  54             WORD  length;
C51 COMPILER V7.01  PERIPH                                                                 12/08/2004 16:34:04 PAGE 2   

  55             WORD  frame;
  56          } ISO_REPORT, *PISO_REPORT;
  57          
  58          //-----------------------------------------------------------------------------
  59          // Task Dispatcher hooks
  60          //      The following hooks are called by the task dispatcher.
  61          //-----------------------------------------------------------------------------
  62          
  63          void TD_Init(void)                              // Called once at startup
  64          {
  65   1              IN07VAL |= bmEP3;//+bmEP4;//+bmEP3+bmEP4+bmEP5; //for change 041202 reback collect 1024
  66   1              IN07IEN |= bmEP3;//+bmEP4;//+bmEP3+bmEP4+bmEP5;
  67   1      
  68   1      //    OUT07VAL |= bmEP2;
  69   1      ///     OUT07IEN |= bmEP2;
  70   1      
  71   1         suspCount = 1;
  72   1      
  73   1        OEA=0xff; 
  74   1      
  75   1      /*      HPICL=1;
  76   1              HPICH=1;
  77   1      
  78   1              HPIAL=0X00;
  79   1              HPIAH=0x15;
  80   1      */
  81   1         Rwuen = TRUE;                                // Enable remote-wakeup
  82   1      }
  83          
  84          
  85          void TD_Poll(void)                              // Called repeatedly while the device is idle
  86          {
  87   1      }
  88          
  89          BOOL TD_Suspend(void)                   // Called before the device goes into suspend mode
  90          {
  91   1              return(TRUE);
  92   1      }
  93          
  94          BOOL TD_Resume(void)                    // Called after the device resumes
  95          {
  96   1              return(TRUE);
  97   1      }
  98          
  99          //-----------------------------------------------------------------------------
 100          // Device Request hooks
 101          //      The following hooks are called by the end point 0 device request parser.
 102          //-----------------------------------------------------------------------------
 103          
 104          BOOL DR_GetDescriptor(void)
 105          {
 106   1              return(TRUE);
 107   1      }
 108          
 109          BOOL DR_SetConfiguration(void)  // Called when a Set Configuration command is received
 110          {
 111   1              Configuration = SETUPDAT[2];
 112   1              return(TRUE);                           // Handled by user code
 113   1      }
 114          
 115          BOOL DR_GetConfiguration(void)  // Called when a Get Configuration command is received
 116          {
C51 COMPILER V7.01  PERIPH                                                                 12/08/2004 16:34:04 PAGE 3   

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

 179   1      
 180   1      }
 181          
 182          void ISR_Ures(void) interrupt 0
 183          {
 184   1      //
 185   1         // Arm all of the OUT endpoints so they can accept data
 186   1         //
 187   1              EPIO[IN3BUF_ID].bytes = 0; 
 188   1      
 189   1              EZUSB_IRQ_CLEAR();
 190   1              USBIRQ = bmURES;                        // Clear URE
 191   1      }
 192          
 193          void ISR_IBN(void) interrupt 0
 194          {
 195   1         // ISR for the IN Bulk NAK (IBN) interrupt.
 196   1      }
 197          
 198          void ISR_Susp(void) interrupt 0
 199          {
 200   1              Sleep = TRUE;
 201   1              EZUSB_IRQ_CLEAR();

⌨️ 快捷键说明

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