📄 xxgprotodma.lst
字号:
C51 COMPILER V6.20c XXGPROTODMA 01/16/2003 10:36:18 PAGE 1
C51 COMPILER V6.20c, COMPILATION OF MODULE XXGPROTODMA
OBJECT MODULE PLACED IN xxgprotodma.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE xxgprotodma.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
stmt level source
1
2 #include <stdio.h>
3 #include <string.h>
4
5 #include "xxgmain.h"
6 //#include "xxgprotodma.h"
7 #include "xxghal.h"
8 //#include "xxgd12ci.h"
9 #include "xxgusb100.h"
10 //#include "xxgchap9.h"
11
12 extern CONTROL_XFER ControlData;
13 extern IO_REQUEST idata ioRequest;
14 extern EPPFLAGS bEPPflags;
15 extern BOOL bNoRAM;
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 if(bNoRAM == TRUE) {
34 2 i[0] = EP2_PACKET_SIZE;
35 2 i[1] = 0;
36 2 i[2] = 0;
37 2 i[3] = 0;
38 2 } else {
39 2 i[0] = 0;
40 2 i[1] = 1;
41 2 i[2] = 0;
42 2 i[3] = 0;
43 2 }
44 1 single_transmit(i, 4);
45 1
46 1 }
47
48 void setup_dma_request()
49 {
50 1 memcpy((unsigned char *)&ioRequest + ControlData.DeviceRequest.wValue,
51 1 ControlData.dataBuffer,
52 1 ControlData.DeviceRequest.wLength);
53 1
54 1 ioRequest.uSize = SWAP(ioRequest.uSize);
55 1 ioRequest.uAddressL = SWAP(ioRequest.uAddressL);
C51 COMPILER V6.20c XXGPROTODMA 01/16/2003 10:36:18 PAGE 2
56 1
57 1 if(ioRequest.uSize > DMA_BUFFER_SIZE) { // Unaccepted request
58 2 stall_ep0();
59 2 }
60 1 else if(bNoRAM == TRUE && ioRequest.uSize > EP2_PACKET_SIZE) {
61 2 stall_ep0();
62 2 }
63 1 else {
64 2 if(bEPPflags.bits.dma_state == DMA_IDLE) {
65 3 DISABLE;
66 3 bEPPflags.bits.setup_dma ++;
67 3 ENABLE;
68 3 }
69 2 else {
70 3 DISABLE;
71 3 bEPPflags.bits.dma_state = DMA_PENDING;
72 3 ENABLE;
73 3 }
74 2
75 2 } // else if accepted request
76 1 }
77
78 void read_write_register(void)
79 {
80 1 unsigned char i;
81 1
82 1 if(ControlData.DeviceRequest.bmRequestType & (unsigned char)USB_ENDPOINT_DIRECTION_MASK) {
83 2
84 2 if(bEPPflags.bits.verbose)
85 2 printf("Read Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
86 2 ControlData.DeviceRequest.wValue,
87 2 ControlData.DeviceRequest.wLength,
88 2 ControlData.DeviceRequest.wIndex);
89 2
90 2 if(ControlData.DeviceRequest.wIndex == GET_FIRMWARE_VERSION &&
91 2 ControlData.DeviceRequest.wValue == 0 &&
92 2 ControlData.DeviceRequest.wLength == 1)
93 2 get_firmware_version();
94 2 else
95 2 if(ControlData.DeviceRequest.wIndex == GET_BUFFER_SIZE &&
96 2 ControlData.DeviceRequest.wValue == 0 &&
97 2 ControlData.DeviceRequest.wLength == 4)
98 2 get_buffer_size();
99 2 else
100 2 stall_ep0();
101 2
102 2 } // if read register
103 1 else{
104 2 if(bEPPflags.bits.verbose) {
105 3
106 3 //printf("Write Registers: Offset = 0x%x, Length = 0x%x, Index = 0x%x.\n",
107 3 // ControlData.DeviceRequest.wValue,
108 3 // ControlData.DeviceRequest.wLength,
109 3 // ControlData.DeviceRequest.wIndex);
110 3
111 3 //printf("Data: ");
112 3 for(i = 0; i < ControlData.DeviceRequest.wLength; i ++)
113 3 printf("0x%bx, ", *((ControlData.dataBuffer)+i));
114 3 printf("\n");
115 3 }
116 2
117 2 if(ControlData.DeviceRequest.wIndex == SETUP_DMA_REQUEST &&
C51 COMPILER V6.20c XXGPROTODMA 01/16/2003 10:36:18 PAGE 3
118 2 ControlData.DeviceRequest.wValue == 0 &&
119 2 ControlData.DeviceRequest.wLength == 6)
120 2 setup_dma_request();
121 2 //stall_ep0();
122 2 else
123 2 stall_ep0();
124 2 } // if write register
125 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 372 ----
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 + -