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

📄 des3452_1.lst

📁 Led控制,这是一个不错的东东,希望对这方面的朋友有帮助
💻 LST
字号:
00:         ;                                                                          
00:         ;LED program for DES3428/DES3452                                                   
00:         ;                                                                          
00:         ;LED sequence:                                                             
00:         ;                                                                                                                                  
00:         ;Bit NO.	 0						    1	              2	                  3	         
00:         ;Function	 2G/7_SEG_LED	    2F/7_SEG_LED	  2E/7_SEG_LED	      2D/7_SEG_LE
00:         ;Bit NO.	 4						    5	              6	                  7 	       
00:         ;Function	 2C/7_SEG_LED	    2B/7_SEG_LED	  2A/7_SEG_LED	      1A/1B/7_SEG
00:         ;LED for SFP                                                                
00:         ;Bit NO.	 4						    5	              7	                8	       
00:         ;Function	 LNK/ACT1000_5	  LNK/ACT100_5	  LNK/ACT1000_4	    	LNK/ACT100_4
00:         ;LED for XE                                                               
00:         ;Bit NO.	 9						    10	            11	                12	       
00:         ;Function	 LNK/ACT1000_2	  LNK/ACT100_2	  LNK/ACT1000_1	    	LNK/ACT100_1
00:         ;LED for FE                                                                
00:         ;Bit NO.	 13						    14	            15	                16	       
00:         ;Function	 LNK/ACT100_29	  LNK/ACT10_29	  LNK/ACT100_28	    	LNK/ACT10_2
00:         ;...                                                                       
00:         ;Bit NO.	 3						    2	            1	              	0	       
00:         ;Function	 LNK/ACT100_7	  	LNK/ACT10_7	  	LNK/ACT100_6	    	LNK/ACT10_6
00:         
00:         ;Bit NO.	 0						    1	              2	                  3
00:         ;Function	 2G/7_SEG_LED	    2F/7_SEG_LED	  2E/7_SEG_LED	      2D/7_SEG_LE
00:         ;Bit NO.	 4						    5	              6	                  7 	       
00:         ;Function	 2C/7_SEG_LED	    2B/7_SEG_LED	  2A/7_SEG_LED	      1A/1B/7_SEG
00:         
00:         
00:         ; Symbolic names for the bits of the port status fields                
00:         ;                                                                      
00:         RX                 equ     0x0     ; received packet                   
00:         TX                 equ     0x1     ; transmitted packet                
00:         COLL               equ     0x2     ; collision indicator               
00:         SPEED_C            equ     0x3     ; 100 Mbps                          
00:         SPEED_M            equ     0x4     ; 1000 Mbps                         
00:         DUPLEX             equ     0x5     ; half/full duplex                  
00:         FLOW               equ     0x6     ; flow control capable              
00:         LINKUP             equ     0x7     ; link down/up status               
00:         LINKEN             equ     0x8     ; link disabled/enabled status      
00:         ZERO               equ     0xE     ; always 0                          
00:         ONE                equ     0xF     ; always 1  
00:         
00:         
00:         
00:         LED_FE_END         equ     48  ;12+24
00:         
00:         LED_SFP_C_END					equ			50
00:         LED_SFP_F_END         equ     52  ;8 + 2 + 2
00:         
00:         LED_XE_END	       equ     54  ;8 + 2
00:         
00:         LED_NULL_END       equ		 56
00:         LED_MG_END      	 equ     64
00:         LED_TOTAL_NUM      equ     64 
00:         LED_TOTAL_BITS     equ     120 
00:         
00:         ;
00:         LED_TIMER          equ     0xC0 ;led timer
00:         counter            equ     0xC1 ;led counter
00:         phyport            equ     0xC2 ;physical port number
00:         ;link_status        equ     0xC3 ;current port's link status
00:         
00:         ;per port's link status
00:         ;Host update LED_LINK according link state
00:         ;bit0-bit3: timer
00:         ;bit4: 0=linkdown, 1=linkup; bit5:medium; bit6:100M/1000M; bit7: 7 segment led
00:         ;one byte per port, total 28 bytes
00:         LED_LINK           equ    0xC4  ; total 58
00:         
00:         begin:
00:             ;initialize
00: 02 00       ld      A, 0
02: 60 C1       ld      (counter), A
04:         
04:         ledloop:
04:             ;Assign the first port
04: 12 00       ld      B, 0
06: 06 C1       ld  		A, (counter)
08: 67 95       call    getportmap
0A: 06 C2       ld      A, (phyport)
0C: 28          port    A
0D:         
0D: F2 C4       add     A, LED_LINK	  ; A = LED_LINK[phyport]
0F: 67 1B       call    led_link_status
11: 86 C1       inc     (counter)
13: 06 C1       ld      A, (counter)
15: D2 40       cmp     A, LED_TOTAL_NUM
17: 74 04       jnz     ledloop
19:         sendto:
19: 3A 78       send LED_TOTAL_BITS   
1B:         
1B:         ;assume the addrss of link status for phyport has been loaded into A, 
1B:         led_link_status:
1B: 16 C1       ld      B,(counter)
1D:         fe_port:
1D: DA 30       cmp     B, LED_FE_END
1F: 75 23       jnc     sfp_c_port
21: 77 4D   		jmp     check_link
23:         		
23:         sfp_c_port:
23: DA 32   		cmp     B, LED_SFP_C_END
25: 75 2D   		jnc     sfp_f_port
27: 4A 05   		tst     (A), 5
29: 71 75   		jc			LINK_DOWN
2B: 77 4D   		jmp     check_link		
2D:         sfp_f_port:
2D: DA 34   		cmp     B, LED_SFP_F_END
2F: 75 37   		jnc     xe_port
31: 4A 05   		tst			(A), 5
33: 75 75   		jnc    LINK_DOWN
35: 77 4D   		jmp     check_link		
37:         	
37:         
37:         xe_port:
37: DA 36   		cmp     B, LED_XE_END
39: 75 3D   		jnc     null_port
3B:         		;jnc     sfp_port
3B: 77 4D   		jmp     check_link
3D:         			
3D:         null_port:
3D: DA 38   		cmp     B, LED_NULL_END
3F: 75 43   		jnc     seven_seg
41: 77 80   		jmp			LED_OFF_TWOBIT
43:         					
43:         seven_seg:
43: DA 40       cmp     B, LED_MG_END  ; if (counter >= LED_SEG_END) jmp sfp_port
45: 75 C6       jnc     mg_end 
47: 4A 07       tst     (A), 7     
49: 71 7C       jc      LED_ON_ONEBIT
4B: 77 78       jmp     LED_OFF_ONEBIT
4D:         
4D:         check_link:
4D: 4A 04       tst    (A), 4
4F: 75 75       jnc    LINK_DOWN
51:             
51:                 
51:         traffic:
51: 32 00       pushst  RX
53: 32 01       pushst  TX
55: B7          tor
56: 97          pop     
57: 71 63       jc      LINK_BLINK 
59: 14          ld      B,(A)
5A: CA F0       and     B, 0xF0
5C: 41          ld	    (A), B    ;reset led timer
5D:         LINK_UP:
5D: 4A 06       tst     (A), 6
5F: 71 8E       jc      LED_ON_GREEN   
61: 77 87       jmp     LED_ON_AMBER
63:         
63:         ;(A): link status; B: counter
63:         LINK_BLINK:
63: 84          inc    (A)
64: 14          ld      B,(A)
65: CA 0F       and     B, 0x0F
67: DA 02       cmp     B,2
69: 71 75       jc      LINK_DOWN
6B: DA 03       cmp     B,3
6D: 71 5D       jc      LINK_UP
6F: 14          ld      B, (A)
70: CA F0       and     B, 0xF0
72: 41          ld      (A),B
73: 77 63       jmp     LINK_BLINK   
75:         
75:         LINK_DOWN:
75: 32 0F       pushst    ONE
77: 87          pack
78:         LED_OFF_ONEBIT:
78: 32 0F       pushst    ONE
7A: 87          pack
7B: 57          ret 
7C:         
7C:         LED_ON_ONEBIT:
7C: 32 0E       pushst    ZERO
7E: 87          pack
7F: 57          ret
80:         LED_OFF_TWOBIT:
80: 32 0F   		pushst    ONE
82: 87      		pack
83: 32 0F   		pushst    ONE
85: 87      		pack
86: 57      		ret
87:             
87:         LED_ON_AMBER:
87: 32 0F       pushst    ONE
89: 87          pack
8A: 32 0E       pushst    ZERO
8C: 87          pack
8D: 57          ret
8E:             
8E:         LED_ON_GREEN:
8E: 32 0E       pushst    ZERO
90: 87          pack
91: 32 0F       pushst    ONE
93: 87          pack
94: 57          ret
95:             
95:         ;get portmap, assume counter has been loaded into A
95:         getportmap:
95: D2 30      cmp A, LED_FE_END ; if (counter >= LED_SEG_END) jump sfp_portmap
97: 75 9F      jnc  sfp_c_portmap
99: 12 06      ld B,6
9B: F1         add A,B
9C: 60 C2      ld (phyport), A
9E: 57       	 ret
9F:         sfp_c_portmap:
9F: D2 32   	 cmp A, LED_SFP_C_END
A1: 75 A9   	 jnc sfp_f_portmap
A3: 12 2C   	 ld B, 44
A5: E1      	 sub A, B
A6: 60 C2   	 ld (phyport), A
A8: 57      	 ret 	 
A9:         sfp_f_portmap:
A9: D2 34   	 cmp A, LED_SFP_F_END
AB: 75 B3   	 jnc xe_portmap
AD: 12 2E   	 ld B, 46
AF: E1      	 sub A, B
B0: 60 C2   	 ld (phyport), A
B2: 57      	 ret
B3:         	  	 
B3:         xe_portmap:
B3: D2 36      cmp A, LED_XE_END ; if (counter >= LEDSFP_END) jump xe_portmap
B5: 75 BD      jnc mg_portmap
B7: 12 33      ld B, 51
B9: E1         sub A, B
BA: 60 C2      ld (phyport), A
BC: 57         ret
BD:          	    
BD:         ;sfp_portmap:
BD:         ;   cmp A,LED_SFP_END
BD:         ;   jnc mg_portmap
BD:         ;   ld B, 46
BD:         ;   sub A, B
BD:         ;   ld (phyport), A
BD:         ;   ret
BD:         	 
BD:         mg_portmap:
BD: D2 40      cmp A, LED_MG_END
BF: 75 C6      jnc mg_end
C1: 12 37   	 ld B, 55
C3: E1      	 sub A, B
C4: 60 C2   	 ld (phyport), A
C6:         mg_end:
C6: 57         ret
C7:            



