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