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

📄 int.lst

📁 运行于c51单片机上的用keil c创建的C源程序,采用PDIUSBD12接口。
💻 LST
字号:
C51 COMPILER V7.00  INT                                                                    04/27/2004 15:58:57 PAGE 1   


C51 COMPILER V7.00, COMPILATION OF MODULE INT
OBJECT MODULE PLACED IN int.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE int.c BROWSE ORDER DEBUG OBJECTEXTEND TABS(8)

stmt level    source

   1          #include <reg51.h>
   2          #include <string.h>
   3          
   4          #include "macro.h"
   5          #include "varmain.h"
   6          #include "varint.h"
   7          
   8          void P_InterruptInt0(void) interrupt 0          //调用D12中断服务子程序
   9          {
  10   1        unsigned int W_Reg;
  11   1        SETBIT(B_D12_Lb,INT_ISR);
  12   1        W_Reg = D12_ReadInterruptRegister();
  13   1        if(W_Reg != 0)
  14   1        {
  15   2          if(W_Reg & D12_INT_BUSRESET)  bus_reset();
  16   2      
  17   2          if(W_Reg & D12_INT_EOT)  dma_eot();
  18   2      
  19   2          if(W_Reg & D12_INT_SUSPENDCHANGE)  supend_change();
  20   2      
  21   2          if(W_Reg & D12_INT_ENDP0IN)   ep0_txdone();
  22   2      
  23   2          if(W_Reg & D12_INT_ENDP0OUT)  ep0_rxdone();
  24   2      
  25   2          if(W_Reg & D12_INT_ENDP1IN)   ep1_txdone();
  26   2      
  27   2          if(W_Reg & D12_INT_ENDP1OUT)  ep1_rxdone();
  28   2      
  29   2          if(W_Reg & D12_INT_ENDP2IN)   ep2_txdone();
  30   2      
  31   2          if(W_Reg & D12_INT_ENDP2OUT)  ep2_rxdone();
  32   2        }  
  33   1        CLRBIT(B_D12_Lb,INT_ISR);
  34   1      }
  35          
  36          
  37          //总线复位中断服务子程序
  38          void bus_reset(void)
  39          {
  40   1      //可添加用户代码(进行检测到总线复位的操作)
  41   1      }
  42          
  43          //DMA操作结束中断服务子程序
  44          void dma_eot(void)
  45          {
  46   1      //可添加用户代码(进行检测DMA操作结束的操作)
  47   1      }
  48          
  49          //设备挂起改变
  50          void supend_change(void)
  51          {
  52   1        
  53   1      }
  54          
  55          //端点1输出中断操作
