sdk56634.asm (4782B)
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 ; This is the default program for the (49+4 port) BCM56634 SDKs. 10 ; To start it, use the following commands from BCM: 11 ; 12 ; led load sdk56634.hex 13 ; led auto on 14 ; led start 15 ; 16 ; The is 1 LEDs per XE port. 17 ; 18 ; There is one bit per 10 gigabit Ethernet LED with the following colors: 19 ; ONE Black 20 ; ZERO Green 21 ; 22 ; Each chip drives only its own LEDs and needs to write them in the order: 23 ; A01/L01, A02/L02, ..., A04/L04 24 ; 25 ; Link up/down info cannot be derived from LINKEN or LINKUP, as the LED 26 ; processor does not always have access to link status. This program 27 ; assumes link status is kept current in bit 0 of RAM byte (0xA0 + portnum). 28 ; Generally, a program running on the main CPU must update these 29 ; locations on link change; see linkscan callback in 30 ; $SDK/src/appl/diag/ledproc.c. 31 ; 32 ; Current implementation: 33 ; 34 ; L01/A01 reflects port 1 link/activity status: 35 ; Black: no link 36 ; Green: Link 37 ; Black: no link 38 ; Green: Activity 39 ; 40 ; 41 NUM_PORT EQU 4 42 43 ; Device ports 44 ; 26 hg0 45 ; 27 hg1 46 ; 28 hg2 47 ; 29 hg3 48 49 PORT_HG0 EQU 26 50 PORT_HG1 EQU 27 51 PORT_HG2 EQU 28 52 PORT_HG3 EQU 29 53 54 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS 55 ; so they will be more visible. 56 TICKS EQU 1 57 SECOND_TICKS EQU (30*TICKS) 58 ACT_EXT_TICKS EQU (SECOND_TICKS/3) 59 TXRX_ALT_TICKS EQU (SECOND_TICKS/6) 60 61 ; 62 ; Main Update Routine 63 ; 64 ; This routine is called once per tick. 65 ; 66 update: 67 ld a, PORT_HG0 68 port a 69 call link_activity ; Off if no link 70 71 ld a, PORT_HG1 72 port a 73 call link_activity ; Off if no link 74 75 ld a, PORT_HG2 76 port a 77 call link_activity ; Off if no link 78 79 ld a, PORT_HG3 80 port a 81 call link_activity ; Off if no link 82 83 inc (TXRX_ALT_COUNT) 84 85 send NUM_PORT * 2 86 87 ; 88 ; link_activity 89 ; 90 ; This routine calculates the activity LED for the current port. 91 ; It extends the activity lights using timers (new activity overrides 92 ; and resets the timers). 93 ; 94 ; Inputs: (PORT_NUM) 95 ; Outputs: one bit sent to LED stream 96 ; 97 98 link_activity: 99 ;jmp led_green ;DEBUG ONLY 100 call get_link 101 jnc link_led_black 102 call led_green 103 jmp chk_activity 104 link_led_black: 105 call led_black 106 jmp led_black 107 chk_activity: 108 port a 109 pushst RX 110 pushst TX 111 tor 112 pop 113 114 jnc led_black ; Always black, No Activity 115 116 ;jmp led_green ;DEBUG ONLY 117 118 ld b, (TXRX_ALT_COUNT) 119 and b, TXRX_ALT_TICKS 120 jnz led_green 121 jmp led_black 122 123 link_status: 124 ;jmp led_black ;DEBUG ONLY 125 call get_link 126 jnc led_black 127 jmp led_green 128 129 ; 130 ; get_link 131 ; 132 ; This routine finds the link status LED for a port. 133 ; Link info is in bit 0 of the byte read from PORTDATA[port] 134 ; 135 ; Inputs: Port number in a 136 ; Outputs: Carry flag set if link is up, clear if link is down. 137 ; Destroys: a, b 138 ; 139 140 get_link: 141 ld b,PORTDATA 142 add b,a 143 ld b,(b) 144 tst b,0 145 ret 146 147 ; 148 ; led_black, led_green 149 ; 150 ; Inputs: None 151 ; Outputs: one bit to the LED stream indicating color 152 ; Destroys: None 153 ; 154 155 led_black: 156 pushst ONE 157 pack 158 ret 159 160 led_green: 161 pushst ZERO 162 pack 163 ret 164 165 ; 166 ; Variables (SDK software initializes LED memory from 0xa0-0xff to 0) 167 ; 168 169 TXRX_ALT_COUNT equ 0xe0 170 PORT_NUM equ 0xe1 171 172 ; 173 ; Port data, which must be updated continually by main CPU's 174 ; linkscan task. See $SDK/src/appl/diag/ledproc.c for examples. 175 ; In this program, bit 0 is assumed to contain the link up/down status. 176 ; 177 178 ;Offset 0x1e00 - 0x80 179 ;LED scan chain assembly area 180 181 ;Offset 0x1e80 - 0xa0 182 PORTDATA equ 0xa0 ; Size 48 + 1 + 4 bytes 183 184 ; 185 ; Symbolic names for the bits of the port status fields 186 ; 187 188 RX equ 0x0 ; received packet 189 TX equ 0x1 ; transmitted packet 190 COLL equ 0x2 ; collision indicator 191 SPEED_C equ 0x3 ; 100 Mbps 192 SPEED_M equ 0x4 ; 1000 Mbps 193 DUPLEX equ 0x5 ; half/full duplex 194 FLOW equ 0x6 ; flow control capable 195 LINKUP equ 0x7 ; link down/up status 196 LINKEN equ 0x8 ; link disabled/enabled status 197 ZERO equ 0xE ; always 0 198 ONE equ 0xF ; always 1