⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rbdc.lst

📁 演示了如何开发WINDOES下I/O口驱动
💻 LST
📖 第 1 页 / 共 5 页
字号:
02A6 E0         =1   540             MOVX    A, @DPTR                ; Get the String Length (= 0 means we're at Backsto
                             p)
02A7 6091       =1   541             JZ      Invalid                 ; Asked for a string I don't have 
02A9 E540       =1   542             MOV     A, Temp
02AB 14         =1   543             DEC     A
02AC 80F2       =1   544             JMP     NextString              ; Check if we are there yet
02AE            =1   545     Get_Class_Descriptor:                   ; Valid values are 21H, 22H, 23H for Class Request
02AE D203       =1   546             SETB    IsDescriptor
02B0 C3         =1   547             CLR     C
02B1 9421       =1   548             SUBB    A, #21H
02B3 900304     =1   549             MOV     DPTR, #TextHIDDescriptor
02B6 30F103     =1   550             JNB     B.1, Other2             ; B = Descriptor Index (=1 or 2)
02B9 900345     =1   551             MOV     DPTR, #DotHIDDescriptor
02BC 60C5       =1   552     Other2: JZ      Reply2
02BE 14         =1   553             DEC     A
02BF 900314     =1   554             MOV     DPTR, #TextReportDescriptor
02C2 30F103     =1   555             JNB     B.1, Other3             ; B = Descriptor Index (=1 or 2)
02C5 90034E     =1   556             MOV     DPTR, #DotReportDescriptor
02C8 60B9       =1   557     Other3: JZ      Reply2
                =1   558     ;       DEC     A                       ; This example does not use Physical Descriptors
                =1   559     ;       JZ      Send_Physical_Descriptor
02CA 413A       =1   560             JMP     Invalid
                =1   561     ;
                =1   562     ; Error check: this MUST be on within a page of CommandTable
  00D2          =1   563     WithinSamePage EQU $ - CommandTable     
                =1   564     ;
02CC            =1   565     FixUpthenReply:                         ; EZ-USB Rev D has a String Descriptor bug
                =1   566                                             ; Need to fill the IN0BUF (@ 7F00H) myself
02CC E0         =1   567             MOVX    A, @DPTR                ; Get the string length
02CD FF         =1   568             MOV     R7, A                   ; Save counter
02CE F5F0       =1   569             MOV     B, A
02D0 7800       =1   570             MOV     R0, #LOW(EP0InBuffer)   ; PageReg = 7FH = HIGH(EP0InBuffer)
02D2 F2         =1   571     CopySD: MOVX    @R0, A
02D3 08         =1   572             INC     R0
02D4 A3         =1   573             INC     DPTR
02D5 E0         =1   574             MOVX    A, @DPTR
02D6 DFFA       =1   575             DJNZ    R7, CopySD
                =1   576     ; Fixup complete, get back to the program flow
02D8 D0E0       =1   577             POP     ACC                     ; Get rid of the return address
02DA D0E0       =1   578             POP     ACC
02DC E5F0       =1   579             MOV     A, B                    ; Retrieve byte count
02DE 21A9       =1   580             JMP     SendEP0InBuffer
                     581     $INCLUDE(DTables.A51)
                =1   582     ; This module declares the descriptors
A51 MACRO ASSEMBLER  RBDC                                                                   25/07/99 15:58:57 PAGE    10

                =1   583     ;
                =1   584     ; This example has one Device Descriptor with TWO Configurations
  0002          =1   585     ConfigurationCount EQU  2
                =1   586     ; Dot Mode: the IO device accepts RAW dots for the display
                =1   587     ;       One Interface - there is only one method of accessing the ports
                =1   588     ;       One HID Descriptor - to make PC host software simpler
                =1   589     ;       One Report Descriptor - 40 byte OUT report
                =1   590     ; Text mode: the IO device accepts ASCII characters for display
                =1   591     ;       One Interface - there is only one method of accessing the ports
                =1   592     ;       One HID Descriptor - to make PC host software simpler
                =1   593     ;       One Endpoint Descriptor - for HID Input Reports
                =1   594     ;       One Report Descriptor - 40 byte IN and 7 byte OUT reports
                =1   595     ;       Multiple Sting Descriptors - to aid the user
                =1   596     ;
                =1   597     ; PROBLEM: during system testing it was discovered that Windows 98 DOES NOT SUPPORT the
                =1   598     ; HidD_GetConfiguration system call - this means that an application program (which is what
                =1   599     ; this is) CANNOT send a SetConfiguration packet to an I/O device; the call is supported
                =1   600     ; by Windows 2000 and by Windows 98 for kernel level (ie device driver) software.
                =1   601     ; The "Reader Board" I/O device was tested independantly for its correct dual-configuration
                =1   602     ; operation.
                =1   603     ; This example, therefore, uses an ALTERNATE method of implementing "dual-configuration"
                =1   604     ; I extended the Report Buffer by one byte and prepend the data with the "mode" byte.
                =1   605     ; This works, not as elegant as I would have wanted, but it does implement "dual-modes"
                =1   606     ; The "default" configuration (=1) is Text mode so that we have an INPUT Report
