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

📄 bwmeter.lst

📁 汇编语言写的ez-usb fx2 固件程序传输带宽480M/S
💻 LST
📖 第 1 页 / 共 5 页
字号:
                     679     ;
                     680     ; *** Load EP1-IN with 64 bytes of ppf history
                     681     ;
0133 7F40            682                     mov     r7,#64                  ; loop counter
0135 7834            683                     mov     r0,#PKTbuf              ; r0 points to 64-byte ppf history buffer
0137 90E7C0          684                     mov     dptr,#EP1INBUF          ; dptr points to destination (endpoint FIFO
                             )
013A E6              685     xfr:            mov     a,@r0                   ; get byte from PKTbuf
013B 08              686                     inc     r0                      ; bump source pointer
013C F0              687                     movx    @dptr,a                 ; store byte in EP1INBUF
013D A3              688                     inc     dptr                    ; bump dest pointer
013E DFFA            689                     djnz    r7,xfr                  ; do it 64 times
                     690     ;
0140 C202            691                     clr     blankflag               ; (don't blank the display in 'display_hex'
                              call)                
0142 853332          692                     mov     displaydigit,maxppf     ; display max packets per frame
0145 516F            693                     call    display_hex
0147 01BB            694                     jmp     mainloop                ; go again
                     695     ; -----------------------------------------------------------------------------------------
                             ------
                     696     ; An EP8 buffer is available. Update last byte in buffer, and dispatch another packet
                     697     ; -----------------------------------------------------------------------------------------
                             ------
0149 0531            698     Update_EP8:     inc     InCnt                   ; total number of IN packets
014B D204            699                     setb    F_gotPacket             ; tell SOF service routine we're in busines
                             s
                     700                     LDREG   EP8FIFOBUF+511,InCnt    ; put IN count into last buffer byte       
                                  
0153 0530            704                     inc     ppf                     ; bump the packets-per-frame count
                     705                     LDREG   EP8BCL,#0               ; re-arm (512 bytes)--NOTE: EP8BCH fixed at
                              2
015B 22              709                     ret                             ; back to loop
                     710     ; -----------------------------------------------------------------------------------------
                             ------
                     711     ; An EP6 buffer is available. Update last byte in buffer, and dispatch another packet
                     712     ; -----------------------------------------------------------------------------------------
                             ------
015C 0531            713     Update_EP6:     inc     InCnt                   ; total number of IN packets
015E D204            714                     setb    F_gotPacket             ; tell SOF service routine we're in busines
                             s
                     715                     LDREG   EP6FIFOBUF+511,InCnt    ; put IN count into last buffer byte       
                                  
0166 0530            719                     inc     ppf                     ; bump the packets-per-frame count
                     720                     LDREG   EP6BCL,#0               ; re-arm (512 bytes)--NOTE: EP6BCH fixed at
                              2
016E 22              724                     ret                             ; back to loop
                     725     ; -----------------------------------------------------------------------------------------
A51 MACRO ASSEMBLER  BWMETER                                                              07/21/2006 09:55:29 PAGE    12

                             ------
                     726     ; An EP4 buffer has data. Re-arm the endpoint (drop the data)
                     727     ; -----------------------------------------------------------------------------------------
                             ------
016F D204            728     Update_EP4:     setb    F_gotPacket     ; tell SOF service routine we're in business
0171 0530            729                     inc     ppf             ; bump the packets-per-frame count
                     730                     LDREG   EP4BCL,#80h     ; re-arm the endpoint (skip bit set)
0179 22              734                     ret                     ; back to loop
                     735     ; -----------------------------------------------------------------------------------------
                             ------
                     736     ; An EP2 buffer has data. Re-arm the endpoint (drop the data)
                     737     ; -----------------------------------------------------------------------------------------
                             ------
017A D204            738     Update_EP2:     setb    F_gotPacket     ; tell SOF service routine we're in business
017C 0530            739                     inc     ppf             ; bump the packets-per-frame count
                     740                     LDREG   EP2BCL,#80h     ; re-arm the endpoint (skip bit set)
0184 22              744                     ret                     ; back to loop
                     745     ; -----------------------------------------------------------------------------------------
                             ------
                     746     ; Got an SOF. Toggle lights, store ppf in buffer, clear ppf, update max. Uses AUTOPTR1 -> P
                             KTbuf
                     747     ; -----------------------------------------------------------------------------------------
                             ------
0185 B201            748     got_SOF:        cpl     F_LEDtog        ; *** Toggle the middle lights to indicate we're ru
                             nning
0187 30010A          749                     jnb     F_LEDtog,gs0
                     750                     L2_OFF
                     753                     L3_ON
0192 8008            756                     sjmp    gs1
0194                 757     gs0:            L2_ON
                     760                     L3_OFF
019C 300419          763     gs1:            jnb     F_gotPacket,gs3 ; no INS or OUTS yet...bail out
019F 200016          764     gs2:            jb      PKTbuf_full,gs3 ; 64-byte ppf-history buffer is full...bail out
01A2 A630            765                     mov     @r0,ppf         ; not full--stash another ppf value,    
01A4 08              766                     inc     r0              ; and bump the pointer
                     767     ;
01A5 E533            768                     mov     a,maxppf        ; *** update maxppf
01A7 B53000          769                     cjne    a,ppf,$+3       ; just to set the cy bit
01AA 5003            770                     jnc     notbigger       ; maxppf-ppf: cy=1 if maxppf < ppf
01AC 853033          771                     mov     maxppf,ppf      ; found a higer one, update maxppf
01AF 753000          772     notbigger:      mov     ppf,#0          ; reset packet count
                     773     ;
01B2 E8              774                     mov     a,r0            ; *** check for full PKTbuf (64 byte limit)
01B3 B47402          775                     cjne    a,#PKTbuf+64,gs3
01B6 D200            776                     setb    PKTbuf_full     ; set the 'full' (don't update any more) flag
01B8 22              777     gs3:            ret
                     778     ; -----------
                     779     ; Subroutines
                     780     ; -----------
                     781     ; Reset the endpoint FIFOSto the power-on state. (Busy bits, pointers, etc.)
                     782     ; This is done for repeated code load/debug cycles. Need to restore the part to the
                     783     ; power-on state so logic that was set during last debug session does not carry over
                     784     ; into the next debug session.
                     785     ;
01B9 90E604          786     reset_FIFOS:    mov     dptr,#FIFORESET 
01BC 7480            787                     mov     a,#80h  
01BE F0              788                     movx    @dptr,a         ; first set this bit to NAK any traffic
01BF 7402            789                     mov     a,#02h          ; then clear individual FIFOS
01C1 00              790                     nop                     ; Syncronization delay (TRM Sec 15.14)
01C2 F0              791                     movx    @dptr,a         ; EP2
01C3 7404            792                     mov     a,#04h
01C5 00              793                     nop
01C6 F0              794                     movx    @dptr,a         ; EP4
01C7 7406            795                     mov     a,#06h
01C9 00              796                     nop
01CA F0              797                     movx    @dptr,a         ; EP6
A51 MACRO ASSEMBLER  BWMETER                                                              07/21/2006 09:55:29 PAGE    13

01CB 7408            798                     mov     a,#08h
01CD 00              799                     nop
01CE F0              800                     movx    @dptr,a         ; EP8
01CF 7400            801                     mov     a,#0
01D1 00              802                     nop
01D2 F0              803                     movx    @dptr,a         ; clear the NAK bit
01D3 22              804                     ret
                     805     ;
01D4                 806     fill_and_arm_EP8_buffers:
01D4 7411            807                     mov     a,#011h         ; fill first buffer with 0's
01D6 90FC00          808                     mov     dptr,#EP8FIFOBUF
01D9 513A            809                     call    fill_EP68_IN
                     810                     LDREG   EP8FIFOBUF+511,#1       ; mark packet #1
                     814                     LDREG   EP8BCH,#2       ; Arm EP8-IN: 200h is 512 bytes
                     818                     LDREG   EP8BCL,#0       ; arm it
                     822     ;
01ED 74FF            823                     mov     a,#0FFh         ; fill second buffer with 1's
01EF 90FC00          824                     mov     dptr,#EP8FIFOBUF
01F2 513A            825                     call    fill_EP68_IN
                     826                     LDREG   EP8FIFOBUF+511,#2       ; mark packet #2
                     830                     LDREG   EP8BCH,#2
                     834                     LDREG   EP8BCL,#0       ; arm it
0206 22              838                     ret
                     839     ;
0207                 840     fill_and_arm_EP6_buffers:
0207 74FE            841                     mov     a,#0FEh         ; fill first buffer with FE's
0209 90F800          842                     mov     dptr,#EP6FIFOBUF
020C 513A            843                     call    fill_EP68_IN
                     844                     LDREG   EP6FIFOBUF+511,#1       ; mark packet #1
                     848                     LDREG   EP6BCH,#2       ; Arm EP6-IN: 200h is 512 bytes
                     852                     LDREG   EP6BCL,#0       ; arm it
                     856     ;
0220 74FF            857                     mov     a,#0FFh         ; fill second buffer with 1's
0222 90F800          858                     mov     dptr,#EP6FIFOBUF
0225 513A            859                     call    fill_EP68_IN
                     860                     LDREG   EP6FIFOBUF+511,#2       ; mark packet #2
                     864                     LDREG   EP6BCH,#2
                     868                     LDREG   EP6BCL,#0       ; arm it
0239 22              872                     ret
                     873     ;
023A 7D00            874     fill_EP68_IN:   mov     r5,#0
023C 7E02            875                     mov     r6,#2           ; 2 times 256
023E F0              876     fill:           movx    @dptr,a         ; fill 512 byte buffer with value in a
023F A3              877                     inc     dptr
0240 DDFC            878                     djnz    r5,fill
0242 DEFA            879                     djnz    r6,fill
0244 22              880                     ret
                     881     ;
                     882     ; Arm the OUT endpoints (EP2 & EP4). Unlike EZ-USB, the FX2 OUT endpoints come up unarmed. 
                     883     ; We need to write the byte count twice to account for the double-buffering
                     884     ;
0245                 885     arm_EP24:       LDREG   EP2BCL,#80h     ; set the 'skip' bit (b7) so OUT packets not 
                     889                     LDREG   EP2BCL,#80h     ; transferred to ext interface which would hang the
                     893                     LDREG   EP4BCL,#80h     ; OUT transfers since there's nothing to re-arm

⌨️ 快捷键说明

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