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