openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

sdk5670.asm (2404B)


      1 ;
      2 ;
      3 ;
      4 ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5 ; 
      6 ; Copyright 2007-2019 Broadcom Inc. All rights reserved.
      7 ; 
      8 ;
      9 ; Disassembled and modified from Jim Battle's original code
     10 ; May 14, 2002
     11 ;
     12 ; This is the default program for the 5670 SDK.
     13 ; To start it, use the following commands from BCM:
     14 ;
     15 ;	led load sdk5670.hex
     16 ;	led auto on
     17 ;	led start
     18 ;
     19 ; The BCM5670 SDK has 10 columns of 4 LEDs each as shown below:
     20 ;
     21 ;       E1 E2   E3 E4   E5 E6   E7 E8   U1 U5
     22 ;       L1 L2   L3 L4   L5 L6   L7 L8   U2 U6
     23 ;       T1 T2   T3 T4   T5 T6   T7 T8   U3 U7
     24 ;       R1 R2   R3 R4   R5 R6   R7 R8   U4 U8
     25 ;
     26 ; There is one bit per LED with the following colors:
     27 ;
     28 ;	ZERO		Green
     29 ;	ONE		Black
     30 ;
     31 ; The bits are shifted out in the following order:
     32 ;	E3, L3, T3, R3, E4, L4, T4, R4,
     33 ;	E5, L5, T5, R5, E6, L6, T6, R6,
     34 ;	E7, L7, T7, R7, E8, L8, T8, R8,
     35 ;	E1, L1, T1, R1, E2, L2, T2, R2,
     36 ;	U1, U2, U3, U4, U5, U6, U7, U8
     37 ;
     38 ; Current implementation:
     39 ;
     40 ;	E1 reflects port 1 higig link enable
     41 ;	L1 reflects port 1 higig link up
     42 ;	T1 reflects port 1 higig transmit activity
     43 ;	R1 reflects port 1 higig receive activity
     44 ;
     45 ;	U1 through U8 are user-defined LEDs and
     46 ;	just display a chasing LED pattern.
     47 ;
     48 
     49 	ld	a,1		; Start with first column
     50 up1:
     51 	call	xlate_port	; Column to port number
     52 	port	b
     53 
     54 	pushst	LINKEN
     55 	tinv
     56 	pack
     57 	pushst	LINKUP
     58 	tinv
     59 	pack
     60 	pushst	TX
     61 	tinv
     62 	pack
     63 	pushst	RX
     64 	tinv
     65 	pack
     66 
     67 	inc	a		; Next column
     68 	cmp	a,9
     69 	jnz	up1
     70 
     71 ;
     72 ; Put out 8 more values to user LEDs.
     73 ; In this case it is a cycling pattern.
     74 ;
     75 
     76 	inc	(0x7f)
     77 	ld	a,(0x7f)
     78 	and	a,7
     79 	jnz	up2
     80 	inc	(0x7e)
     81 up2:
     82 
     83 	ld	b,(0x7e)
     84 	and	b,0x07
     85 	sub	a,a
     86 	stc
     87 	bit	a,b
     88 	ld	b,0x08
     89 up3:
     90 	ror	a
     91 	push	cy
     92 	tinv
     93 	pack
     94 	dec	b
     95 	jnz	up3
     96 
     97 	send	0x28
     98 
     99 ;
    100 ; Port translation to compensate for suboptimal board layout
    101 ;
    102 ;	A(in)	B(out)
    103 ;
    104 ;	1	3
    105 ;	2	4
    106 ;	3	5
    107 ;	4	6
    108 ;	5	7
    109 ;	6	8
    110 ;	7	1
    111 ;	8	2
    112 ;
    113 
    114 xlate_port:
    115 	ld	b,a
    116 	cmp	b,0x07
    117 	jnc	xp1
    118 	add	b,0x02
    119 	ret
    120 xp1:
    121 	sub	b,0x06
    122 	ret
    123 
    124 ;
    125 ; Symbolic names for the bits of the port status fields
    126 ;
    127 
    128 RX		equ	0x0	; received packet
    129 TX		equ	0x1	; transmitted packet
    130 COLL		equ	0x2	; collision indicator
    131 SPEED_C		equ	0x3	; 100 Mbps
    132 SPEED_M		equ	0x4	; 1000 Mbps
    133 DUPLEX		equ	0x5	; half/full duplex
    134 FLOW		equ	0x6	; flow control capable
    135 LINKUP		equ	0x7	; link down/up status
    136 LINKEN		equ	0x8	; link disabled/enabled status
    137 ZERO		equ	0xE	; always 0
    138 ONE		equ	0xF	; always 1