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

📄 lcp.lst

📁 演示了如何开发WINDOES下I/O口驱动
💻 LST
📖 第 1 页 / 共 5 页
字号:
                =1   186     ;       LJMP    EP7In_ISR
                =1   187     ;       DB      0
                =1   188     ;       LJMP    EP7Out_ISR              
                =1   189     ; End of Interrupt Vector tables
A51 MACRO ASSEMBLER  LCP                                                                    25/07/99 18:37:13 PAGE     4

                =1   190     
                =1   191     ; When a feature is used insert the required interrupt processing here
                =1   192     ; The example use only used Endpoints 0 and 1 and also SOF for timing
0118            =1   193     Reserved:
0118            =1   194     INT0_ISR:
0118            =1   195     INT1_ISR:
0118            =1   196     Timer1_ISR:
0118            =1   197     UART0_ISR:
0118            =1   198     Timer2_ISR:
0118            =1   199     UART1_ISR:
0118            =1   200     I2C_ISR:
0118            =1   201     INT4_ISR:
0118            =1   202     INT5_ISR:
0118            =1   203     INT6_ISR:
0118            =1   204     SOF_ISR:
0118            =1   205     SUTOK_ISR:
0118            =1   206     EP0In_ISR:
0118            =1   207     EP0Out_ISR:
0118            =1   208     EP1In_ISR:
0118            =1   209     EP1Out_ISR:
0118            =1   210     EP2In_ISR:
0118            =1   211     EP2Out_ISR:
0118            =1   212     EP3In_ISR:
0118            =1   213     EP3Out_ISR:
0118            =1   214     EP4In_ISR:
0118            =1   215     EP4Out_ISR:
0118            =1   216     EP5In_ISR:
0118            =1   217     EP5Out_ISR:
0118            =1   218     EP6In_ISR:
0118            =1   219     EP6Out_ISR:
0118            =1   220     EP7In_ISR :
0118            =1   221     EP7Out_ISR:
0118            =1   222     Not_Used:                       ; Should not get any of these
0118 32         =1   223             RETI
                =1   224     
0119            =1   225     ClearINT2:                      ; Tell the hardware that we're done
0119 E591       =1   226             MOV     A, EXIF
011B C2E4       =1   227             CLR     ACC.4           ; Clear the Interrupt 2 bit
011D F591       =1   228             MOV     EXIF, A
011F 22         =1   229             RET
                =1   230     
0120            =1   231     USBReset_ISR:                   ; Bus has been Reset, move to DEFAULT state
0120 C0E0       =1   232             PUSH    ACC
0122 C200       =1   233             CLR     Configured
0124 3119       =1   234             CALL    ClearINT2
                =1   235                                     ; No need to clear source of interrupt
0126 D0E0       =1   236             POP     ACC
0128 32         =1   237             RETI
                =1   238     
0129            =1   239     Suspend_ISR:                    ; SIE detected an Idle bus
0129 C0E0       =1   240             PUSH    ACC
012B E587       =1   241             MOV     A, PCON
012D 4401       =1   242             ORL     A, #1
012F F587       =1   243             MOV     PCON, A         ; Go to sleep!
0131 00         =1   244             NOP
0132 00         =1   245             NOP                     ; Wake up here due to a USBResume
0133 00         =1   246             NOP
0134 3119       =1   247             CALL    ClearINT2
0136 D0E0       =1   248             POP     ACC
0138 32         =1   249             RETI
                =1   250             
0139            =1   251     WakeUp_ISR:                     ; Not using external WAKEUP in these examples
                =1   252                                     ; So this must be due to a USBResume
0139 C2DC       =1   253             CLR     EICON.4         ; Clear the wakeup interrupt source
013B 32         =1   254             RETI
                =1   255     
A51 MACRO ASSEMBLER  LCP                                                                    25/07/99 18:37:13 PAGE     5

013C            =1   256     SUDAV_ISR:                      ; A Setup packet has been received
013C C0D0       =1   257             PUSH    PSW             ; Save Registers before the service routine
013E C0E0       =1   258             PUSH    ACC
0140 C082       =1   259             PUSH    DPL
0142 C083       =1   260             PUSH    DPH
0144 120165     =1   261             CALL    ServiceSetupPacket
0147 3119       =1   262             CALL    ClearINT2                               
                =1   263                                     ; Clear the source of the interrupt
