📄 fw.lst
字号:
163 1
164 1 switch(SETUPDAT[1])
165 1 {
166 2 case SC_GET_DESCRIPTOR: // *** Get Descriptor
167 2 if(DR_GetDescriptor())
168 2 switch(SETUPDAT[3])
169 2 {
170 3 case GD_DEVICE: // Device
171 3 SUDPTRH = MSB(pDeviceDscr);
172 3 SUDPTRL = LSB(pDeviceDscr);
173 3 break;
174 3 case GD_CONFIGURATION: // Configuration
175 3 if(dscr_ptr = (void *)EZUSB_GetConfigDscr(SETUPDAT[2]))
176 3 {
177 4 SUDPTRH = MSB(dscr_ptr);
178 4 SUDPTRL = LSB(dscr_ptr);
C51 COMPILER V7.00 FW 09/27/2002 10:11:22 PAGE 4
179 4 }
180 3 else
181 3 EZUSB_STALL_EP0(); // Stall End Point 0
182 3 break;
183 3 case GD_STRING: // String
184 3 if(dscr_ptr = (void *)EZUSB_GetStringDscr(SETUPDAT[2]))
185 3 {
186 4 // Workaround for rev D errata number 8
187 4 // If you're certain that you will never run on rev D,
188 4 // you can just do this:
189 4 // SUDPTRH = MSB(dscr_ptr);
190 4 // SUDPTRL = LSB(dscr_ptr);
191 4 STRINGDSCR *sdp;
192 4 BYTE len;
193 4
194 4 sdp = dscr_ptr;
195 4
196 4 len = sdp->length;
197 4 if (len > SETUPDAT[6])
198 4 len = SETUPDAT[6]; //limit to the requested length
199 4
200 4 while (len)
201 4 {
202 5 for(i=0; i<min(len,64); i++)
203 5 *(IN0BUF+i) = *((BYTE xdata *)sdp+i);
204 5
205 5 //set length and arm Endpoint
206 5 EZUSB_SET_EP_BYTES(IN0BUF_ID,min(len,64));
207 5 len -= min(len,64);
208 5 (BYTE *)sdp += 64;
209 5
210 5 // Wait for it to go out (Rev C and above)
211 5 while(EP0CS & 0x04)
212 5 ;
213 5 }
214 4
215 4 // Arm a 0 length packet just in case. There was some reflector traffic about
216 4 // Apple hosts asking for too much data. This will keep them happy and will
217 4 // not hurt valid hosts because the next SETUP will clear this.
218 4 EZUSB_SET_EP_BYTES(IN0BUF_ID,0);
219 4 // Clear the HS-nak bit
220 4 EP0CS = bmHS;
221 4 }
222 3 else
223 3 EZUSB_STALL_EP0(); // Stall End Point 0
224 3 break;
225 3 default: // Invalid request
226 3 EZUSB_STALL_EP0(); // Stall End Point 0
227 3 }
228 2 break;
229 2 case SC_GET_INTERFACE: // *** Get Interface
230 2 DR_GetInterface();
231 2 break;
232 2 case SC_SET_INTERFACE: // *** Set Interface
233 2 DR_SetInterface();
234 2 break;
235 2 case SC_SET_CONFIGURATION: // *** Set Configuration
236 2 DR_SetConfiguration();
237 2 break;
238 2 case SC_GET_CONFIGURATION: // *** Get Configuration
239 2 DR_GetConfiguration();
240 2 break;
C51 COMPILER V7.00 FW 09/27/2002 10:11:22 PAGE 5
241 2 case SC_GET_STATUS: // *** Get Status
242 2 if(DR_GetStatus())
243 2 switch(SETUPDAT[0])
244 2 {
245 3 case GS_DEVICE: // Device
246 3 IN0BUF[0] = ((BYTE)Rwuen << 1) | (BYTE)Selfpwr;
247 3 IN0BUF[1] = 0;
248 3 EZUSB_SET_EP_BYTES(IN0BUF_ID,2);
249 3 break;
250 3 case GS_INTERFACE: // Interface
251 3 IN0BUF[0] = 0;
252 3 IN0BUF[1] = 0;
253 3 EZUSB_SET_EP_BYTES(IN0BUF_ID,2);
254 3 break;
255 3 case GS_ENDPOINT: // End Point
256 3 IN0BUF[0] = EPIO[EPID(SETUPDAT[4])].cntrl & bmEPSTALL;
257 3 IN0BUF[1] = 0;
258 3 EZUSB_SET_EP_BYTES(IN0BUF_ID,2);
259 3 break;
260 3 default: // Invalid Command
261 3 EZUSB_STALL_EP0(); // Stall End Point 0
262 3 }
263 2 break;
264 2 case SC_CLEAR_FEATURE: // *** Clear Feature
265 2 if(DR_ClearFeature())
266 2 switch(SETUPDAT[0])
267 2 {
268 3 case FT_DEVICE: // Device
269 3 if(SETUPDAT[2] == 1)
270 3 Rwuen = FALSE; // Disable Remote Wakeup
271 3 else
272 3 EZUSB_STALL_EP0(); // Stall End Point 0
273 3 break;
274 3 case FT_ENDPOINT: // End Point
275 3 if(SETUPDAT[2] == 0)
276 3 {
277 4 EZUSB_UNSTALL_EP( EPID(SETUPDAT[4]) );
278 4 EZUSB_RESET_DATA_TOGGLE( SETUPDAT[4] );
279 4 }
280 3 else
281 3 EZUSB_STALL_EP0(); // Stall End Point 0
282 3 break;
283 3 }
284 2 break;
285 2 case SC_SET_FEATURE: // *** Set Feature
286 2 if(DR_SetFeature())
287 2 switch(SETUPDAT[0])
288 2 {
289 3 case FT_DEVICE: // Device
290 3 if(SETUPDAT[2] == 1)
291 3 Rwuen = TRUE; // Enable Remote Wakeup
292 3 else
293 3 EZUSB_STALL_EP0(); // Stall End Point 0
294 3 break;
295 3 case FT_ENDPOINT: // End Point
296 3 if(SETUPDAT[2] == 0)
297 3 EZUSB_STALL_EP( EPID(SETUPDAT[4]) );
298 3 else
299 3 EZUSB_STALL_EP0(); // Stall End Point 0
300 3 break;
301 3 }
302 2 break;
C51 COMPILER V7.00 FW 09/27/2002 10:11:22 PAGE 6
303 2 default: // *** Invalid Command
304 2 if(DR_VendorCmnd())
305 2 EZUSB_STALL_EP0(); // Stall End Point 0
306 2 }
307 1
308 1 // Acknowledge handshake phase of device request
309 1 // Required for rev C does not effect rev B
310 1 EP0CS |= bmBIT1;
311 1 }
312
313 // Wake-up interrupt handler
314 void resume_isr(void) interrupt WKUP_VECT
315 {
316 1 EZUSB_CLEAR_RSMIRQ();
317 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 941 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 6 27
IDATA SIZE = ---- ----
BIT SIZE = 4 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -