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

📄 vdor.lst

📁 usb程序 硬件用的是isp1518
💻 LST
字号:
C51 COMPILER V8.02   VDOR                                                                  08/03/2006 10:10:36 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE VDOR
OBJECT MODULE PLACED IN .\VDOR.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\Firmware\Firmware\VDOR.C OMF2 BROWSE DEBUG PRINT(.\VDOR.lst) OBJECT(.\VD
                    -OR.obj)

line level    source

   1          #include "string.h"
   2          #include "SMPro.H"
   3          #include "USB.H"
   4          #include "HAL.H"
   5          #include "VDOR.H"
   6          //#include "USBD12.H"
   7          #include "main.h"
   8          #include "USB200.H"
   9          #include "Isp1581.h"
  10          #include "Isr.h"
  11          #include "Hal4sys.h"
  12          #include "chap9.h"
  13          
  14          extern CONTROL_XFER             ControlData;
  15          extern ZBOARDFLAGS bZBoardFlags;
  16          extern IO_REQUEST idata ioRequest;
  17          extern GLOBE_VARIABLE globe_variable;
  18          extern unsigned char idata GenEpBuf[EP1_PACKET_SIZE];
  19          extern unsigned char bdata key;
  20          code unsigned char ProductCode[] ="1234567890123456";
  21          
  22          /**************************************************************************/
  23          /* Subroutines For Vendor Specific Request                                */ 
  24          /**************************************************************************/
  25          /*
  26          void EnableIsoMode(void)
  27          {
  28                  bZBoardFlags.bits.ISO_CONFIG = 1;
  29                  
  30                  Chap9_ControlWriteHandshake();
  31          }
  32          */
  33          void USBVendorCmdSet(void)
  34          {
  35   1              memcpy(&ioRequest.bCommand,ControlData.dataBuffer,0x1);
  36   1              bZBoardFlags.bits.bLED = 1;
  37   1              Chap9_ControlWriteHandshake();
  38   1      }
  39          void USBVendorCmdGet(void)
  40          {
  41   1              USB_Single_Transmit(&key,1);
  42   1              //USB_Single_Transmit(0, 0);
  43   1      }
  44                  
  45          void USBVendorReadData(void)
  46          {
  47   1              memcpy(&ioRequest.bCommand,ControlData.dataBuffer,0x1);
  48   1              Chap9_ControlWriteHandshake();
  49   1              if(ioRequest.bCommand>64)
  50   1                      ioRequest.bCommand=64;
  51   1              ISP1581_WriteBulkEndpoint(EPINDEX4EP01IN,GenEpBuf,ioRequest.bCommand);
  52   1      }
  53          
  54          void read_write_register(void)
C51 COMPILER V8.02   VDOR                                                                  08/03/2006 10:10:36 PAGE 2   

  55          {
  56   1              if(ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) //0x80
  57   1                {
  58   2                      if(ControlData.DeviceRequest.wIndex == GET_FIRMWARE_VERSION &&
  59   2                              ControlData.DeviceRequest.wValue == 0 &&
  60   2                              ControlData.DeviceRequest.wLength == 1)
  61   2                              {
  62   3                                      get_firmware_version();
  63   3                              }
  64   2                      else
  65   2                      {
  66   3                              USB_Stall_EP0();
  67   3                      }
  68   2              }       // if read register
  69   1              else{
  70   2                      if(ControlData.DeviceRequest.wIndex == SETUP_DMA_REQUEST &&
  71   2                              ControlData.DeviceRequest.wValue == 0 &&
  72   2                              ControlData.DeviceRequest.wLength == 6)
  73   2                      {
  74   3                              RaiseIRQL();
  75   3                              setup_dma_request();//0xc0,0x0c,0x0000,0x0471,0x0006
  76   3                              LowerIRQL();
  77   3                      }
  78   2                      else
  79   2                      {
  80   3                              USB_Stall_EP0();
  81   3                      }
  82   2              }       // if write register
  83   1      
  84   1      }
  85          
  86          void get_firmware_version(void)
  87          {
  88   1              unsigned char i;
  89   1      
  90   1              i = 0x01; // firmware version number, return 0x01 for PC kit version 1
  91   1              USB_Single_Transmit(&i,1);
  92   1      }
  93          
  94          void setup_dma_request(void)
  95          {
  96   1              memcpy((unsigned char *)&ioRequest + ControlData.DeviceRequest.wValue,
  97   1                      ControlData.dataBuffer,
  98   1                      ControlData.DeviceRequest.wLength);
  99   1      
 100   1              ioRequest.uSize = SWAP(ioRequest.uSize);
 101   1              ioRequest.uAddressL = SWAP(ioRequest.uAddressL);
 102   1      
 103   1              if(ioRequest.uSize > DMA_BUFFER_SIZE) // Unaccepted request
 104   1              {
 105   2                      //Chap9_StallEP0();
 106   2                      USB_Stall_EP0();
 107   2              }
 108   1              else
 109   1              {
 110   2                      RaiseIRQL();
 111   2                      bZBoardFlags.bits.setup_dma = 1;
 112   2                      LowerIRQL();
 113   2              } // else if accepted request
 114   1      }
 115          ///////////////////////////////////////////////////////////////
 116          void setup_dma(void)
