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

📄 bal.lst

📁 演示了如何开发WINDOES下I/O口驱动
💻 LST
📖 第 1 页 / 共 5 页
字号:
0206 40         =1   377             DB Invalid - CommandTable
0207 40         =1   378             DB Invalid - CommandTable
0208 40         =1   379             DB Invalid - CommandTable
0209 40         =1   380             DB Invalid - CommandTable
                =1   381     ; Next 16 commands are for the Interface
020A 71         =1   382             DB Interface_Get_Status - CommandTable
020B 40         =1   383             DB Interface_Clear_Feature - CommandTable
020C 40         =1   384             DB Invalid - CommandTable
020D 40         =1   385             DB Interface_Set_Feature - CommandTable
A51 MACRO ASSEMBLER  BAL                                                                    21/07/99 16:17:43 PAGE     7

020E 40         =1   386             DB Invalid - CommandTable
020F 40         =1   387             DB Invalid - CommandTable
0210 A5         =1   388             DB Get_Class_Descriptor - CommandTable
0211 40         =1   389             DB Set_Class_Descriptor - CommandTable
0212 40         =1   390             DB Invalid - CommandTable
0213 40         =1   391             DB Invalid - CommandTable
0214 40         =1   392             DB Get_Interface - CommandTable
0215 40         =1   393             DB Set_Interface - CommandTable
0216 40         =1   394             DB Invalid - CommandTable
0217 40         =1   395             DB Invalid - CommandTable
0218 40         =1   396             DB Invalid - CommandTable
0219 40         =1   397             DB Invalid - CommandTable
                =1   398     ; Next 16 commands are for the Endpoint
021A 71         =1   399             DB Endpoint_Get_Status - CommandTable
021B 42         =1   400             DB Endpoint_Clear_Feature - CommandTable
021C 40         =1   401             DB Invalid - CommandTable
021D 40         =1   402             DB Endpoint_Set_Feature - CommandTable
021E 40         =1   403             DB Invalid - CommandTable
021F 40         =1   404             DB Invalid - CommandTable
0220 40         =1   405             DB Invalid - CommandTable
0221 40         =1   406             DB Invalid - CommandTable
0222 40         =1   407             DB Invalid - CommandTable
0223 40         =1   408             DB Invalid - CommandTable
0224 40         =1   409             DB Invalid - CommandTable
0225 40         =1   410             DB Invalid - CommandTable
0226 40         =1   411             DB Endpoint_Sync_Frame - CommandTable
0227 40         =1   412             DB Invalid - CommandTable
0228 40         =1   413             DB Invalid - CommandTable
0229 40         =1   414             DB Invalid - CommandTable
                =1   415     ; Next 16 commands are Class Requests
022A 40         =1   416             DB Invalid - CommandTable
022B 56         =1   417             DB Get_Report - CommandTable
022C 63         =1   418             DB Get_Idle - CommandTable
022D 40         =1   419             DB Get_Protocol - CommandTable
022E 40         =1   420             DB Invalid - CommandTable
022F 40         =1   421             DB Invalid - CommandTable
0230 40         =1   422             DB Invalid - CommandTable
0231 40         =1   423             DB Invalid - CommandTable
0232 40         =1   424             DB Invalid - CommandTable
0233 43         =1   425             DB Set_Report - CommandTable
0234 5D         =1   426             DB Set_Idle - CommandTable
0235 40         =1   427             DB Set_Protocol - CommandTable
0236 40         =1   428             DB Invalid - CommandTable
0237 40         =1   429             DB Invalid - CommandTable
0238 40         =1   430             DB Invalid - CommandTable
0239 40         =1   431             DB Invalid - CommandTable
                =1   432     ;
                =1   433     ; Many requests are INVALID for this example
023A            =1   434     Get_Protocol:                   ; We are not a Boot device
023A            =1   435     Set_Protocol:                   ; We are not a Boot device
023A            =1   436     Set_Descriptor:                 ; Our Descriptors are static
023A            =1   437     Set_Class_Descriptor:           ; Our Descriptors are static
023A            =1   438     Set_Interface:                  ; We only have one Interface
023A            =1   439     Get_Interface:                  ; We do not have an Alternate setting
023A            =1   440     Device_Set_Feature:             ; We have no features that can be set or cleared
023A            =1   441     Interface_Set_Feature:          ; We have no features that can be set or cleared
023A            =1   442     Endpoint_Set_Feature:           ; We have no features that can be set or cleared
023A            =1   443     Device_Clear_Feature:           ; We have no features that can be set or cleared 
023A            =1   444     Interface_Clear_Feature:        ; We have no features that can be set or cleared
023A            =1   445     Endpoint_Sync_Frame:            ; We are not an Isonchronous device
                =1   446     
023A            =1   447     Invalid:                        ; Invalid Request made, STALL the Endpoint
023A D201       =1   448             SETB    STALL
                =1   449     ;
023C            =1   450     Endpoint_Clear_Feature:         ; We have no features that can be set or cleared
                =1   451     ;
A51 MACRO ASSEMBLER  BAL                                                                    21/07/99 16:17:43 PAGE     8

023C 22         =1   452     Reply:  RET
                =1   453     
023D            =1   454     Set_Report:                             ; Host wants to sent us a Report. 
                =1   455     ; The ONLY case in this example where host sends data to us
023D 3000FA     =1   456             JNB     Configured, Invalid     ; Need to be Configured to do this command
0240 907FC5     =1   457             MOV     DPTR, #Out0ByteCount    ; Enable EP0OutBuffer to receive data
0243 F0         =1   458             MOVX    @DPTR, A                ; Any value will do
0244 907FAA     =1   459             MOV     DPTR, #OUT07IRQ         ; Wait for valid data in EP0OutBuffer
0247 E0         =1   460     Wait4D: MOVX    A, @DPTR
0248 5401       =1   461             ANL     A, #00000001b
024A 60FB       =1   462             JZ      Wait4D
024C F0         =1   463             MOVX    @DPTR, A                ; Clear the interrupt
024D 020416     =1   464             JMP     ProcessOutputReport     ; RETurn via this subroutine
0250            =1   465     Get_Report:                             ; Host wants a Report
0250 3000E7     =1   466             JNB     Configured, Invalid     ; Need to be Configured to do this command 
0253 08         =1   467             INC     R0                      ; Point to ReplyBuffer(1)
0254 7618       =1   468             MOV     @R0, #18H               ; Reply with a recognizable (arbitary) value
0256 22         =1   469             RET
0257            =1   470     Set_Idle:                               ; Host wants to tell us how often we should talk
0257 3000E0     =1   471             JNB     Configured, Invalid     ; Need to be Configured to do this command 
025A F541       =1   472             MOV     Idle_Time, A
025C 22         =1   473             RET                             ; Handshake with host
025D            =1   474     Get_Idle:                               ; Host must have forgotten what he told us to do
025D 3000DA     =1   475             JNB     Configured, Invalid     ; Need to be Configured to do this command 
0260 08         =1   476             INC     R0                      ; Point to ReplyBuffer(1)
0261 A641       =1   477             MOV     @R0, Idle_Time
0263 22         =1   478             RET
0264            =1   479     Get_Configuration:
0264 3000D5     =1   480             JNB     Configured, Reply
                =1   481                                             ; If configured return a 1 (via Device_Get_Status)
0267            =1   482     Device_Get_Status:                      ; Only two bits of Device Status are defined
0267 08         =1   483             INC     R0                      ; Point to ReplyBuffer(1)
0268 7601       =1   484             MOV     @R0, #1                 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1)
026A 22         =1   485             RET
                =1   486     
026B            =1   487     Interface_Get_Status:                   ; Interface Status is currently defined as 0
026B            =1   488     Endpoint_Get_Status:
026B 7602       =1   489             MOV     @R0, #2
026D 22         =1   490             RET
026E            =1   491     Set_Configuration:                      ; Valid values are 0 and 1
026E E5F0       =1   492             MOV     A, B                    ; Get LOW(wValue)
0270 6006       =1   493             JZ      Deconfigured
0272 14         =1   494             DEC     A
0273 70C5       =1   495             JNZ     Invalid
0275 D200       =1   496             SETB    Configured
0277 22         =1   497             RET
0278            =1   498     Deconfigured:
0278 C200       =1   499             CLR     Configured
027A 22         =1   500             RET
027B            =1   501     Get_Descriptor:                         ; Host wants to know who/what we are
027B D203       =1   502             SETB    IsDescriptor
027D 14         =1   503             DEC     A                       ; Valid Values are 1, 2 and 3
027E 9002C5     =1   504             MOV     DPTR, #DeviceDescriptor
0281 60B9       =1   505             JZ      Reply
0283 14         =1   506             DEC     A
0284 9002D7     =1   507             MOV     DPTR, #ConfigurationDescriptor
0287 60B3       =1   508             JZ      Reply
0289 14         =1   509             DEC     A
028A 70AE       =1   510             JNZ     Invalid
                =1   511     ; Request is for a String Descriptor
