openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

sdk56626.asm (4932B)


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