0149 7401       =1   264             MOV     A, #00000001b
014B 907FAB     =1   265             MOV     DPTR, #USBIRQ
014E F0         =1   266             MOVX    @DPTR, A
014F D083       =1   267     ExitISR:POP     DPH             ; Restore Registers
0151 D082       =1   268             POP     DPL
0153 D0E0       =1   269             POP     ACC
0155 D0D0       =1   270             POP     PSW
0157 32         =1   271             RETI
                =1   272     
0158            =1   273     Timer0_ISR:
0158 C0D0       =1   274             PUSH    PSW             ; Save Registers before the service routine
015A C0E0       =1   275             PUSH    ACC
015C C082       =1   276             PUSH    DPL
015E C083       =1   277             PUSH    DPH
0160 1203CA     =1   278             CALL    ServiceTimerRoutine
                =1   279                                     ; Source of the interrupt claered automatically
0163 80EA       =1   280             JMP     ExitISR
                =1   281     
                     282     $INCLUDE(../USB_INT.A51)
                =1   283     ; This module is common to all of the examples.
                =1   284     ; It services USB Requests from the SIE.
                =1   285     ; Interpretation of the Output Reports is handled by MAIN
                =1   286     ;
----            =1   287             CSEG
0165            =1   288     ServiceSetupPacket:
0165 907FE8     =1   289             MOV     DPTR, #SETUPDAT         ; Point to Setup Packet data
0168 E0         =1   290             MOVX    A, @DPTR                ; Get the RequestType
0169 A2E7       =1   291             MOV     C, ACC.7                ; Bit 7 = 1 means IO device needs to send data to P
                             C Host
016B 9202       =1   292             MOV     SendData, C
016D 545C       =1   293             ANL     A, #01011100b           ; IF RequestType[6.4.3.2] = 1 THEN goto BadRequest
016F 7051       =1   294             JNZ     BadRequest
0171 E0         =1   295             MOVX    A, @DPTR                ; IF RequestType[1&0] = 1 THEN goto BadRequest
0172 A2E0       =1   296             MOV     C, ACC.0
0174 82E1       =1   297             ANL     C, ACC.1
0176 404A       =1   298             JC      BadRequest
0178 30E502     =1   299             JNB     ACC.5, NotB5            ; IF RequestType[5] = 1 THEN RequestType[1,0] = [1,
                             1]
017B 7403       =1   300             MOV     A, #00000011b
017D 5403       =1   301     NotB5:  ANL     A, #00000011b           ; Set CommandIndex[5,4] = RequestType[1,0]
017F C4         =1   302             SWAP    A
0180 F540       =1   303             MOV     Temp, A                 ; Save HI nibble of CommandIndex
                =1   304                                             ; Set CommandIndex[3,0] = Request[3,0]
0182 A3         =1   305             INC     DPTR                    ; Point to Request
0183 E0         =1   306             MOVX    A, @DPTR
0184 540F       =1   307             ANL     A, #00001111b           ; Only 13 are defined today, handle in table
0186 4540       =1   308             ORL     A, Temp 
0188 1201D1     =1   309             CALL    CorrectSubroutine       ; goto CommandTable(CommandIndex)
                =1   310                                             ; Returns STALL=1 if a stall is required
018B 200134     =1   311             JB      STALL, BadRequest
018E 300218     =1   312             JNB     SendData, HandShake
0191 200320     =1   313             JB      IsDescriptor, LoadSUDPTR; EZ-USB has a short cut for descriptors
                =1   314                                             ; Send data in ReplyBuffer
0194 907F02     =1   315             MOV     DPTR, #EP0InBuffer+2
0197 7846       =1   316             MOV     R0, #ReplyBuffer+3
0199 754003     =1   317             MOV     Temp, #3                ; Copy maximum byte count
019C E6         =1   318     CopyRB: MOV     A, @R0
019D F0         =1   319             MOVX    @DPTR, A
A51 MACRO ASSEMBLER  LCP                                                                    25/07/99 18:37:13 PAGE     6