C51 COMPILER V8.02   VDOR                                                                  08/03/2006 10:10:36 PAGE 3   

 117          {
 118   1              
 119   1              if(ioRequest.bCommand & 0x80)
 120   1              {
 121   2                      Config_DMA();
 122   2              }
 123   1              else
 124   1              {
 125   2                      setup_io();
 126   2              }
 127   1      
 128   1              bZBoardFlags.bits.DCP_state = USBFSM4DCP_CONTROLOUTDONE;
 129   1              //return;
 130   1              
 131   1      }
 132          // it only works on PC evaluation kit.
 133          void setup_io(void)
 134          {
 135   1              
 136   1      }
 137          
 138          void Config_DMA(void)
 139          {
 140   1              unsigned int c;
 141   1              unsigned short dmacfg_width; // 16 bit when assign dmacfg_width16 to it, else 8 bit;
 142   1              //unsigned short isa_dma_more = 0; // when this is not 0, EXT EOT does not come;
 143   1      
 144   1              RaiseIRQL();
 145   1              bZBoardFlags.bits.dma_state = DMA_RUNNING;
 146   1              LowerIRQL();
 147   1      
 148   1              dmacfg_width = dmacfg_width8;
 149   1              CPLD_ctl(dmactl_stop);
 150   1              
 151   1              ISP1581_SetDMACMD(dmacmd_reset);
 152   1      
 153   1              globe_variable.xfer_dir = (unsigned short)(ioRequest.bCommand & 0x1);
 154   1              
 155   1              if(globe_variable.xfer_dir==0x1){// IN
 156   2                      globe_variable.isp1581_dma_counterset_lowbyte = ioRequest.uSize; //exact number, else, clear ep feature;
 157   2                      }
 158   1              else{
 159   2                      globe_variable.isp1581_dma_counterset_lowbyte = ioRequest.uSize ; // adjust value, stop by short packet;
 160   2                      }
 161   1      
 162   1              //设置CPLD中传输的起始地址和字节数
 163   1              CPLD_cfg(ioRequest.uAddressL,globe_variable.isp1581_dma_counterset_lowbyte);
 164   1              
 165   1                      //硬件极性配置
 166   1                      ISP1581_SetDMAHDCfg(dmahd_dreqpolh/*|dmahd_dackpolh*/|dmahd_eotpolh/*|dmahd_readpolh|dmahd_writepolh|dma
             -hd_endianbig*/);
 167   1      
 168   1                      //dma 传输个数
 169   1                      ISP1581_SetDMACounterLow(globe_variable.isp1581_dma_counterset_lowbyte);
 170   1                      ISP1581_SetDMACounterHigh(0x00);                // no longer than 64k bytes each transfer;
 171   1                      //dma 传输配置
 172   1                      ISP1581_SetDMAConfig(0x00
 173   1                                                              |dmacfg_burst0//dmacfg_burst0
 174   1                                                              |dmacfg_modediorw
 175   1      //                                                      |dmacfg_modedack
 176   1      //                                                      |dmacfg_modediorack
 177   1                                                              |dmacfg_width//dmacfg_width16
C51 COMPILER V8.02   VDOR                                                                  08/03/2006 10:10:36 PAGE 4   

 178   1                                                              //|dmacfg_disablecounter  //test
 179   1                                                              );
 180   1                      //dma 中断配置
 181   1                      ISP1581_SetDMAIntMask(/*dmaint_oddint|dmaint_extereot|*/dmaint_intereot|dmaint_xferok);
 182   1                      //ISP1581_SetDMAIntMask(/*dmaint_oddint|*/dmaint_extereot|dmaint_xferok);
 183   1      
 184   1                      if(globe_variable.xfer_dir==0x1)
 185   1                      {//IN
 186   2                              //选择端点
 187   2                              ISP1581_SetDMAEP(bulkinendpointindex);
 188   2                              bZBoardFlags.bits.dma_endpoint = bulkinendpointindex;
 189   2                              //将用作dma传输的端点中断禁止
 190   2                              c = ISP1581_GetIntEnableLow();
 191   2                              ISP1581_SetIntEnableLow(c&(~bulkinendpointinterrupt));
 192   2                              
 193   2                              //启动cpld的DMA传输机制
 194   2                              CPLD_ctl(dmactl_in|dmactl_start);
 195   2                              //启动dma读操作
 196   2                              ISP1581_SetDMACMD(dmacmd_gdmaread);
 197   2                      }
 198   1                      else
 199   1                      {// out
 200   2                              ISP1581_SetDMAEP(bulkoutendpointindex);
 201   2                              bZBoardFlags.bits.dma_endpoint = bulkoutendpointindex;
 202   2                              c = ISP1581_GetIntEnableLow();
 203   2                              ISP1581_SetIntEnableLow(c&(~bulkoutendpointinterrupt));
 204   2                              
 205   2                              CPLD_ctl(dmactl_out|dmactl_start);
 206   2                              
 207   2                              ISP1581_SetDMACMD(dmacmd_gdmawrite);
 208   2                      }
 209   1                      
 210   1      }
 211          
 212          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    475    ----
   CONSTANT SIZE    =     17    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       5
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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