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