sdk5690.asm (7355B)
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 dual (24+2 port) BCM5690 SDKs. 10 ; It applies to both the back-to-back higig and the external 10gig boards. 11 ; To start it, use the following commands from BCM: 12 ; 13 ; led load sdk5690.hex 14 ; led auto on 15 ; led start 16 ; 17 ; The BCM5690 SDK has 14 columns of 4 LEDs each as shown below: 18 ; 19 ; Unit 0 Unit 1 Unit 0 Unit 1 20 ; ----------------------- ----------------------- ------ ------ 21 ; L01 L03 L05 L07 L09 L11 L01 L03 L05 L07 L09 L11 E13 E13 22 ; A01 A03 A05 A07 A09 A11 A01 A03 A05 A07 A09 A11 L13 L13 23 ; L02 L04 L06 L08 L10 L12 L02 L04 L06 L08 L10 L12 T13 T13 24 ; A02 A04 A06 A08 A10 A12 A02 A04 A06 A08 A10 A12 R13 R13 25 ; 26 ; There are 6 columns each for unit 0 and unit 1 gigabit ports. 27 ; There is an additional 1 column each for unit 0 and unit 1 higig ports. 28 ; 29 ; There are two bits per gigabit ethernet LED with the following colors: 30 ; ZERO, ZERO Black 31 ; ZERO, ONE Green 32 ; ONE, ZERO Amber 33 ; 34 ; There is one bit per higig LED with the following colors: 35 ; ZERO Black 36 ; ONE Amber 37 ; 38 ; Each chip drives only its own LEDs and needs to write them in the order: 39 ; A01, L01, ..., A12, L12, R13, T13, L13, E13 40 ; 41 ; Link up/down info cannot be derived from LINKEN or LINKUP, as the LED 42 ; processor does not always have access to link status. This program 43 ; assumes link status is kept current in bit 0 of RAM byte (0x80 + portnum). 44 ; Generally, a program running on the main CPU must update these 45 ; locations on link change; see linkscan callback in 46 ; $SDK/src/appl/diag/ledproc.c. 47 ; On the higig ports, LINKEN and LINKUP are used. 48 ; 49 ; Current implementation: 50 ; 51 ; L01 reflects port 1 link status: 52 ; Black: no link 53 ; Amber: 10 Mb/s 54 ; Green: 100 Mb/s 55 ; Alternating green/amber: 1000 Mb/s 56 ; Very brief flashes of black at 1 Hz: half duplex 57 ; Longer periods of black: collisions in progress 58 ; 59 ; A01 reflects port 1 activity (even if port is down) 60 ; Black: idle 61 ; Green: RX (pulse extended to 1/3 sec) 62 ; Amber: TX (pulse extended to 1/3 sec, takes precedence over RX) 63 ; Green/Amber alternating at 6 Hz: both RX and TX 64 ; 65 ; E13 reflects higig link enable 66 ; L13 reflects higig link up 67 ; T13 reflects higig transmit activity 68 ; R13 reflects higig receive activity 69 ; 70 ; Note: 71 ; To provide consistent behavior, the gigabit LED patterns match 72 ; those in sdk5605.asm and the higig LEDs match those in sdk5670.asm. 73 ; 74 75 TICKS EQU 1 76 SECOND_TICKS EQU (30*TICKS) 77 78 MIN_GE_PORT EQU 0 79 MAX_GE_PORT EQU 11 80 NUM_GE_PORT EQU 12 81 82 MIN_HG_PORT EQU 12 83 MAX_HG_PORT EQU 12 84 NUM_HG_PORT EQU 1 85 86 MIN_PORT EQU 0 87 MAX_PORT EQU 12 88 NUM_PORT EQU 13 89 90 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS 91 ; so they will be more visible. 92 93 ACT_EXT_TICKS EQU (SECOND_TICKS/3) 94 GIG_ALT_TICKS EQU (SECOND_TICKS/2) 95 HD_OFF_TICKS EQU (SECOND_TICKS/20) 96 HD_ON_TICKS EQU (SECOND_TICKS-HD_ON_TICKS) 97 TXRX_ALT_TICKS EQU (SECOND_TICKS/6) 98 99 ; 100 ; Main Update Routine 101 ; 102 ; This routine is called once per tick. 103 ; 104 105 update: 106 sub a,a ; ld a,MIN_GE_PORT (but only one instr) 107 108 up1: 109 port a 110 ld (PORT_NUM),a 111 112 call activity ; Upper LED for this port 113 call link_status ; Lower LED for this port 114 115 ld a,(PORT_NUM) 116 inc a 117 cmp a,NUM_GE_PORT 118 jnz up1 119 120 ; Put out 8 bits for higig port 121 122 port a ; 12 123 ld (PORT_NUM),a 124 125 pushst RX 126 tinv 127 pack 128 pushst TX 129 tinv 130 pack 131 pushst LINKUP 132 tinv 133 pack 134 pushst LINKEN ; For now, copy values directly to LEDs 135 tinv 136 pack 137 138 pushst ONE ; There are 4 more unused bits in the chain 139 pack 140 pushst ONE 141 pack 142 pushst ONE 143 pack 144 pushst ONE 145 pack 146 147 ; Update various timers 148 149 ld b,GIG_ALT_COUNT 150 inc (b) 151 ld a,(b) 152 cmp a,GIG_ALT_TICKS 153 jc up2 154 ld (b),0 155 up2: 156 157 ld b,HD_COUNT 158 inc (b) 159 ld a,(b) 160 cmp a,HD_ON_TICKS+HD_OFF_TICKS 161 jc up3 162 ld (b),0 163 up3: 164 165 ld b,TXRX_ALT_COUNT 166 inc (b) 167 ld a,(b) 168 cmp a,TXRX_ALT_TICKS 169 jc up4 170 ld (b),0 171 up4: 172 173 send 56 174 175 ; 176 ; activity 177 ; 178 ; This routine calculates the activity LED for the current port. 179 ; It extends the activity lights using timers (new activity overrides 180 ; and resets the timers). 181 ; 182 ; Inputs: (PORT_NUM) 183 ; Outputs: Two bits sent to LED stream 184 ; 185 186 activity: 187 pushst RX 188 pop 189 jnc act1 190 191 ld b,RX_TIMERS ; Start RX LED extension timer 192 add b,(PORT_NUM) 193 ld a,ACT_EXT_TICKS 194 ld (b),a 195 196 act1: 197 pushst TX 198 pop 199 jnc act2 200 201 ld b,TX_TIMERS ; Start TX LED extension timer 202 add b,(PORT_NUM) 203 ld a,ACT_EXT_TICKS 204 ld (b),a 205 206 act2: 207 ld b,TX_TIMERS ; Check TX LED extension timer 208 add b,(PORT_NUM) 209 210 dec (b) 211 jnc act3 ; TX active? 212 inc (b) 213 214 ld b,RX_TIMERS ; Check RX LED extension timer 215 add b,(PORT_NUM) 216 217 dec (b) ; Extend LED green if only RX active 218 jnc led_green 219 inc (b) 220 221 jmp led_black ; No activity 222 223 act3: ; TX is active, see if RX also active 224 ld b,RX_TIMERS 225 add b,(PORT_NUM) 226 227 dec (b) ; RX also active? 228 jnc act4 229 inc (b) 230 231 jmp led_amber ; Only TX active 232 233 act4: ; Both TX and RX active 234 ld b,(TXRX_ALT_COUNT) 235 cmp b,TXRX_ALT_TICKS/2 236 jc led_amber ; Fast alternation of green/amber 237 jmp led_green 238 239 ; 240 ; link_status 241 ; 242 ; This routine calculates the link status LED for the current port. 243 ; 244 ; Inputs: (PORT_NUM) 245 ; Outputs: Two bits sent to LED stream 246 ; Destroys: a, b 247 ; 248 249 link_status: 250 pushst DUPLEX ; Skip blink code if full duplex 251 pop 252 jc ls1 253 254 pushst COLL ; Check for collision in half duplex 255 pop 256 jc led_black 257 258 ld a,(HD_COUNT) ; Provide blink for half duplex 259 cmp a,HD_OFF_TICKS 260 jc led_black 261 262 ls1: 263 ld a,(PORT_NUM) ; Check for link down 264 call get_link 265 jnc led_black 266 267 pushst SPEED_C ; Check for 100Mb speed 268 pop 269 jc led_green 270 271 pushst SPEED_M ; Check for 10Mb (i.e. not 100 or 1000) 272 pop 273 jnc led_amber 274 275 ld a,(GIG_ALT_COUNT) 276 cmp a,GIG_ALT_TICKS/2 277 jc led_amber 278 279 jmp led_green 280 281 ; 282 ; get_link 283 ; 284 ; This routine finds the link status LED for a port. 285 ; Link info is in bit 0 of the byte read from PORTDATA[port] 286 ; 287 ; Inputs: Port number in a 288 ; Outputs: Carry flag set if link is up, clear if link is down. 289 ; Destroys: a, b 290 ; 291 292 get_link: 293 ld b,PORTDATA 294 add b,a 295 ld b,(b) 296 tst b,0 297 ret 298 299 ; 300 ; led_black, led_amber, led_green 301 ; 302 ; Inputs: None 303 ; Outputs: Two bits to the LED stream indicating color 304 ; Destroys: None 305 ; 306 307 led_black: 308 pushst ZERO 309 pack 310 pushst ZERO 311 pack 312 ret 313 314 led_green: 315 pushst ZERO 316 pack 317 pushst ONE 318 pack 319 ret 320 321 led_amber: 322 pushst ONE 323 pack 324 pushst ZERO 325 pack 326 ret 327 328 ; 329 ; Variables (SDK software initializes LED memory from 0x80-0xff to 0) 330 ; 331 332 TXRX_ALT_COUNT equ 0xc0 333 HD_COUNT equ 0xc1 334 GIG_ALT_COUNT equ 0xc2 335 PORT_NUM equ 0xc3 336 337 ; 338 ; Port data, which must be updated continually by main CPU's 339 ; linkscan task. See $SDK/src/appl/diag/ledproc.c for examples. 340 ; In this program, bit 0 is assumed to contain the link up/down status. 341 ; 342 343 PORTDATA equ 0x80 ; Size 12 bytes 344 345 ; 346 ; LED extension timers 347 ; 348 349 RX_TIMERS equ 0xa0+0 ; NUM_PORT bytes 350 TX_TIMERS equ 0xa0+NUM_PORT ; NUM_PORT bytes 351 352 ; 353 ; Symbolic names for the bits of the port status fields 354 ; 355 356 RX equ 0x0 ; received packet 357 TX equ 0x1 ; transmitted packet 358 COLL equ 0x2 ; collision indicator 359 SPEED_C equ 0x3 ; 100 Mbps 360 SPEED_M equ 0x4 ; 1000 Mbps 361 DUPLEX equ 0x5 ; half/full duplex 362 FLOW equ 0x6 ; flow control capable 363 LINKUP equ 0x7 ; link down/up status 364 LINKEN equ 0x8 ; link disabled/enabled status 365 ZERO equ 0xE ; always 0 366 ONE equ 0xF ; always 1