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

📄 bal.lst

📁 u-boot for Linux platform. you can test it
💻 LST
📖 第 1 页 / 共 5 页
字号:
12A6 E0         =1   362     CopySD: MOVX    A, @DPTR
12A7 F6         =1   363             MOV     @R0, A
12A8 A3         =1   364             INC     DPTR
12A9 08         =1   365             INC     R0
12AA DFFA       =1   366             DJNZ    R7, CopySD
12AC 1213A6     =1   367             CALL    ServiceSetupPacket      ; Handle the decode of the Setup packet
                =1   368     ; if SetAddress { Update SIE address }  // NOP on EZ-USB
                =1   369     ; if STALL { Stall the endpoint }
                =1   370     ; if SendData {
                =1   371     ;       if IsDescriptor { send DPTR->descriptor, A = length }
                =1   372     ;       else { send ReplyBuffer }
                =1   373     ;       }                   
12AF 200127     =1   374             JB      STALL, SendSTALL
12B2 300216     =1   375             JNB     SendData, HandShake
12B5 200325     =1   376             JB      IsDescriptor, LoadEP0
                =1   377                                             ; Send data in ReplyBuffer
12B8 907F01     =1   378             MOV     DPTR, #EP0InBuffer+1
12BB 7842       =1   379             MOV     R0, #ReplyBuffer+1
12BD 7F02       =1   380             MOV     R7, #2                  ; Copy the two byte buffer
12BF E6         =1   381     CopyRB: MOV     A, @R0
12C0 F0         =1   382             MOVX    @DPTR, A
12C1 1582       =1   383             DEC     DPL
12C3 18         =1   384             DEC     R0
12C4 DFF9       =1   385             DJNZ    R7, CopyRB
12C6 E6         =1   386             MOV     A, @R0                  ; Get BufferCount
12C7            =1   387     SendEP0InBuffer:
12C7 907FB5     =1   388             MOV     DPTR, #In0ByteCount
A51 MACRO ASSEMBLER  BAL                                                                    30/05/00 10:40:54 PAGE     7

12CA            =1   389     StartXfer:
12CA F0         =1   390             MOVX    @DPTR, A                ; This write initiates the transfer
12CB            =1   391     HandShake:                              ; Handshake with host
12CB 7F02       =1   392             MOV     R7, #00000010b          ; Set HSNAK to tell the SIE that we're done
12CD            =1   393     SetEP0Control:
12CD 907FB4     =1   394             MOV     DPTR, #EP0Control
12D0 E0         =1   395             MOVX    A, @DPTR
12D1 4F         =1   396             ORL     A, R7
12D2 F0         =1   397             MOVX    @DPTR, A                ; We're done
12D3 5130       =1   398             CALL    ClearINT2
12D5 7401       =1   399             MOV     A, #00000001b           ; Clear the source of the interrupt
12D7 80BE       =1   400             JMP     ExitISR
12D9            =1   401     SendSTALL:                              ; Invalid Request was received
12D9 7F03       =1   402             MOV     R7, #00000011b          ; Set EP0STALL and HSNAK
12DB 80F0       =1   403             JMP     SetEP0Control
12DD            =1   404     LoadEP0:                                ; Send the data pointed to by DPTR
12DD FF         =1   405             MOV     R7, A                   ; Save LENGTH
                =1   406     ; Need to return the smaller of "Requested Length" and "Actual Length"
                =1   407     ; If "Requested Length" > 255 then use "Actual Length"
                =1   408     ; There are no descriptors > 255 in this example
12DE E54E       =1   409             MOV     A, wLengthHigh
12E0 7007       =1   410             JNZ     UseActual       
12E2 C3         =1   411             CLR     C
12E3 954D       =1   412             SUBB    A, wLengthLow
12E5 E54D       =1   413             MOV     A, wLengthLow           ; This does not affect Carry
12E7 5001       =1   414             JNC     UsewLengthLow
12E9            =1   415     UseActual:
12E9 EF         =1   416             MOV     A, R7
12EA            =1   417     UsewLengthLow:
12EA            =1   418     SendNextPieceOfDescriptor:              ; DPTR -> Descriptor to be sent
12EA FF         =1   419             MOV     R7, A                   ; Save LENGTH again
12EB 754600     =1   420             MOV     SaveLength, #0          ; Default case, overwrite if necessary
                =1   421     ; Do I have more than a single packet to send?
12EE C3         =1   422             CLR     C
12EF 9440       =1   423             SUBB    A, #EP0Size
12F1 4016       =1   424             JC      SendPacket
                =1   425     ; Need to send multiple packets. 
                =1   426     ; Calculate and save address of next packet, send next packet now
12F3 F546       =1   427             MOV     SaveLength, A           ; Send these next time
12F5 7F40       =1   428             MOV     R7, #EP0Size
12F7 C083       =1   429             PUSH    DPH                     ; Save current pointer
12F9 C082       =1   430             PUSH    DPL
12FB EF         =1   431             MOV     A, R7                   ; Retreive length
12FC 1213EA     =1   432             CALL    BumpDPTR
12FF 858344     =1   433             MOV     SaveDPH, DPH
1302 858245     =1   434             MOV     SaveDPL, DPL
1305 D082       =1   435             POP     DPL
1307 D083       =1   436             POP     DPH
1309            =1   437     SendPacket:
1309 EF         =1   438             MOV     A, R7                   ; Retreive length 
130A FE         =1   439             MOV     R6, A                   ; Save length in R6 for move
130B 7800       =1   440             MOV     R0, #LOW(EP0InBuffer)   ; PageReg = 7FH = HIGH(EP0InBuffer)
130D E0         =1   441     CopySTD:MOVX    A, @DPTR
130E F2         =1   442             MOVX    @R0, A
130F A3         =1   443             INC     DPTR
1310 08         =1   444             INC     R0
1311 DEFA       =1   445             DJNZ    R6, CopySTD
1313 EF         =1   446             MOV     A, R7                   ; Retrieve LENGTH
1314 80B1       =1   447             JMP     SendEP0InBuffer
                =1   448     
1316            =1   449     GetOutputReport:                        ; Wait for this, it's next on USB
1316 907FC5     =1   450             MOV     DPTR, #Out0ByteCount    ; Enable EP0OutBuffer to receive data
1319 F0         =1   451             MOVX    @DPTR, A                ; Any value will do
131A 907FB4     =1   452             MOV     DPTR, #EP0Control       ; Wait for valid data in EP0OutBuffer
131D E0         =1   453     Wait40: MOVX    A, @DPTR
131E 5408       =1   454             ANL     A, #00001000b           ; Check OUTBSY
A51 MACRO ASSEMBLER  BAL                                                                    30/05/00 10:40:54 PAGE     8

1320 70FB       =1   455             JNZ     Wait40
1322 22         =1   456             RET
                =1   457     
                =1   458     
                =1   459     
                     460     $INCLUDE(EZMain.A51)
                =1   461     ; This module initializes the microcontroller then executes MAIN forever
                =1   462     ; It is hardware dependant
                =1   463     
1323            =1   464     Reset:
1323 7581DF     =1   465             MOV     SP, #0DFH               ; Initialize the Stack
1326 75927F     =1   466             MOV     PageReg, #7FH           ; Allows MOVX Ri to access EZ-USB memory
                =1   467     
1329 78D6       =1   468             MOV     R0, #Low(USBControl)    ; Simulate a disconnect
132B E2         =1   469             MOVX    A, @R0
132C 54F3       =1   470             ANL     A, #11110011b           ; Clear DISCON, DISCOE
132E F2         =1   471             MOVX    @R0, A
132F 121370     =1   472             CALL    Wait100msec             ; Give the host time to react
                =1   473     
                =1   474     ;*Jan's code start
                =1   475     ;Use this 10 second delay if you want to run USBCheck. Attach the device,
                =1   476     ;then you have about 10 seconds to run USBCheck before the renumeration
                =1   477     ;simulates a reattach.
                =1   478     ;       CALL    Wait10Seconds           ; Allow time for USBCheck
                =1   479     ;*Jan's code end
                =1   480     
