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

📄 xxgisr.lst

📁 200元买来的D12开发资料,包括上位机驱动和应用程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.02b   XXGISR                                                               03/17/2005 23:11:50 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE XXGISR
OBJECT MODULE PLACED IN J:\D12\FW\XXGISR.OBJ
COMPILER INVOKED BY: C:\keil\c51\bin\C51.EXE J:\D12\FW\XXGISR.C DB SB OE

stmt level    source

   1          //#include <reg51.h>                /* special function register declarations   */
   2          #include <stdio.h>
   3          #include <string.h>
   4          
   5          #include "xxghal.h"
   6          #include "xxgd12ci.h"
   7          #include "xxgmain.h"
   8          #include "xxgUSB100.h"
   9          
  10          void bus_reset(void);
  11          
  12          void ep0_txdone(void);
  13          void ep0_rxdone(void);
  14          void ep1_txdone(void);
  15          void ep1_rxdone(void);
  16          void main_txdone(void);
  17          void main_rxdone(void);
  18          
  19          //void dma_eot(void);
  20          
  21          /*
  22          //*************************************************************************
  23          //  Public static data
  24          //*************************************************************************
  25          */
  26          EPPFLAGS bEPPflags;
  27          
  28          /* Control endpoint TX/RX buffers */
  29          extern CONTROL_XFER ControlData;
  30          
  31          /* ISR static vars */
  32          unsigned char idata GenEpBuf[EP1_PACKET_SIZE];
  33          unsigned char idata EpBuf[EP2_PACKET_SIZE];
  34          IO_REQUEST idata ioRequest;
  35          unsigned char ioSize, ioCount;
  36          
  37          unsigned long ClockTicks = 0;
  38          unsigned char xdata MainEpBuf[256];
  39          
  40          extern BOOL bNoRAM;
  41          
  42          timer_isr() interrupt 1
  43          {
  44   1              DISABLE;
  45   1              ClockTicks++;
  46   1              bEPPflags.bits.timer = 1;
  47   1              ENABLE;
  48   1      }
  49          
  50          /*
  51          void fn_usb_isr()
  52          {
  53                  //unsigned int st;
  54                  unsigned char x,st;
  55                  bEPPflags.bits.in_isr = 1;
C51 COMPILER V7.02b   XXGISR                                                               03/17/2005 23:11:50 PAGE 2   

  56                  x = D12_ReadInterruptRegister();
  57                  //st=x;
  58                  //i=st;
  59                  if(x != 0) {
  60                          //if(i_st & D12_INT_BUSRESET) {
  61                          if(x & 0x40) {
  62                                  bus_reset();
  63                                  bEPPflags.bits.bus_reset = 1;
  64                          }
  65          
  66                          if(x & D12_INT_EOT)
  67                                  dma_eot();
  68          
  69                          if(x & D12_INT_SUSPENDCHANGE)
  70                                  bEPPflags.bits.suspend = 1;
  71          
  72                          
  73                          if(x & D12_INT_ENDP0IN)
  74                                  ep0_txdone();
  75                          if(x & D12_INT_ENDP0OUT)
  76                                  ep0_rxdone();
  77                          if(x & D12_INT_ENDP1IN)
  78                                  ep1_txdone();
  79                          if(x & D12_INT_ENDP1OUT)
  80                                  ep1_rxdone();
  81                          if(x & D12_INT_ENDP2IN)
  82                                  main_txdone();
  83                          if(x & D12_INT_ENDP2OUT)
  84                                  main_rxdone();
  85                          
  86                  }
  87                  
  88                  bEPPflags.bits.in_isr = 0;
  89                  
  90          }
  91          */
  92          usb_isr() interrupt 0
  93          {
  94   1              unsigned char x,st;
  95   1              DISABLE;
  96   1              //fn_usb_isr();
  97   1                      //unsigned int st;
  98   1              //unsigned char x,st;
  99   1              bEPPflags.bits.in_isr = 1;
 100   1              x = D12_ReadInterruptRegister();
 101   1              //st=x;
 102   1              //i=st;
 103   1              if(x != 0) {
 104   2                      //if(i_st & D12_INT_BUSRESET) {
 105   2                      if(x & 0x40) {
 106   3                              bus_reset();
 107   3                              bEPPflags.bits.bus_reset = 1;
 108   3                      }
 109   2      
 110   2                      //if(x & D12_INT_EOT)
 111   2                              //dma_eot();
 112   2      
 113   2                      if(x & D12_INT_SUSPENDCHANGE)
 114   2                              bEPPflags.bits.suspend = 1;
 115   2      
 116   2                      
 117   2                      if(x & D12_INT_ENDP0IN)
C51 COMPILER V7.02b   XXGISR                                                               03/17/2005 23:11:50 PAGE 3   

 118   2                              ep0_txdone();
 119   2                      if(x & D12_INT_ENDP0OUT)
 120   2                              ep0_rxdone();
 121   2                      if(x & D12_INT_ENDP1IN)
 122   2                              ep1_txdone();
 123   2                      if(x & D12_INT_ENDP1OUT)
 124   2                              ep1_rxdone();
 125   2                      if(x & D12_INT_ENDP2IN)
 126   2                              main_txdone();
 127   2                      if(x & D12_INT_ENDP2OUT)
 128   2                              main_rxdone();
 129   2                      
 130   2              }
 131   1              
 132   1              bEPPflags.bits.in_isr = 0;
 133   1              
 134   1              
 135   1              
 136   1              ENABLE;
 137   1      }
