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