📄 lcp.lst
字号:
01F1 C201 =1 377 CLR STALL
01F3 C203 =1 378 CLR IsDescriptor
01F5 22 =1 379 RET ; Go to service routine
=1 380
=1 381 ; Since the table only contains byte offsets, it is important that all these routines are
=1 382 ; within one page (100H) of CommandTable
=1 383 ;
01F6 =1 384 CommandTable:
=1 385 ; First 16 commands are for the Device
A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 7
01F6 6D =1 386 DB Device_Get_Status - CommandTable
01F7 40 =1 387 DB Device_Clear_Feature - CommandTable
01F8 40 =1 388 DB Invalid - CommandTable
01F9 40 =1 389 DB Device_Set_Feature - CommandTable
01FA 40 =1 390 DB Invalid - CommandTable
01FB 40 =1 391 DB Invalid - CommandTable ; SIE implements Device_Set_Address
01FC 81 =1 392 DB Get_Descriptor - CommandTable
01FD 40 =1 393 DB Set_Descriptor - CommandTable
01FE 6A =1 394 DB Get_Configuration - CommandTable
01FF 74 =1 395 DB Set_Configuration - CommandTable
0200 40 =1 396 DB Invalid - CommandTable
0201 40 =1 397 DB Invalid - CommandTable
0202 40 =1 398 DB Invalid - CommandTable
0203 40 =1 399 DB Invalid - CommandTable
0204 40 =1 400 DB Invalid - CommandTable
0205 40 =1 401 DB Invalid - CommandTable
=1 402 ; Next 16 commands are for the Interface
0206 71 =1 403 DB Interface_Get_Status - CommandTable
0207 40 =1 404 DB Interface_Clear_Feature - CommandTable
0208 40 =1 405 DB Invalid - CommandTable
0209 40 =1 406 DB Interface_Set_Feature - CommandTable
020A 40 =1 407 DB Invalid - CommandTable
020B 40 =1 408 DB Invalid - CommandTable
020C A5 =1 409 DB Get_Class_Descriptor - CommandTable
020D 40 =1 410 DB Set_Class_Descriptor - CommandTable
020E 40 =1 411 DB Invalid - CommandTable
020F 40 =1 412 DB Invalid - CommandTable
0210 40 =1 413 DB Get_Interface - CommandTable
0211 40 =1 414 DB Set_Interface - CommandTable
0212 40 =1 415 DB Invalid - CommandTable
0213 40 =1 416 DB Invalid - CommandTable
0214 40 =1 417 DB Invalid - CommandTable
0215 40 =1 418 DB Invalid - CommandTable
=1 419 ; Next 16 commands are for the Endpoint
0216 71 =1 420 DB Endpoint_Get_Status - CommandTable
0217 42 =1 421 DB Endpoint_Clear_Feature - CommandTable
0218 40 =1 422 DB Invalid - CommandTable
0219 40 =1 423 DB Endpoint_Set_Feature - CommandTable
021A 40 =1 424 DB Invalid - CommandTable
021B 40 =1 425 DB Invalid - CommandTable
021C 40 =1 426 DB Invalid - CommandTable
021D 40 =1 427 DB Invalid - CommandTable
021E 40 =1 428 DB Invalid - CommandTable
021F 40 =1 429 DB Invalid - CommandTable
0220 40 =1 430 DB Invalid - CommandTable
0221 40 =1 431 DB Invalid - CommandTable
0222 40 =1 432 DB Endpoint_Sync_Frame - CommandTable
0223 40 =1 433 DB Invalid - CommandTable
0224 40 =1 434 DB Invalid - CommandTable
0225 40 =1 435 DB Invalid - CommandTable
=1 436 ; Next 16 commands are Class Requests
0226 40 =1 437 DB Invalid - CommandTable
0227 56 =1 438 DB Get_Report - CommandTable
0228 63 =1 439 DB Get_Idle - CommandTable
0229 40 =1 440 DB Get_Protocol - CommandTable
022A 40 =1 441 DB Invalid - CommandTable
022B 40 =1 442 DB Invalid - CommandTable
022C 40 =1 443 DB Invalid - CommandTable
022D 40 =1 444 DB Invalid - CommandTable
022E 40 =1 445 DB Invalid - CommandTable
022F 43 =1 446 DB Set_Report - CommandTable
0230 5D =1 447 DB Set_Idle - CommandTable
0231 40 =1 448 DB Set_Protocol - CommandTable
0232 40 =1 449 DB Invalid - CommandTable
0233 40 =1 450 DB Invalid - CommandTable
0234 40 =1 451 DB Invalid - CommandTable
A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 8
0235 40 =1 452 DB Invalid - CommandTable
=1 453 ;
=1 454 ; Many requests are INVALID for this example
0236 =1 455 Get_Protocol: ; We are not a Boot device
0236 =1 456 Set_Protocol: ; We are not a Boot device
0236 =1 457 Set_Descriptor: ; Our Descriptors are static
0236 =1 458 Set_Class_Descriptor: ; Our Descriptors are static
0236 =1 459 Set_Interface: ; We only have one Interface
0236 =1 460 Get_Interface: ; We do not have an Alternate setting
0236 =1 461 Device_Set_Feature: ; We have no features that can be set or cleared
0236 =1 462 Interface_Set_Feature: ; We have no features that can be set or cleared
0236 =1 463 Endpoint_Set_Feature: ; We have no features that can be set or cleared
0236 =1 464 Device_Clear_Feature: ; We have no features that can be set or cleared
0236 =1 465 Interface_Clear_Feature: ; We have no features that can be set or cleared
0236 =1 466 Endpoint_Sync_Frame: ; We are not an Isonchronous device
=1 467
0236 =1 468 Invalid: ; Invalid Request made, STALL the Endpoint
0236 D201 =1 469 SETB STALL
=1 470 ;
0238 =1 471 Endpoint_Clear_Feature: ; We have no features that can be set or cleared
=1 472 ;
0238 22 =1 473 Reply: RET
=1 474
0239 =1 475 Set_Report: ; Host wants to sent us a Report.
=1 476 ; The ONLY case in this example where host sends data to us
0239 3000FA =1 477 JNB Configured, Invalid ; Need to be Configured to do this command
023C 907FC5 =1 478 MOV DPTR, #Out0ByteCount ; Enable EP0OutBuffer to receive data
023F F0 =1 479 MOVX @DPTR, A ; Any value will do
0240 907FAA =1 480 MOV DPTR, #OUT07IRQ ; Wait for valid data in EP0OutBuffer
0243 E0 =1 481 Wait4D: MOVX A, @DPTR
0244 5401 =1 482 ANL A, #00000001b
0246 60FB =1 483 JZ Wait4D
0248 F0 =1 484 MOVX @DPTR, A ; Clear the interrupt
0249 0203BC =1 485 JMP ProcessOutputReport ; RETurn via this subroutine
024C =1 486 Get_Report: ; Host wants a Report
024C 3000E7 =1 487 JNB Configured, Invalid ; Need to be Configured to do this command
024F 08 =1 488 INC R0 ; Point to ReplyBuffer(1)
0250 7618 =1 489 MOV @R0, #18H ; Reply with a recognizable (arbitary) value
0252 22 =1 490 RET
0253 =1 491 Set_Idle: ; Host wants to tell us how often we should talk
0253 3000E0 =1 492 JNB Configured, Invalid ; Need to be Configured to do this command
0256 F541 =1 493 MOV Idle_Time, A
0258 22 =1 494 RET ; Handshake with host
0259 =1 495 Get_Idle: ; Host must have forgotten what he told us to do
0259 3000DA =1 496 JNB Configured, Invalid ; Need to be Configured to do this command
025C 08 =1 497 INC R0 ; Point to ReplyBuffer(1)
025D A641 =1 498 MOV @R0, Idle_Time
025F 22 =1 499 RET
0260 =1 500 Get_Configuration: ; Need to return 0 or 1
0260 300004 =1 501 JNB Configured, Configuration0
0263 =1 502 Configuration1: ; Same bit pattern as Device_Get_Status
0263 =1 503 Device_Get_Status: ; Only two bits of Device Status are defined
0263 08 =1 504 INC R0 ; Point to ReplyBuffer(1)
0264 7601 =1 505 MOV @R0, #1 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1)
0266 22 =1 506 RET
0267 =1 507 Configuration0: ; Same bit pattern as Interface_Get_Status
0267 =1 508 Interface_Get_Status: ; Interface Status is currently defined as 0
0267 =1 509 Endpoint_Get_Status:
0267 7602 =1 510 MOV @R0, #2
0269 22 =1 511 RET
026A =1 512 Set_Configuration: ; Valid values are 0 and 1
026A E5F0 =1 513 MOV A, B ; Get LOW(wValue)
026C 6006 =1 514 JZ Deconfigured
026E 14 =1 515 DEC A
026F 70C5 =1 516 JNZ Invalid
0271 D200 =1 517 SETB Configured
A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 9
0273 22 =1 518 RET
0274 =1 519 Deconfigured:
0274 C200 =1 520 CLR Configured
0276 22 =1 521 RET
0277 =1 522 Get_Descriptor: ; Host wants to know who/what we are
0277 D203 =1 523 SETB IsDescriptor
0279 14 =1 524 DEC A ; Valid Values are 1, 2 and 3
027A 9002C1 =1 525 MOV DPTR, #DeviceDescriptor
027D 60B9 =1 526 JZ Reply
027F 14 =1 527 DEC A
0280 9002D3 =1 528 MOV DPTR, #ConfigurationDescriptor
0283 60B3 =1 529 JZ Reply
0285 14 =1 530 DEC A
0286 70AE =1 531 JNZ Invalid
=1 532 ; Request is for a String Descriptor
0288 900305 =1 533 MOV DPTR, #String0 ; Point to String 0
028B E5F0 =1 534 MOV A, B ; Get String Index
028D =1 535 NextString:
028D 601E =1 536 JZ FixUpthenReply
028F F540 =1 537 MOV Temp, A ; Save String Index
0291 31C7 =1 538 CALL NextDPTR
0293 E0 =1 539 MOVX A, @DPTR ; Get the String Length (= 0 means we're at Backsto
p)
0294 60A0 =1 540 JZ Invalid ; Asked for a string I don't have
0296 E540 =1 541 MOV A, Temp
0298 14 =1 542 DEC A
0299 80F2 =1 543 JMP NextString ; Check if we are there yet
029B =1 544 Get_Class_Descriptor: ; Valid values are 21H, 22H, 23H for Class Request
029B D203 =1 545 SETB IsDescriptor
029D C3 =1 546 CLR C
029E 9421 =1 547 SUBB A, #21H
02A0 9002E5 =1 548 MOV DPTR, #HIDDescriptor
02A3 6093 =1 549 JZ Reply
02A5 14 =1 550 DEC A
02A6 9002EE =1 551 MOV DPTR, #ReportDescriptor
02A9 608D =1 552 JZ Reply
=1 553 ; DEC A ; This example does not use Physical Descriptors
=1 554 ; JZ Send_Physical_Descriptor
02AB 8089 =1 555 JMP Invalid
=1 556 ;
=1 557 ; Error check: this MUST be on within a page of CommandTable
00B7 =1 558 WithinSamePage EQU $ - CommandTable
=1 559 ;
02AD =1 560 FixUpthenReply: ; EZ-USB Rev D has a String Descriptor bug
=1 561 ; Need to fill the IN0BUF (@ 7F00H) myself
02AD E0 =1 562 MOVX A, @DPTR ; Get the string length
02AE FF =1 563 MOV R7, A ; Save counter
02AF F5F0 =1 564 MOV B, A
02B1 7800 =1 565 MOV R0, #LOW(EP0InBuffer) ; PageReg = 7FH = HIGH(EP0InBuffer)
02B3 F2 =1 566 CopySD: MOVX @R0, A
02B4 08 =1 567 INC R0
02B5 A3 =1 568 INC DPTR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -