📄 mainloop.lst
字号:
C51 COMPILER V7.06 MAINLOOP 08/18/2005 15:30:30 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAINLOOP
OBJECT MODULE PLACED IN MAINLOOP.OBJ
COMPILER INVOKED BY: d:\Keil777\C51\BIN\C51.EXE MAINLOOP.C BROWSE DEBUG OBJECTEXTEND
stmt level source
1
2 #include <stdio.h>
3 #include "BasicTyp.h"
4 #include "common.h"
5 #include "mainloop.h"
6 #include "usb.h"
7 #include "Hal4D13.h"
8 #include "chap_9.h"
9 #include "D13BUS.h"
10 #include "ISO.h"
11
12 extern IO_REQUEST idata ioRequest;
13 extern D13FLAGS bD13flags;
14 extern USBCHECK_DEVICE_STATES bUSBCheck_Device_State;;
*** ERROR C141 IN LINE 14 OF MAINLOOP.C: syntax error near ';'
15 extern CONTROL_XFER ControlData;
16
17 //*************************************************************************
18 // USB protocol function pointer arrays
19 //*************************************************************************
20
21 #define MAX_STANDARD_REQUEST 0x0D
22 code void (*StandardDeviceRequest[])(void) =
23 {
24 Chap9_GetStatus,
25 Chap9_ClearFeature,
26 Chap9_StallEP0,
27 Chap9_SetFeature,
28 Chap9_StallEP0,
29 Chap9_SetAddress,
30 Chap9_GetDescriptor,
31 Chap9_StallEP0,
32 Chap9_GetConfiguration,
33 Chap9_SetConfiguration,
34 Chap9_GetInterface,
35 Chap9_SetInterface,
36 Chap9_StallEP0
37 };
38
39
40 code CHAR * _NAME_USB_REQUEST_DIRECTION[] =
41 {
42 "Host_to_device",
43 "Device_to_host"
44 };
45
46 code CHAR * _NAME_USB_REQUEST_RECIPIENT[] =
47 {
48 "Device",
49 "Interface",
50 "Endpoint(0)",
51 "Other"
52 };
53
54 code CHAR * _NAME_USB_REQUEST_TYPE[] =
C51 COMPILER V7.06 MAINLOOP 08/18/2005 15:30:30 PAGE 2
55 {
56 "Standard",
57 "Class",
58 "Vendor",
59 "Reserved"
60 };
61
62 code CHAR * _NAME_USB_STANDARD_REQUEST[] =
63 {
64 "GET_STATUS",
65 "CLEAR_FEATURE",
66 "RESERVED",
67 "SET_FEATURE",
68 "RESERVED",
69 "SET_ADDRESS",
70 "GET_DESCRIPTOR",
71 "SET_DESCRIPTOR",
72 "GET_CONFIGURATION",
73 "SET_CONFIGURATION",
74 "GET_INTERFACE",
75 "SET_INTERFACE",
76 "SYNC_FRAME"
77 };
78
79 //*************************************************************************
80 // Class device requests
81 //*************************************************************************
82
83 #define MAX_CLASS_REQUEST 0x00
84 code void (*ClassDeviceRequest[])(void) =
85 {
86 ML_Reserved
87 };
88
89 code CHAR * _NAME_USB_CLASS_REQUEST[] =
90 {
91 " ML_Reserved"
92 };
93
94 //*************************************************************************
95 // Vendor Device Request
96 //*************************************************************************
97
98 #define MAX_VENDOR_REQUEST 0x0f
99
100 code void (*VendorDeviceRequest[])(void) =
101 {
102 EnableIsoMode,
103 D13Bus_ControlEntry,
104 reserved,
105 reserved,
106 reserved,
107 reserved,
108 reserved,
109 reserved,
110 reserved,
111 reserved,
112 reserved,
113 reserved,
114 read_write_register,
115 reserved,
116 reserved,
C51 COMPILER V7.06 MAINLOOP 08/18/2005 15:30:30 PAGE 3
117 reserved
118 };
119
120 code CHAR * _NAME_USB_VENDOR_REQUEST[] =
121 {
122 "Iso mode enable",
123 "Philips D13bus handler",
124 "RESERVED",
125 "RESERVED",
126 "RESERVED",
127 "RESERVED",
128 "RESERVED",
129 "RESERVED",
130 "RESERVED",
131 "RESERVED",
132 "RESERVED",
133 "RESERVED",
134 "read Firmware version ",
135 "RESERVED",
136 "RESERVED",
137 "RESERVED",
138 };
139
140 void SetupToken_Handler(void)
141 {
142 1 RaiseIRQL();
143 1 bD13flags.bits.At_IRQL1 = 1;
144 1 ControlData.Abort = FALSE;
145 1
146 1 ControlData.wLength = 0;
147 1 ControlData.wCount = 0;
148 1
149 1 if( Hal4D13_ReadEndpointWOClearBuffer(EPINDEX4EP0_CONTROL_OUT, (UCHAR *)(&(ControlData.DeviceRequest)),
-sizeof(ControlData.DeviceRequest)) == sizeof(DEVICE_REQUEST) )
150 1 {
151 2
152 2 bD13flags.bits.At_IRQL1 = 0;
153 2 LowerIRQL();
154 2 ControlData.wLength = ControlData.DeviceRequest.wLength;
155 2 ControlData.wCount = 0;
156 2
157 2 if (ControlData.DeviceRequest.bmRequestType & (UCHAR)USB_ENDPOINT_DIRECTION_MASK)
158 2 {
159 3 /* get command */
160 3 RaiseIRQL();
161 3 ML_AcknowledgeSETUP();
162 3 if((ControlData.DeviceRequest.bRequest == 0) & (ControlData.DeviceRequest.bmRequestType == 0xc0))
163 3 bD13flags.bits.DCP_state = USBFSM4DCP_HANDSHAKE;
164 3 else
165 3 bD13flags.bits.DCP_state = USBFSM4DCP_REQUESTPROC;
166 3
167 3 LowerIRQL();
168 3 }
169 2 else
170 2 {
171 3 /* set command */
172 3
173 3 if (ControlData.DeviceRequest.wLength == 0)
174 3 {
175 4 /* Set command without Data stage*/
176 4 RaiseIRQL();
177 4 ML_AcknowledgeSETUP();
C51 COMPILER V7.06 MAINLOOP 08/18/2005 15:30:30 PAGE 4
178 4 bD13flags.bits.DCP_state = USBFSM4DCP_REQUESTPROC;
179 4 LowerIRQL();
180 4 }
181 3 else
182 3 {
183 4 /*
184 4 // Set command with Data stage
185 4 // get Data Buffer
186 4 */
187 4 if(ControlData.DeviceRequest.wLength <= MAX_CONTROLDATA_SIZE)
188 4 {
189 5 /* set command with OUT token */
190 5 RaiseIRQL();
191 5 bD13flags.bits.DCP_state = USBFSM4DCP_DATAOUT;
192 5 LowerIRQL();
193 5 ML_AcknowledgeSETUP();
194 5
195 5 }
196 4 else
197 4 {
198 5 RaiseIRQL();
199 5 ML_AcknowledgeSETUP();
200 5 Hal4D13_StallEP0InControlWrite();
201 5 bD13flags.bits.DCP_state = USBFSM4DCP_STALL;
202 5 printf("bD13flags.bits.DCP_state = x%hx\n Unknow set up command\n", bD13flags.bits.DCP_state);
203 5 LowerIRQL();
204 5 }
205 4 }
206 3 }
207 2 }
208 1 else
209 1 {
210 2 printf("wrong setup command\n");
211 2 bD13flags.bits.At_IRQL1 = 0;
212 2 LowerIRQL();
213 2 Chap9_StallEP0();
214 2 }
215 1
216 1 printf("To_Ha_end\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -