📄 bwmeter.lst
字号:
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
0166 0530 719 inc ppf ; bump the packets-per-frame count
016E 22 724 ret ; back to loop
725 ; -----------------------------------------------------------------------------------------
------
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
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
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 ; -----------------------------------------------------------------------------------------
A51 MACRO ASSEMBLER BWMETER 06/05/2002 14:07:37 PAGE 12
------
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
0192 8008 756 sjmp gs1
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
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 7400 807 mov a,#00h ; fill first buffer with 0's
01D6 90FC00 808 mov dptr,#EP8FIFOBUF
01D9 513A 809 call fill_EP68_IN
822 ;
01ED 7401 823 mov a,#01h ; fill second buffer with 1's
01EF 90FC00 824 mov dptr,#EP8FIFOBUF
01F2 513A 825 call fill_EP68_IN
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
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
A51 MACRO ASSEMBLER BWMETER 06/05/2002 14:07:37 PAGE 13
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 ;
025D 22 901 ret
902 ;
026E 22 915 ret
916 ;-----------
026F 917 display_hex:
918 ;-----------
919 ; Call with blankflag=0 to display digit in 'displaydigit', =1 to blank the display.
920 ;
026F 5199 921 call stop_check ; make sure the last operation is not in progress
0271 90E678 922 mov dptr,#I2CS ; set the START bit
0274 7480 923 mov a,#80h ; b7=start bit
0276 F0 924 movx @dptr,a
925 ;
0277 90E679 926 mov dptr,#I2DAT ; first data byte is address+direc
027A 7442 927 mov a,#42h ; IO expander address, bit b0=0 means write
027C F0 928 movx @dptr,a
027D 51A1 929 call wait_done ; wait for i2c transmit complete
930 ;
027F 300204 931 jnb blankflag,show
0282 74FF 932 mov a,#0FFh ; all off
0284 8006 933 sjmp dh2
0286 900080 934 show: mov dptr,#digit_table
0289 E532 935 mov a,displaydigit
028B 93 936 movc a,@a+dptr
028C 90E679 937 dh2: mov dptr,#I2DAT ; write the data byte
028F F0 938 movx @dptr,a
0290 51A1 939 call wait_done
940 ;
0292 90E678 941 mov dptr,#I2CS ; set the STOP bit
0295 7440 942 mov a,#01000000b
0297 F0 943 movx @dptr,a
0298 22 944 ret
945 ;
0299 90E678 946 stop_check: mov dptr,#I2CS
029C E0 947 stck: movx a,@dptr
029D 20E6FC 948 jb acc.6,stck
02A0 22 949 ret
950 ;
02A1 90E678 951 wait_done: mov dptr,#I2CS ; select DPTR1
02A4 E0 952 cd1: movx a,@dptr
02A5 30E0FC 953 jnb acc.0,cd1
02A8 22 954 ret
955 END
A51 MACRO ASSEMBLER BWMETER 06/05/2002 14:07:37 PAGE 14
SYMBOL TABLE LISTING
------ ----- -------
N A M E T Y P E V A L U E ATTRIBUTES
AC . . . . . . . . . . . B ADDR 00D0H.6 A
ACC. . . . . . . . . . . D ADDR 00E0H A
APTR1FZ. . . . . . . . . B ADDR 00B0H.0 A
APTR2FZ. . . . . . . . . B ADDR 00B0H.1 A
ARM_EP24 . . . . . . . . C ADDR 0245H A
AUTODAT1 . . . . . . . . D ADDR 009CH A
AUTODAT2 . . . . . . . . D ADDR 009FH A
AUTOPTRH1. . . . . . . . D ADDR 009AH A
AUTOPTRH2. . . . . . . . D ADDR 009DH A
AUTOPTRL1. . . . . . . . D ADDR 009BH A
AUTOPTRL2. . . . . . . . D ADDR 009EH A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -