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

📄 stepper.lst

📁 演示了如何开发WINDOES下I/O口驱动
💻 LST
📖 第 1 页 / 共 5 页
字号:
0207 40         =1   385             DB Invalid - CommandTable
A51 MACRO ASSEMBLER  STEPPER                                                                22/07/99 14:17:14 PAGE     7

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

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

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

⌨️ 快捷键说明

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