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

sdk56629.asm (5217B)


      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 + 8 XE/HG port) BCM56629 SDKs.
     10 ; To start it, use the following commands from BCM:
     11 ;
     12 ;       led load sdk56629.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,A03/L03,L04/A04,A05/L05,L06/A06,A07/L07,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 ;xe0( 02)   
     45 ;xe1( 14)   
     46 ;xe2( 26)   
     47 ;xe3( 27)   
     48 ;xe4( 28)   
     49 ;xe5( 29)   
     50 ;xe6( 30)   
     51 ;xe7( 31)   
     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         ; Update various timers
    108         inc     (TXRX_ALT_COUNT)
    109 
    110         send    NUM_PORT * 1 
    111 
    112 ;
    113 ; link_activity
    114 ;
    115 ;  This routine calculates the activity LED for the current port.
    116 ;  It extends the activity lights using timers (new activity overrides
    117 ;  and resets the timers).
    118 ;
    119 ;  Inputs: (PORT_NUM)
    120 ;  Outputs: one bit sent to LED stream
    121 ;
    122 
    123 link_activity:
    124         ;jmp     led_green       ;DEBUG ONLY
    125         call    get_link
    126         jnc     led_black
    127         port    a
    128         pushst  RX
    129         pushst  TX
    130         tor
    131         pop
    132 
    133         jnc     led_green       ; Always green Link up, No Activity
    134 
    135         ;jmp     led_green       ;DEBUG ONLY
    136 
    137         ld      b, (TXRX_ALT_COUNT)
    138         and     b, TXRX_ALT_TICKS 
    139         jnz     led_green
    140         jmp     led_black
    141 
    142 link_status:
    143         ;jmp     led_black       ;DEBUG ONLY
    144         call    get_link
    145         jnc     led_black
    146         jmp     led_green
    147 
    148 ;
    149 ; get_link
    150 ;
    151 ;  This routine finds the link status LED for a port.
    152 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    153 ;
    154 ;  Inputs: Port number in a
    155 ;  Outputs: Carry flag set if link is up, clear if link is down.
    156 ;  Destroys: a, b
    157 ;
    158 
    159 get_link:
    160         ld      b,PORTDATA
    161         add     b,a
    162         ld      b,(b)
    163         tst     b,0
    164         ret
    165 
    166 ;
    167 ; led_black, led_green
    168 ;
    169 ;  Inputs: None
    170 ;  Outputs: one bit  to the LED stream indicating color
    171 ;  Destroys: None
    172 ;
    173 
    174 led_black:
    175         pushst  ONE
    176         pack
    177         ret
    178 
    179 led_green:
    180         pushst  ZERO
    181         pack
    182         ret
    183 
    184 ;
    185 ; Variables (SDK software initializes LED memory from 0xa0-0xff to 0)
    186 ;
    187 
    188 TXRX_ALT_COUNT  equ     0xe0
    189 PORT_NUM        equ     0xe1
    190 
    191 ;
    192 ; Port data, which must be updated continually by main CPU's
    193 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    194 ; In this program, bit 0 is assumed to contain the link up/down status.
    195 ;
    196 
    197 ;Offset 0x1e00 - 0x80
    198 ;LED scan chain assembly area
    199 
    200 ;Offset 0x1e80 - 0xa0
    201 PORTDATA        equ     0xa0    ; Size 48 + 1 + 4 bytes
    202 
    203 ;
    204 ; Symbolic names for the bits of the port status fields
    205 ;
    206 
    207 RX              equ     0x0     ; received packet
    208 TX              equ     0x1     ; transmitted packet
    209 COLL            equ     0x2     ; collision indicator
    210 SPEED_C         equ     0x3     ; 100 Mbps
    211 SPEED_M         equ     0x4     ; 1000 Mbps
    212 DUPLEX          equ     0x5     ; half/full duplex
    213 FLOW            equ     0x6     ; flow control capable
    214 LINKUP          equ     0x7     ; link down/up status
    215 LINKEN          equ     0x8     ; link disabled/enabled status
    216 ZERO            equ     0xE     ; always 0
    217 ONE             equ     0xF     ; always 1