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

sdk56214.asm (4974B)


      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+2+2 port) BCM956214P24
     10 ; To start it, use the following commands from BCM:
     11 ;
     12 ;       0:led load sdk56214.hex
     13 ;       0:led auto on
     14 ;       0:led start
     15 ;
     16 ; The are 2 signle color LEDs per GE port.
     17 ;
     18 ; There is one bits per LED with the following colors:
     19 ;       ZERO      Green
     20 ;       ONE       Black
     21 ;
     22 ; Each chip drives only its own LEDs and needs to write them in the order:
     23 ;       L06, A06, L07, ..., L29, A29, L05, A05, L04, A04, L01, A01, L02, A02 
     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 reflects port 1 link status:
     35 ;       Black: no link
     36 ;       Green: link 
     37 ;
     38 ; A01 reflects port 1 activity (even if port is down)
     39 ;       Black: idle
     40 ;       Green: RX/TX (pulse extended to 1/3 sec)
     41 ;
     42 
     43 
     44 MIN_HG_PORT     EQU     1 
     45 MAX_HG_PORT     EQU     2 
     46 NUM_HG_PORT     EQU     2
     47 
     48 MIN_UL_PORT     EQU     4
     49 MAX_UL_PORT     EQU     5
     50 NUM_UL_PORT     EQU     2
     51 
     52 MIN_GE_PORT     EQU     6 
     53 MAX_GE_PORT     EQU     29 
     54 NUM_GE_PORT     EQU     24
     55 
     56 NUM_PORT        EQU     28
     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 
     71 update:
     72         ld      a, MIN_GE_PORT
     73         
     74 ge_up:
     75         ld      (PORT_NUM),a
     76 
     77         call    link_status
     78         call    activity
     79 
     80         ld      a,(PORT_NUM)
     81         inc     a
     82         cmp     a, MAX_GE_PORT+1
     83         jc      ge_up 
     84 
     85         ld      a, MAX_UL_PORT
     86 ul_up:
     87         ld      (PORT_NUM),a
     88 
     89         call    link_status
     90         call    activity
     91 
     92         ld      a,(PORT_NUM)
     93         dec     a
     94         cmp     a, MIN_UL_PORT-1
     95         jnz     ul_up 
     96 
     97         ld      a, MAX_HG_PORT
     98 hg_up:
     99         ld      (PORT_NUM),a
    100 
    101         call    link_status
    102         call    activity
    103 
    104         ld      a,(PORT_NUM)
    105         dec     a
    106         cmp     a, MIN_HG_PORT-1
    107         jnz     hg_up 
    108 
    109         inc     (TXRX_ALT_COUNT)
    110         send    NUM_PORT * 2 
    111 
    112 ;
    113 ; 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: Two bits sent to LED stream
    121 ;
    122 
    123 activity:
    124         ld      a, (PORT_NUM)
    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_black
    134 
    135         ld      b, (TXRX_ALT_COUNT)
    136         and     b, TXRX_ALT_TICKS 
    137         jnz     led_green
    138         jmp     led_black
    139 
    140 link_status:
    141         ld      a,(PORT_NUM)    ; Check for link down
    142         call    get_link
    143         jnc     led_black
    144         jmp     led_green
    145 
    146 ;
    147 ; get_link
    148 ;
    149 ;  This routine finds the link status LED for a port.
    150 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    151 ;
    152 ;  Inputs: Port number in a
    153 ;  Outputs: Carry flag set if link is up, clear if link is down.
    154 ;  Destroys: a, b
    155 ;
    156 
    157 get_link:
    158         ld      b,PORTDATA
    159         add     b,a
    160         ld      b,(b)
    161         tst     b,0
    162         ret
    163 
    164 ;
    165 ; led_black, led_amber, led_green
    166 ;
    167 ;  Inputs: None
    168 ;  Outputs: Two bits to the LED stream indicating color
    169 ;  Destroys: None
    170 ;
    171 
    172 led_black:
    173         pushst  ONE
    174         pack
    175         ret
    176 
    177 led_green:
    178         pushst  ZERO
    179         pack
    180         ret
    181 
    182 ;
    183 ; Variables (SDK software initializes LED memory from 0x80-0xff to 0)
    184 ;
    185 
    186 TXRX_ALT_COUNT  equ     0xe0
    187 PORT_NUM        equ     0xe1
    188 
    189 ;
    190 ; Port data, which must be updated continually by main CPU's
    191 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    192 ; In this program, bit 0 is assumed to contain the link up/down status.
    193 ;
    194 
    195 PORTDATA        equ     0xa0    ; Size 24 + 6 bytes
    196 
    197 ;
    198 ; Symbolic names for the bits of the port status fields
    199 ;
    200 
    201 RX              equ     0x0     ; received packet
    202 TX              equ     0x1     ; transmitted packet
    203 COLL            equ     0x2     ; collision indicator
    204 SPEED_C         equ     0x3     ; 100 Mbps
    205 SPEED_M         equ     0x4     ; 1000 Mbps
    206 DUPLEX          equ     0x5     ; half/full duplex
    207 FLOW            equ     0x6     ; flow control capable
    208 LINKUP          equ     0x7     ; link down/up status
    209 LINKEN          equ     0x8     ; link disabled/enabled status
    210 ZERO            equ     0xE     ; always 0
    211 ONE             equ     0xF     ; always 1