sdk56680.asm (5882B)
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 (24+1+4 port) BCM56680K24TS 10 ; To start it, use the following commands from BCM: 11 ; 12 ; 0:led load sdk56680.hex 13 ; 0:led auto on 14 ; 0:led start 15 ; 16 ; The are 2 signle color LEDs per GE port. 17 ; 18 ; There is one bits per LED with the following colors: 19 ; ZERO Green 20 ; ONE Black 21 ; 22 ; Each chip drives only its own LEDs and needs to write them in the order: 23 ; L01, A01, L02, ..., L24, A24 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 reflects port 1 link status: 35 ; Black: no link 36 ; Green: link 37 ; 38 ; A01 reflects port 1 activity (even if port is down) 39 ; Black: idle 40 ; Green: RX/TX (pulse extended to 1/3 sec) 41 ; 42 43 44 NUM_PORT EQU 24 45 46 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS 47 ; so they will be more visible. 48 TICKS EQU 1 49 SECOND_TICKS EQU (30*TICKS) 50 ACT_EXT_TICKS EQU (SECOND_TICKS/3) 51 TXRX_ALT_TICKS EQU (SECOND_TICKS/6) 52 53 ; 54 ; Main Update Routine 55 ; 56 ; This routine is called once per tick. 57 ; 58 59 update: 60 ld a, 2 61 call link_status 62 call activity 63 64 ld a, 3 65 call link_status 66 call activity 67 68 ld a, 5 69 call link_status 70 call activity 71 72 ld a, 4 73 call link_status 74 call activity 75 76 ld a, 6 77 call link_status 78 call activity 79 80 ld a, 7 81 call link_status 82 call activity 83 84 ld a, 18 85 call link_status 86 call activity 87 88 ld a, 19 89 call link_status 90 call activity 91 92 ld a, 14 93 call link_status 94 call activity 95 96 ld a, 15 97 call link_status 98 call activity 99 100 ld a, 17 101 call link_status 102 call activity 103 104 ld a, 16 105 call link_status 106 call activity 107 108 ld a, 26 109 call link_status 110 call activity 111 112 ld a, 32 113 call link_status 114 call activity 115 116 ld a, 33 117 call link_status 118 call activity 119 120 ld a, 34 121 call link_status 122 call activity 123 124 ld a, 35 125 call link_status 126 call activity 127 128 ld a, 36 129 call link_status 130 call activity 131 132 ld a, 47 133 call link_status 134 call activity 135 136 ld a, 46 137 call link_status 138 call activity 139 140 ld a, 27 141 call link_status 142 call activity 143 144 ld a, 43 145 call link_status 146 call activity 147 148 ld a, 44 149 call link_status 150 call activity 151 152 ld a, 45 153 call link_status 154 call activity 155 156 inc (TXRX_ALT_COUNT) 157 send NUM_PORT * 2 158 159 ; 160 ; activity 161 ; 162 ; This routine calculates the activity LED for the current port. 163 ; It extends the activity lights using timers (new activity overrides 164 ; and resets the timers). 165 ; 166 ; Inputs: (PORT_NUM) 167 ; Outputs: one bit sent to LED stream 168 ; 169 170 activity: 171 ;jmp led_green ;DEBUG ONLY 172 call get_link 173 jnc led_black 174 port a 175 pushst RX 176 pushst TX 177 tor 178 pop 179 180 jnc led_black 181 182 ;jmp led_green ;DEBUG ONLY 183 184 ld b, (TXRX_ALT_COUNT) 185 and b, TXRX_ALT_TICKS 186 jnz led_green 187 jmp led_black 188 189 link_status: 190 ;jmp led_black ;DEBUG ONLY 191 call get_link 192 jnc led_black 193 jmp led_green 194 195 ; 196 ; get_link 197 ; 198 ; This routine finds the link status LED for a port. 199 ; Link info is in bit 0 of the byte read from PORTDATA[port] 200 ; 201 ; Inputs: Port number in a 202 ; Outputs: Carry flag set if link is up, clear if link is down. 203 ; Destroys: a, b 204 ; 205 206 get_link: 207 ld b,PORTDATA 208 add b,a 209 ld b,(b) 210 tst b,0 211 ret 212 213 ; 214 ; led_black, led_green 215 ; 216 ; Inputs: None 217 ; Outputs: one bit to the LED stream indicating color 218 ; Destroys: None 219 ; 220 221 led_black: 222 pushst ONE 223 pack 224 ret 225 226 led_green: 227 pushst ZERO 228 pack 229 ret 230 231 ; 232 ; Variables (SDK software initializes LED memory from 0x80-0xff to 0) 233 ; 234 235 TXRX_ALT_COUNT equ 0xe0 236 PORT_NUM equ 0xe1 237 238 ; 239 ; Port data, which must be updated continually by main CPU's 240 ; linkscan task. See $SDK/src/appl/diag/ledproc.c for examples. 241 ; In this program, bit 0 is assumed to contain the link up/down status. 242 ; 243 244 ;Offset 0x1e80 245 PORTDATA equ 0xa0 ; Size 48 + 1 + 4 bytes 246 247 ; 248 ; Symbolic names for the bits of the port status fields 249 ; 250 251 RX equ 0x0 ; received packet 252 TX equ 0x1 ; transmitted packet 253 COLL equ 0x2 ; collision indicator 254 SPEED_C equ 0x3 ; 100 Mbps 255 SPEED_M equ 0x4 ; 1000 Mbps 256 DUPLEX equ 0x5 ; half/full duplex 257 FLOW equ 0x6 ; flow control capable 258 LINKUP equ 0x7 ; link down/up status 259 LINKEN equ 0x8 ; link disabled/enabled status 260 ZERO equ 0xE ; always 0 261 ONE equ 0xF ; always 1