----            =1   607             CSEG
02E0            =1   608     DeviceDescriptor:
02E0 1201       =1   609             DB      18, 1           ; Length, Type
02E2 0101       =1   610             DW      101H            ; USB Rev 1.1
02E4 000000     =1   611             DB      0, 0, 0         ; Class, Subclass and Protocol
02E7 40         =1   612             DB      64              ; EP0 size
02E8 4242       =1   613             DW      4242H, 1, 1     ; Vendor ID, Product ID and Version
02EA 0001                    
02EC 0001                    
02EE 010200     =1   614             DB      1, 2, 0         ; Manufacturer, Product & Serial# Names
02F1 02         =1   615             DB      ConfigurationCount; #Configs
                =1   616     
02F2            =1   617     TextConfigurationDescriptor:
02F2 0902       =1   618             DB      9, 2            ; Length, Type
02F4 2200       =1   619             DB      LOW(TextConfigLength), HIGH(TextConfigLength)
02F6 010103     =1   620             DB      1, 1, 3         ; #Interfaces, Configuration#, Config. Name
02F9 80         =1   621             DB      10000000b       ; Attributes = Bus Powered
02FA 32         =1   622             DB      50              ; Max. Power is 50x2 = 100mA
02FB            =1   623     TextInterfaceDescriptor:
02FB 0904       =1   624             DB      9, 4            ; Length, Type
02FD 000001     =1   625             DB      0, 0, 1         ; No alternate setting, HID Input uses EP1
0300 03         =1   626             DB      3               ; Class = Human Interface Device
0301 0000       =1   627             DB      0, 0            ; Subclass and Protocol
0303 00         =1   628             DB      0               ; Interface Name
0304            =1   629     TextHIDDescriptor:
0304 0921       =1   630             DB      9, 21H          ; Length, Type
0306 0001       =1   631             DB      0, 1            ; HID Class Specification compliance
0308 00         =1   632             DB      0               ; Country localization (=none)
0309 01         =1   633             DB      1               ; Number of descriptors to follow
030A 22         =1   634             DB      22H             ; And it's a Report descriptor
030B 1F00       =1   635             DB      LOW(TextReportLength), HIGH(TextReportLength)
030D            =1   636     TextEndpointDescriptor:
030D 0705       =1   637             DB      7, 5            ; Length, Type
030F 81         =1   638             DB      10000001b       ; Address = IN 1
0310 03         =1   639             DB      00000011b       ; Interrupt
0311 4000       =1   640             DB      64, 0           ; Maximum packet size
0313 64         =1   641             DB      100             ; Poll every 0.1 seconds 
  0022          =1   642     TextConfigLength        EQU $ - TextConfigurationDescriptor
                =1   643     
0314            =1   644     TextReportDescriptor:           ; Generated with HID Tool, copied to here
0314 0600FF     =1   645             DB      6, 0, 0FFH      ; Usage_Page (Vendor Defined)
0317 0901       =1   646             DB      9, 1            ; Usage (I/O Device)
A51 MACRO ASSEMBLER  RBDC                                                                   25/07/99 15:58:57 PAGE    11

0319 A101       =1   647             DB      0A1H, 1         ; Collection (Application)
031B 1901       =1   648             DB      19H, 1          ;   Usage_Minimum
031D 2902       =1   649             DB      29H, 2          ;   Usage_Maximum
031F 1500       =1   650             DB      15H, 0          ;   Logical_Minimum (0)
0321 26FF00     =1   651             DB      26H, 255, 0     ;   Logical_Maximum (255)
0324 7508       =1   652             DB      75H, 8          ;   Report_Size (8)
0326 9528       =1   653             DB      95H, 40         ;   Report_Count (40) 
0328 8102       =1   654             DB      81H, 2          ;   Input (Data,Var,Abs) = DOTs
032A 1901       =1   655             DB      19H, 1          ;   Usage_Minimum
032C 2902       =1   656             DB      29H, 2          ;   Usage_Maximum
032E 9529       =1   657             DB      95H, 41         ;   Report_Count (7)
                =1   658     ; Report Count Change: See comment re-SetConfiguration
