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

📄 protodma.lst

📁 philiphs D12 firmware驱动程序
💻 LST
字号:
C51 COMPILER V7.06   PROTODMA                                                              08/06/2006 09:11:07 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE PROTODMA
OBJECT MODULE PLACED IN PROTODMA.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE PROTODMA.C BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*
   2             //*************************************************************************
   3             //
   4             //                  P H I L I P S   P R O P R I E T A R Y
   5             //
   6             //           COPYRIGHT (c)   1997 BY PHILIPS SINGAPORE.
   7             //                     --  ALL RIGHTS RESERVED  --
   8             //
   9             // File Name:        PROTODMA.C
  10             // Author:           Wenkai Du
  11             // Created:          18 Aug 98
  12             // Modified:
  13             // Revision:         3.0
  14             //
  15             //*************************************************************************
  16          */
  17          
  18          #include <stdio.h>
  19          #include <string.h>
  20          
  21          #include <reg51.h>                /* special function register declarations   */
  22          #include "epphal.h"
  23          
  24          #include "d12ci.h"
  25          #include "mainloop.h"
  26          #include "usb100.h"
  27          #include "chap_9.h"
  28          
  29          extern CONTROL_XFER ControlData;
  30          extern IO_REQUEST idata ioRequest;
  31          extern EPPFLAGS bEPPflags;
  32          extern BOOL bNoRAM;
  33          
  34          void get_firmware_version()
  35          {
  36   1              unsigned char i;
  37   1      
  38   1              i = 0x30; // firmware version number
  39   1              single_transmit((unsigned char *)&i, 1);
  40   1      }
  41          
  42          void get_buffer_size()
  43          {
  44   1              unsigned char i[4];
  45   1      
  46   1              if(bNoRAM == TRUE) {
  47   2                      i[0] = EP2_PACKET_SIZE;
  48   2                      i[1] = 0;
  49   2                      i[2] = 0;
  50   2                      i[3] = 0;
  51   2              } else {
  52   2                      i[0] = 0;
  53   2                      i[1] = 1;
  54   2                      i[2] = 0;
  55   2                      i[3] = 0;
C51 COMPILER V7.06   PROTODMA                                                              08/06/2006 09:11:07 PAGE 2   

  56   2              }
  57   1              single_transmit((unsigned char *)&i, 4);
  58   1      }
  59          
  60          void setup_dma_request()
  61          {
  62   1              memcpy((unsigned char *)&ioRequest + ControlData.DeviceRequest.wValue,
  63   1                      ControlData.dataBuffer,
  64   1                      ControlData.DeviceRequest.wLength);
  65   1      
  66   1              ioRequest.uSize = SWAP(ioRequest.uSize);
  67   1              ioRequest.uAddressL = SWAP(ioRequest.uAddressL);
  68   1      
  69   1              if(ioRequest.uSize > DMA_BUFFER_SIZE) { // Unaccepted request
  70   2                      stall_ep0();
  71   2              }
  72   1              else if(bNoRAM == TRUE && ioRequest.uSize > EP2_PACKET_SIZE) {
  73   2                      stall_ep0();
  74   2              }
  75   1              else {
  76   2                      if(bEPPflags.bits.dma_state == DMA_IDLE) {
  77   3                              DISABLE;
  78   3                              bEPPflags.bits.setup_dma ++;
  79   3                              ENABLE;
  80   3                      }
  81   2                      else {
  82   3                              DISABLE;
  83   3                              bEPPflags.bits.dma_state = DMA_PENDING;
  84   3                              ENABLE;
  85   3                      }
  86   2      
  87   2              } // else if accepted request
  88   1      }
  89          
  90          void read_write_register(void)
  91          {
  92   1              unsigned char i;
  93   1      
  94   1              if(ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) {
  95   2      
  96   2                      if(bEPPflags.bits.verbose)
  97   2                              printf("Read Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
  98   2                                      ControlData.DeviceRequest.wValue,
  99   2                                      ControlData.DeviceRequest.wLength,
 100   2                                      ControlData.DeviceRequest.wIndex);
 101   2      
 102   2                      if(ControlData.DeviceRequest.wIndex == GET_FIRMWARE_VERSION &&
 103   2                              ControlData.DeviceRequest.wValue == 0 &&
 104   2                              ControlData.DeviceRequest.wLength == 1)
 105   2                              get_firmware_version();
 106   2                      else
 107   2                      if(ControlData.DeviceRequest.wIndex == GET_BUFFER_SIZE &&
 108   2                              ControlData.DeviceRequest.wValue == 0 &&
 109   2                              ControlData.DeviceRequest.wLength == 4)
 110   2                              get_buffer_size();
 111   2                      else
 112   2                              stall_ep0();
 113   2      
 114   2              }       // if read register
 115   1              else{
 116   2                      if(bEPPflags.bits.verbose) {
 117   3      
C51 COMPILER V7.06   PROTODMA                                                              08/06/2006 09:11:07 PAGE 3   

 118   3                              printf("Write Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
 119   3                                      ControlData.DeviceRequest.wValue,
 120   3                                      ControlData.DeviceRequest.wLength,
 121   3                                      ControlData.DeviceRequest.wIndex);
 122   3      
 123   3                              printf("Data: ");
 124   3                              for(i = 0; i < ControlData.DeviceRequest.wLength; i ++)
 125   3                                      printf("0x%bx, ", *((ControlData.dataBuffer)+i));
 126   3                              printf("\n");
 127   3                      }
 128   2      
 129   2                      if(ControlData.DeviceRequest.wIndex == SETUP_DMA_REQUEST &&
 130   2                              ControlData.DeviceRequest.wValue == 0 &&
 131   2                              ControlData.DeviceRequest.wLength == 6)
 132   2                              setup_dma_request();
 133   2                      else
 134   2                              stall_ep0();
 135   2              }       // if write register
 136   1      }


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


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

⌨️ 快捷键说明

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