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