----- symbol table, 49 symbols -----
          rx	0x0000
          tx	0x0001
        coll	0x0002
     speed_c	0x0003
     speed_m	0x0004
      duplex	0x0005
        flow	0x0006
      linkup	0x0007
      linken	0x0008
        zero	0x000E
         one	0x000F
  led_fe_end	0x0030
led_sfp_c_end	0x0032
led_sfp_f_end	0x0034
  led_xe_end	0x0036
led_null_end	0x0038
  led_mg_end	0x0040
led_total_num	0x0040
led_total_bits	0x0078
   led_timer	0x00C0
     counter	0x00C1
     phyport	0x00C2
    led_link	0x00C4
       begin	0x0000
     ledloop	0x0004
      sendto	0x0019
led_link_status	0x001B
     fe_port	0x001D
  sfp_c_port	0x0023
  sfp_f_port	0x002D
     xe_port	0x0037
   null_port	0x003D
   seven_seg	0x0043
  check_link	0x004D
     traffic	0x0051
     link_up	0x005D
  link_blink	0x0063
   link_down	0x0075
led_off_onebit	0x0078
led_on_onebit	0x007C
led_off_twobit	0x0080
led_on_amber	0x0087
led_on_green	0x008E
  getportmap	0x0095
sfp_c_portmap	0x009F
sfp_f_portmap	0x00A9
  xe_portmap	0x00B3
  mg_portmap	0x00BD
      mg_end	0x00C6

⌨️ 快捷键说明

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