📄 protodma.lst
字号:
C51 COMPILER V7.09 PROTODMA 03/30/2005 12:31:39 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE PROTODMA
OBJECT MODULE PLACED IN protodma.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE protodma.c BROWSE DEBUG OBJECTEXTEND
line level source
1
2 #include <stdio.h>
3 #include <string.h>
4
5 #include "main.h"
6
7 #include "hal.h"
8 #include "d12ci.h"
9 #include "usb100.h"
10
11
12 extern CONTROL_XFER ControlData;
13 extern IO_REQUEST idata ioRequest;
14 extern EPPFLAGS bEPPflags;
15 extern unsigned char idata EpBuf[];
16
17 extern void single_transmit(unsigned char * buf, unsigned char len);
18 extern void stall_ep0(void);
19
20 void get_firmware_version()
21 {
22 1 unsigned char i;
23 1
24 1 i = 0x30; // firmware version number
25 1 single_transmit((unsigned char *)&i, 1);
26 1
27 1 }
28
29 void get_buffer_size()
30 {
31 1 unsigned char i[4];
32 1
33 1
34 1 i[0] = EP2_PACKET_SIZE;
35 1 i[1] = 0;
36 1 i[2] = 0;
37 1 i[3] = 0;
38 1
39 1 single_transmit(i, 4);
40 1
41 1 }
42
43 void trans_data()
44 {
45 1 unsigned char epstatus;
46 1 if(ControlData.dataBuffer[5]==0x81)//读请求
47 1 {
48 2 D12_WriteEndpoint(5,ControlData.dataBuffer[3],EpBuf);
49 2 }
50 1 if(ControlData.dataBuffer[5]==0x80)//写请求
51 1 {
52 2 epstatus=D12_ReadEndpointStatus(4);
53 2 epstatus&=0x60;
54 2 if(epstatus==0x60)
55 2 D12_ReadEndpoint(5,64,EpBuf);
C51 COMPILER V7.09 PROTODMA 03/30/2005 12:31:39 PAGE 2
56 2 }
57 1 single_transmit(0,0);
58 1 }
59
60 void read_write_register(void)
61 {
62 1 unsigned char i;
63 1
64 1 if(ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) {
65 2
66 2 if(bEPPflags.bits.verbose)
67 2 printf("Read Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
68 2 ControlData.DeviceRequest.wValue,
69 2 ControlData.DeviceRequest.wLength,
70 2 ControlData.DeviceRequest.wIndex);
71 2
72 2 if(ControlData.DeviceRequest.wIndex == GET_FIRMWARE_VERSION &&
73 2 ControlData.DeviceRequest.wValue == 0 &&
74 2 ControlData.DeviceRequest.wLength == 1)
75 2 get_firmware_version();
76 2 else
77 2 if(ControlData.DeviceRequest.wIndex == GET_BUFFER_SIZE &&
78 2 ControlData.DeviceRequest.wValue == 0 &&
79 2 ControlData.DeviceRequest.wLength == 4)
80 2 get_buffer_size();
81 2 else
82 2 stall_ep0();
83 2
84 2 } // if read register
85 1 else{
86 2 if(bEPPflags.bits.verbose) {
87 3 for(i = 0; i < ControlData.DeviceRequest.wLength; i ++)
88 3 printf("0x%bx, ", *((ControlData.dataBuffer)+i));
89 3 printf("\n");
90 3 }
91 2
92 2 if(ControlData.DeviceRequest.wIndex == TRANS_REQUEST&&
93 2 ControlData.DeviceRequest.wValue == 0 &&
94 2 ControlData.DeviceRequest.wLength == 6)
95 2 trans_data();
96 2 //stall_ep0();
97 2 else
98 2 stall_ep0();
99 2 } // if write register
100 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 270 ----
CONSTANT SIZE = 71 ----
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 + -