*** WARNING C280 IN LINE 94 OF J:\D12\FW\XXGISR.C: 'st': unreferenced local variable
 138          void bus_reset(void)
 139          {
 140   1      }
 141          //void dma_eot(void)
 142          //{
 143          //}
 144          //---------------------------------
 145          void ep0_rxdone(void)
 146          {
 147   1              unsigned char ep_last, i;
 148   1      
 149   1              ep_last = D12_ReadLastTransactionStatus(0); // Clear interrupt flag
 150   1              if (ep_last & D12_SETUPPACKET) {
 151   2      
 152   2                      ControlData.wLength = 0;
 153   2                      ControlData.wCount = 0;
 154   2              //判断端点是否满,如是,则取出
 155   2                      if( D12_ReadEndpoint(0, sizeof(ControlData.DeviceRequest),
 156   2                              (unsigned char *)(&(ControlData.DeviceRequest))) != sizeof(DEVICE_REQUEST) ) {
 157   3      
 158   3                              D12_SetEndpointStatus(0, 1);
 159   3                              D12_SetEndpointStatus(1, 1);
 160   3                              bEPPflags.bits.control_state = USB_IDLE;
 161   3                              
 162   3                              return;
 163   3                      }
 164   2      
 165   2                      ControlData.DeviceRequest.wValue = SWAP(ControlData.DeviceRequest.wValue);
 166   2                      ControlData.DeviceRequest.wIndex = SWAP(ControlData.DeviceRequest.wIndex);
 167   2                      ControlData.DeviceRequest.wLength = SWAP(ControlData.DeviceRequest.wLength);
 168   2      
 169   2                      // Acknowledge setup here to unlock in/out endp
 170   2              //向控制输出端点发送应答建立命令以重新使能下一个建立阶段
 171   2                      D12_AcknowledgeEndpoint(0);
 172   2                      D12_AcknowledgeEndpoint(1);
 173   2      
 174   2                      ControlData.wLength = ControlData.DeviceRequest.wLength;
 175   2                      ControlData.wCount = 0;
 176   2              //需要证实控制传输是控制读还是写,如果是读:
 177   2              //如果控制传输是一个控制读类型那就是说器件需要在下一个数据阶段向
 178   2              //主机发回数据包.MCU需要设置一个标志以指示USB 设备现在正处于传输
C51 COMPILER V7.02b   XXGISR                                                               03/17/2005 23:11:50 PAGE 4   

 179   2              //模式即准备在主机发送请求时发送数据
 180   2      
 181   2                      if (ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) {
 182   3                              bEPPflags.bits.setup_packet = 1;
 183   3                              bEPPflags.bits.control_state = USB_IDLE;                /* get command */
 184   3                          }
 185   2              //如果是写
 186   2                      else {
 187   3                              if (ControlData.DeviceRequest.wLength == 0) {
 188   4                                      bEPPflags.bits.setup_packet = 1;
 189   4                                      bEPPflags.bits.control_state = USB_IDLE;                /* set command */
 190   4                                   }
 191   3                              else {

⌨️ 快捷键说明

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