1332 E2         =1   481             MOVX    A, @R0                  ; Reconnect with this new identity
1333 4406       =1   482             ORL     A, #00000110b           ; Set DISCOE to enable pullup resistor
1335 F2         =1   483             MOVX    @R0, A                  ; Set RENUM so that 8051 handles USB requests
1336 E4         =1   484             CLR     A
1337 F520       =1   485             MOV     FLAGS, A                ; Start in Default state
1339            =1   486     TurnOffLEDs:
1339 F551       =1   487             MOV     LEDValue, A
133B F54F       =1   488             MOV     Old_Buttons, A
133D 04         =1   489             INC     A                       ; = 1
133E F550       =1   490             MOV     LEDstrobe, A
1340            =1   491     Initialize4msecCounter:
1340 F552       =1   492             MOV     Msec_counter, A
1342            =1   493     InitializeIOSystem:                     ; Setup for Simmbus A=input, B=output
                =1   494                                             ; C=External RD#,WR#,TD0,TR0
1342 7893       =1   495             MOV     R0, #LOW(PortA_Config)  ; PageReg = 7F = HIGH(PortA_Config)
1344 799C       =1   496             MOV     R1, #LOW(PortA_OE)
1346 E4         =1   497             CLR     A
1347 F2         =1   498             MOVX    @R0, A                  ; No alternate functions
1348 F3         =1   499             MOVX    @R1, A                  ; Enable PortA for Input
1349 08         =1   500             INC     R0                      ; Point to PortB_Config
134A 09         =1   501             INC     R1                      ; Point to PortB_OE
134B F2         =1   502             MOVX    @R0, A                  ; No alternate functions
134C F4         =1   503             CPL     A                       ; = 0FFH
134D F3         =1   504             MOVX    @R1, A                  ; Enable PortB for Output
134E 08         =1   505             INC     R0                      ; Point to PortC_Config
134F 09         =1   506             INC     R1                      ; Point to PortC_OE
1350 74C3       =1   507             MOV     A, #11000011b           ; 
1352 F2         =1   508             MOVX    @R0, A                  ; Alternate functions on [7,6,1,0]
1353 74C2       =1   509             MOV     A, #11000010b
1355 F3         =1   510             MOVX    @R1, A                  ; Most alternate functions are outputs
1356            =1   511     InitializeInterruptSystem:              ; First initialize the USB level 
1356 7401       =1   512             MOV     A, #00000001b
1358 78AC       =1   513             MOV     R0, #LOW(IN07IEN)
135A F2         =1   514             MOVX    @R0, A                  ; Enable interrupts from EP0IN only
135B 08         =1   515             INC     R0
                =1   516     
                =1   517     ;*Jan's code start
                =1   518     ;*The original code used CLR A instead of the MOV instruction
                =1   519     ;       CLR     A
135C 7405       =1   520             MOV     A, #00000101b
A51 MACRO ASSEMBLER  BAL                                                                    30/05/00 10:40:54 PAGE     9

135E F2         =1   521             MOVX    @R0, A                  ; Disable interrupts from OUT Endpoints 1, 3-7
                =1   522     ;*Jan's code end
                =1   523     
135F 08         =1   524             INC     R0
1360 7403       =1   525             MOV     A, #00000011b
1362 F2         =1   526             MOVX    @R0, A                  ; Enable (Resume, Suspend,) SOF and SUDAV INTs
1363 08         =1   527             INC     R0
1364 7401       =1   528             MOV     A, #00000001b
1366 F2         =1   529             MOVX    @R0, A                  ; Enable Auto Vectoring for USB interrupts
                =1   530                                             ; Now enable the main level
1367 75E801     =1   531             MOV     EIE, #00000001b         ; Enable INT2 = USB Interrupt (only)            
136A 75A890     =1   532             MOV     EI, #10010000b          ; Enable interrupt subsystem (and Ser0 for dScope)
                =1   533      
                =1   534     ; Initialization Complete.
                =1   535     ; 
136D            =1   536     MAIN:
136D 00         =1   537             NOP                             ; Not much of a main loop for this example
136E 80FD       =1   538             JMP     MAIN                    ; All actions are initiated by interrupts
                =1   539     ; We are a slave, we wait to be told what to do
                =1   540     
1370            =1   541     Wait100msec:
1370 7F64       =1   542             MOV     R7, #100
1372            =1   543     Wait1msec:                              ; A delay loop
1372 758600     =1   544             MOV     DPS, #0                 ; Select primary DPTR
1375 90FB50     =1   545             MOV     DPTR, #-1200            

⌨️ 快捷键说明

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