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

lm12pcx456501.asm (4174B)


      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 12 port 56501 based CX4 LM
     10 ; To start it, use the following commands from BCM:
     11 ;
     12 ;       led load lm12pcx456504.hex
     13 ;       led auto on
     14 ;       led start
     15 ;
     16 ; There are 12 LEDS four each for 10G ports
     17 ; There is one bit per 10G LED with the following colors:
     18 ;       ZERO     Black
     19 ;       ONE      Green
     20 ;
     21 ; Each chip drives only its own LEDs and needs to write them in the order:
     22 ;       L25,T25, R25, E25,  ..., L28,T28, R28, E28
     23 ;
     24 ; Link up/down info cannot be derived from LINKEN or LINKUP, as the LED
     25 ; processor does not always have access to link status.  This program
     26 ; assumes link status is kept current in bit 0 of RAM byte (0x80 + portnum).
     27 ; Generally, a program running on the main CPU must update these
     28 ; locations on link change; see linkscan callback in
     29 ; $SDK/src/appl/diag/ledproc.c.
     30 ;
     31 ; Current implementation:
     32 ;
     33 ; L25-L28 reflects 10G link status:
     34 ;       Black: no link
     35 ;       Green: Link
     36 ; T25-T28 reflects port 25-28 TX activity
     37 ;       Black: idle
     38 ;       Green: TX (pulse extended to 1/3 sec)
     39 ; R25-R28 reflects port 25-28 RX activity
     40 ;       Black: idle
     41 ;       Green: RX (pulse extended to 1/3 sec)
     42 ; E25-E28 reflects 10G link enable
     43 ;       Black: Disable
     44 ;       Green: Enable
     45 ;
     46 
     47 TICKS           EQU     1
     48 SECOND_TICKS    EQU     (30*TICKS)
     49 
     50 MIN_GE_PORT     EQU     0
     51 MAX_GE_PORT     EQU     23
     52 NUM_GE_PORT     EQU     24
     53 
     54 MIN_HG_PORT     EQU     24
     55 MAX_HG_PORT     EQU     27
     56 NUM_HG_PORT     EQU     4
     57 NUM_ALL_PORT    EQU     28
     58 
     59 MIN_PORT        EQU     0
     60 MAX_PORT        EQU     27
     61 NUM_PORT        EQU     28
     62 
     63 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS
     64 ; so they will be more visible.
     65 
     66 ACT_EXT_TICKS   EQU     (SECOND_TICKS/3)
     67 GIG_ALT_TICKS   EQU     (SECOND_TICKS/2)
     68 HD_OFF_TICKS    EQU     (SECOND_TICKS/20)
     69 HD_ON_TICKS     EQU     (SECOND_TICKS-HD_ON_TICKS)
     70 TXRX_ALT_TICKS  EQU     (SECOND_TICKS/6)
     71 
     72 ;
     73 ; Main Update Routine
     74 ;
     75 ;  This routine is called once per tick.
     76 ;
     77 
     78 update:
     79         ; Put out 12 bits for 10G port
     80         ld      a, MIN_HG_PORT
     81 up1_5:
     82         port    a
     83 
     84         ;       LINKUP  TX, RX, LINKEN
     85 	pushst	LINKUP
     86         call    get_link
     87         jnc      link_down
     88 	tinv
     89 link_down:
     90 	pack
     91 
     92 	pushst	TX
     93 	tinv
     94 	pack
     95 
     96 	pushst	RX
     97 	tinv
     98 	pack
     99 
    100 	pushst	LINKEN
    101 	tinv
    102 	pack
    103 
    104 
    105         inc     a
    106         cmp     a,NUM_ALL_PORT
    107         jnz     up1_5
    108 
    109         send    12     ; 1 * 4 * 3 = 12
    110 
    111 ;
    112 ; get_link
    113 ;
    114 ;  This routine finds the link status LED for a port.
    115 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    116 ;
    117 ;  Inputs: Port number in a
    118 ;  Outputs: Carry flag set if link is up, clear if link is down.
    119 ;  Destroys: a, b
    120 ;
    121 
    122 get_link:
    123         ld      b,PORTDATA
    124         add     b,a
    125         ld      b,(b)
    126         tst     b,0
    127         ret
    128 
    129 ;
    130 ; Variables (SDK software initializes LED memory from 0x80-0xff to 0)
    131 ;
    132 
    133 TXRX_ALT_COUNT  equ     0xe0
    134 HD_COUNT        equ     0xe1
    135 GIG_ALT_COUNT   equ     0xe2
    136 PORT_NUM        equ     0xe3
    137 
    138 ;
    139 ; Port data, which must be updated continually by main CPU's
    140 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    141 ; In this program, bit 0 is assumed to contain the link up/down status.
    142 ;
    143 
    144 PORTDATA        equ     0x80    ; Size 24 + 4? bytes
    145 
    146 ;
    147 ; LED extension timers
    148 ;
    149 
    150 RX_TIMERS       equ     0xa0+0                  ; NUM_PORT bytes
    151 TX_TIMERS       equ     0xa0+NUM_PORT           ; NUM_PORT bytes
    152 
    153 ;
    154 ; Symbolic names for the bits of the port status fields
    155 ;
    156 
    157 RX              equ     0x0     ; received packet
    158 TX              equ     0x1     ; transmitted packet
    159 COLL            equ     0x2     ; collision indicator
    160 SPEED_C         equ     0x3     ; 100 Mbps
    161 SPEED_M         equ     0x4     ; 1000 Mbps
    162 DUPLEX          equ     0x5     ; half/full duplex
    163 FLOW            equ     0x6     ; flow control capable
    164 LINKUP          equ     0x7     ; link down/up status
    165 LINKEN          equ     0x8     ; link disabled/enabled status
    166 ZERO            equ     0xE     ; always 0
    167 ONE             equ     0xF     ; always 1