028C 900315     =1   512             MOV     DPTR, #String0          ; Point to String 0
028F E5F0       =1   513             MOV     A, B                    ; Get String Index
0291            =1   514     NextString:
0291 601E       =1   515             JZ      FixUpthenReply
0293 F540       =1   516             MOV     Temp, A                 ; Save String Index
0295 31CB       =1   517             CALL    NextDPTR
A51 MACRO ASSEMBLER  BAL                                                                    21/07/99 16:17:43 PAGE     9

0297 E0         =1   518             MOVX    A, @DPTR                ; Get the String Length (= 0 means we're at Backsto
                             p)
0298 60A0       =1   519             JZ      Invalid                 ; Asked for a string I don't have 
029A E540       =1   520             MOV     A, Temp
029C 14         =1   521             DEC     A
029D 80F2       =1   522             JMP     NextString              ; Check if we are there yet
029F            =1   523     Get_Class_Descriptor:                   ; Valid values are 21H, 22H, 23H for Class Request
029F D203       =1   524             SETB    IsDescriptor
02A1 C3         =1   525             CLR     C
02A2 9421       =1   526             SUBB    A, #21H
02A4 9002E9     =1   527             MOV     DPTR, #HIDDescriptor
02A7 6093       =1   528             JZ      Reply
02A9 14         =1   529             DEC     A
02AA 9002F9     =1   530             MOV     DPTR, #ReportDescriptor
02AD 608D       =1   531             JZ      Reply
                =1   532     ;       DEC     A                       ; This example does not use Physical Descriptors
                =1   533     ;       JZ      Send_Physical_Descriptor
02AF 8089       =1   534             JMP     Invalid
                =1   535     ;
                =1   536     ; Error check: this MUST be on within a page of CommandTable
  00B7          =1   537     WithinSamePage EQU $ - CommandTable     
                =1   538     ;
02B1            =1   539     FixUpthenReply:                         ; EZ-USB Rev D has a String Descriptor bug
                =1   540                                             ; Need to fill the IN0BUF (@ 7F00H) myself
02B1 E0         =1   541             MOVX    A, @DPTR                ; Get the string length
02B2 FF         =1   542             MOV     R7, A                   ; Save counter
02B3 F5F0       =1   543             MOV     B, A
02B5 7800       =1   544             MOV     R0, #LOW(EP0InBuffer)   ; PageReg = 7FH = HIGH(EP0InBuffer)
02B7 F2         =1   545     CopySD: MOVX    @R0, A
02B8 08         =1   546             INC     R0
02B9 A3         =1   547             INC     DPTR
02BA E0         =1   548             MOVX    A, @DPTR
02BB DFFA       =1   549             DJNZ    R7, CopySD
                =1   550     ; Fixup complete, get back to the program flow
02BD D0E0       =1   551             POP     ACC                     ; Get rid of the return address
02BF D0E0       =1   552             POP     ACC
02C1 E5F0       =1   553             MOV     A, B                    ; Retrieve byte count
02C3 21A9       =1   554             JMP     SendEP0InBuffer
                     555     $INCLUDE(DTables.A51)
                =1   556     ; This module declares the descriptors
                =1   557     ;
                =1   558     ; This example has one Device Descriptor with:
                =1   559     ;       One Configuration - single IN port and single OUT port
                =1   560     ;       One Interface - there is only one method of accessing the ports
                =1   561     ;       One HID Descriptor - to make PC host software simpler
                =1   562     ;       One Endpoint Descriptor - for HID Input Reports
                =1   563     ;       One Report Descriptor - one byte IN and one byte OUT reports
                =1   564     ;       Multiple Sting Descriptors - to aid the user
                =1   565     ;
----            =1   566             CSEG
02C5            =1   567     DeviceDescriptor:
02C5 1201       =1   568             DB      18, 1           ; Length, Type

⌨️ 快捷键说明

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