019E 1582       =1   320             DEC     DPL
01A0 18         =1   321             DEC     R0
01A1 D540F8     =1   322             DJNZ    Temp, CopyRB
01A4 E6         =1   323             MOV     A, @R0                  ; Get real byte count
01A5            =1   324     SendEP0InBuffer:
01A5 907FB5     =1   325             MOV     DPTR, #In0ByteCount
01A8            =1   326     StartXfer:
01A8 F0         =1   327             MOVX    @DPTR, A                ; This write initiates the transfer
01A9            =1   328     HandShake:                              ; Handshake with host
01A9 754002     =1   329             MOV     Temp, #00000010b        ; Set HSNAK to tell the SIE that we're done
01AC            =1   330     SetEP0Control:
01AC 907FB4     =1   331             MOV     DPTR, #EP0Control
01AF E0         =1   332             MOVX    A, @DPTR
01B0 4540       =1   333             ORL     A, Temp
01B2 F0         =1   334             MOVX    @DPTR, A
01B3 22         =1   335             RET
01B4            =1   336     LoadSUDPTR:                             ; Send the data pointed to by DPTR
01B4 858240     =1   337             MOV     Temp, DPL
01B7 E583       =1   338             MOV     A, DPH
01B9 907FD4     =1   339             MOV     DPTR, #SUDPTR
01BC F0         =1   340             MOVX    @DPTR, A
01BD E540       =1   341             MOV     A, Temp
01BF A3         =1   342             INC     DPTR
01C0 80E6       =1   343             JMP     StartXfer
01C2            =1   344     BadRequest:                             ; Invalid Request was received
01C2 754003     =1   345             MOV     Temp, #00000011b        ; Set EP0STALL and HSNAK
01C5 80E5       =1   346             JMP     SetEP0Control
                =1   347     
01C7            =1   348     NextDPTR:                               ; Returns (DPTR + byte DPTR is pointing to)
01C7 E0         =1   349             MOVX    A, @DPTR
01C8            =1   350     BumpDPTR:                               ; Returns (DPTR + ACC)
01C8 2582       =1   351             ADD     A, DPL
01CA F582       =1   352             MOV     DPL, A
01CC 5002       =1   353             JNC     Skip
01CE 0583       =1   354             INC     DPH                     ; Need 16 bit arithmetic here
01D0 22         =1   355     Skip:   RET
                =1   356     
01D1            =1   357     CorrectSubroutine:                      ; Jump to the subroutine that DPTR is pointing to
01D1 9001F6     =1   358             MOV     DPTR, #CommandTable
01D4 31C8       =1   359             CALL    BumpDPTR                ; Point to entry
01D6 E0         =1   360             MOVX    A, @DPTR                ; Get the offset
01D7 9001F6     =1   361             MOV     DPTR, #CommandTable
01DA 31C8       =1   362             CALL    BumpDPTR                ; Get the routine address
01DC C082       =1   363             PUSH    DPL                     ; Create a RETURN address on stack
01DE C083       =1   364             PUSH    DPH                     ; Note: JMP @A+DPTR not used since A, DPTR needed
01E0 7845       =1   365             MOV     R0, #ReplyBuffer+2
01E2 E4         =1   366             CLR     A
01E3 F6         =1   367             MOV     @R0, A                  ; Clear ReplyBuffer
01E4 18         =1   368             DEC     R0
01E5 F6         =1   369             MOV     @R0, A
01E6 18         =1   370             DEC     R0
01E7 7601       =1   371             MOV     @R0, #1                 ; Default non-descriptor reply
01E9 907FEA     =1   372             MOV     DPTR, #SETUPDAT+2       ; Point to LOW(wValue)
01EC E0         =1   373             MOVX    A, @DPTR                ; Many of the routines need these
01ED F5F0       =1   374             MOV     B, A                    ; LOW(wValue) in B
01EF A3         =1   375             INC     DPTR
01F0 E0         =1   376             MOVX    A, @DPTR                ; HIGH(wValue) in A

⌨️ 快捷键说明

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