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

sdk56820.asm (4476B)


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