C51 COMPILER V7.00  INT                                                                    04/27/2004 15:58:57 PAGE 2   

  56          void ep1_txdone(void)
  57          {
  58   1        D12_ReadLastTransactionStatus(3);//复位中断寄存器
  59   1        //可添加用户代码(进行检测端点号3IN令牌的操作)
  60   1      }
  61          
  62          //端点1输入中断操作
  63          void ep1_rxdone(void)
  64          {
  65   1        unsigned char len;
  66   1        D12_ReadLastTransactionStatus(2);//复位中断寄存器
  67   1        len = D12_ReadEndpoint(2, sizeof(B_BufRdEnd1), &B_BufRdEnd1[0]);//读取端点1接收数据
  68   1        if (len != 0)  SETBIT(B_CommFlg,B_ReceEP1);//标志端点1接收到数据
  69   1      }
  70          
  71          //端点2输出中断操作
  72          void ep2_txdone(void)
  73          {
  74   1        D12_ReadLastTransactionStatus(5);//复位中断寄存器
  75   1        //可添加用户代码(进行检测端点号5IN令牌的操作)
  76   1      }
  77          
  78          //端点2输入中断操作
  79          void ep2_rxdone(void)
  80          {
  81   1        unsigned char len;
  82   1        D12_ReadLastTransactionStatus(4);//复位中断寄存器
  83   1        len = D12_ReadEndpoint(4, sizeof(B_BufRdEnd2), &B_BufRdEnd2[0]);//读取端点2接收数据
  84   1        if (len != 0)  SETBIT(B_CommFlg,B_ReceEP2);//标志端点2接收到数据
  85   1      }
  86          
  87          void ep0_rxdone(void)
  88          {
  89   1        unsigned char ep_last, i;
  90   1      
  91   1        ep_last = D12_ReadLastTransactionStatus(0); // Clear interrupt flag
  92   1      
  93   1        if (ep_last & D12_SETUPPACKET)              //是一个建立包
  94   1        {
  95   2          ControlData.wLength = 0;
  96   2          ControlData.wCount = 0;
  97   2          i = D12_ReadEndpoint(0,sizeof(ControlData.DeviceRequest),(unsigned char *)(&ControlData.DeviceRequest)
             -);
  98   2          if(i != sizeof(DEVICE_REQUEST))
  99   2          {
 100   3            D12_SetEndpointStatus(0, 1);
 101   3            D12_SetEndpointStatus(1, 1);
 102   3            B_Conrol_Stat = USB_IDLE;                 
 103   3            return;
 104   3          }
 105   2          // Acknowledge setup here to unlock in/out endp
 106   2          D12_AcknowledgeEndpoint(0);
 107   2          D12_AcknowledgeEndpoint(1);
 108   2          ControlData.wLength = ControlData.DeviceRequest.wLength;
 109   2          ControlData.wCount = 0;
 110   2          
 111   2          if (ControlData.DeviceRequest.bmRequestType & USB_ENDPOINT_DIRECTION_MASK) 
 112   2          {
 113   3            SETBIT(B_D12_Lb,SETUP);
 114   3            B_Conrol_Stat = USB_TRANSMIT;             /* get command */
 115   3          }
 116   2          else
C51 COMPILER V7.00  INT                                                                    04/27/2004 15:58:57 PAGE 3   

 117   2          {
 118   3            if (ControlData.DeviceRequest.wLength == 0) 
 119   3            {
 120   4              SETBIT(B_D12_Lb,SETUP);                 /* set command */
 121   4              B_Conrol_Stat = USB_IDLE;
 122   4            }
 123   3            else
 124   3            {
 125   4              if(ControlData.DeviceRequest.wLength > MAX_CONTROLDATA_SIZE)  //有问题:应该是EP0_PACKET_SIZE
 126   4              {
 127   5                B_Conrol_Stat = USB_IDLE;
 128   5                D12_SetEndpointStatus(0, 1);
 129   5                D12_SetEndpointStatus(1, 1);
 130   5              }
 131   4              else 
 132   4                B_Conrol_Stat = USB_RECEIVE;
 133   4            }
 134   3          }
 135   2      
 136   2        }
 137   1        else if(B_Conrol_Stat == USB_RECEIVE)                                         
 138   1        {
 139   2          i = D12_ReadEndpoint(0, EP0_PACKET_SIZE,ControlData.dataBuffer + ControlData.wCount);
 140   2          ControlData.wCount += i;
 141   2          if( i != EP0_PACKET_SIZE || ControlData.wCount >= ControlData.wLength) 
 142   2          {
 143   3            SETBIT(B_D12_Lb,SETUP);
 144   3            B_Conrol_Stat = USB_IDLE;
 145   3          }
 146   2        }
 147   1        else
 148   1          B_Conrol_Stat = USB_IDLE;
 149   1      }
 150          
 151          
 152          void ep0_txdone(void)
 153          {
 154   1        short i = ControlData.wLength - ControlData.wCount;
 155   1        D12_ReadLastTransactionStatus(1); // Clear interrupt flag
 156   1      
 157   1        if (B_Conrol_Stat != USB_TRANSMIT) 
 158   1        {
 159   2         single_transmit(0, 0);                       
 160   2         return;
 161   2        }
 162   1        if( i >= EP0_PACKET_SIZE) 
 163   1        {
 164   2          D12_WriteEndpoint(1, EP0_PACKET_SIZE, ControlData.pData + ControlData.wCount);
 165   2          ControlData.wCount += EP0_PACKET_SIZE;
 166   2          B_Conrol_Stat = USB_TRANSMIT;
 167   2        }
 168   1        else if( i != 0) 
 169   1        {
 170   2          D12_WriteEndpoint(1, i, ControlData.pData + ControlData.wCount);
 171   2          ControlData.wCount += i;
 172   2          B_Conrol_Stat = USB_IDLE;
 173   2        }
 174   1        else if (i == 0)
 175   1        {
 176   2          D12_WriteEndpoint(1, 0, 0); // Send zero packet at the end ???
 177   2          B_Conrol_Stat = USB_IDLE;
 178   2        }
C51 COMPILER V7.00  INT                                                                    04/27/2004 15:58:57 PAGE 4   

 179   1      }
 180          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    615    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       5
   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 + -