0330 9102       =1   659             DB      91H, 2          ;   Output (Data,Var,Abs) = Text
0332 C0         =1   660             DB      0C0H            ; End_Collection
  001F          =1   661     TextReportLength        EQU $-TextReportDescriptor
                =1   662     
0333            =1   663     DotConfigurationDescriptor:
0333 0902       =1   664             DB      9, 2            ; Length, Type
0335 1B00       =1   665             DB      LOW(DotConfigLength), HIGH(DotConfigLength)
0337 010204     =1   666             DB      1, 2, 4         ; #Interfaces, Configuration#, Config. Name
033A 80         =1   667             DB      10000000b       ; Attributes = Bus Powered
033B 32         =1   668             DB      50              ; Max. Power is 50x2 = 100mA
033C            =1   669     DotInterfaceDescriptor:
033C 0904       =1   670             DB      9, 4            ; Length, Type
033E 000000     =1   671             DB      0, 0, 0         ; No alternate setting, HID Output Report uses EP0
0341 03         =1   672             DB      3               ; Class = Human Interface Device
0342 0000       =1   673             DB      0, 0            ; Subclass and Protocol
0344 00         =1   674             DB      0               ; Interface Name
0345            =1   675     DotHIDDescriptor:
0345 0921       =1   676             DB      9, 21H          ; Length, Type
0347 0001       =1   677             DB      0, 1            ; HID Class Specification compliance
0349 00         =1   678             DB      0               ; Country localization (=none)
034A 01         =1   679             DB      1               ; Number of descriptors to follow
034B 22         =1   680             DB      22H             ; And it's a Report descriptor
034C 1700       =1   681             DB      LOW(DotReportLength), HIGH(DotReportLength)
  001B          =1   682     DotConfigLength EQU $ - DotConfigurationDescriptor
                =1   683     
034E            =1   684     DotReportDescriptor:            ; Generated with HID Tool, copied to here
034E 0600FF     =1   685             DB      6, 0, 0FFH      ; Usage_Page (Vendor Defined)
0351 0901       =1   686             DB      9, 1            ; Usage (I/O Device)
0353 A101       =1   687             DB      0A1H, 1         ; Collection (Application)
0355 1901       =1   688             DB      19H, 1          ;   Usage_Minimum
0357 2902       =1   689             DB      29H, 2          ;   Usage_Maximum
0359 1500       =1   690             DB      15H, 0          ;   Logical_Minimum (0)
035B 26FF00     =1   691             DB      26H, 255, 0     ;   Logical_Maximum (255)
035E 7508       =1   692             DB      75H, 8          ;   Report_Size (8)
0360 9529       =1   693             DB      95H, 41         ;   Report_Count (41) 
                =1   694     ; Report Count Change: See comment re-SetConfiguration
0362 9102       =1   695             DB      91H, 2          ;   Output (Data,Var,Abs) = DOTs
0364 C0         =1   696             DB      0C0H            ; End_Collection
  0017          =1   697     DotReportLength EQU $-DotReportDescriptor
                =1   698              
0365            =1   699     String0:                        ; Declare the UNICODE strings
0365 04030904   =1   700             DB      4, 3, 9, 4      ; Only English language strings supported
0369            =1   701     String1:                        ; Manufacturer
0369 2C03       =1   702             DB      (String2-String1),3 ; Length, Type 
036B 55005300   =1   703             DB      "U",0,"S",0,"B",0," ",0,"D",0,"e",0,"s",0,"i",0,"g",0,"n",0," ", 0
036F 42002000                
0373 44006500                
0377 73006900                
037B 67006E00                
037F 2000                    
0381 42007900   =1   704             DB      "B",0,"y",0," ",0,"E",0,"x",0,"a",0,"m",0,"p",0,"l",0,"e",0
0385 20004500                
0389 78006100                
038D 6D007000                
A51 MACRO ASSEMBLER  RBDC                                                                   25/07/99 15:58:57 PAGE    12

0391 6C006500                
0395            =1   705     String2:                        ; Product Name
0395 1A03       =1   706             DB      (String3-String2),3
0397 52006500   =1   707             DB      "R",0,"e",0,"a",0,"d",0,"e",0,"r",0
039B 61006400                
039F 65007200                
03A3 20004200   =1   708             DB      " ",0,"B",0,"o",0,"a",0,"r",0,"d",0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -