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

lm12p56802.asm (6714B)


      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 56802 based CX4 LM
     10 ; To start it, use the following commands from BCM:
     11 ;
     12 ;       led load lm12p56802.hex
     13 ;       led auto on
     14 ;       led start
     15 ;
     16 ; There are 48 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 ; The chip drives its LEDs and needs to write them in the order:
     22 ;       L01,T01, R01, E01,  ..., L12,T12, R12, E12
     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 ; Link activity info for Higig/XE ports are not updated by LED processor in
     32 ; 56800. The counter DMA task reports the activities of Higig/Xe ports
     33 ; in bit 1-5 of RAM byte (0x94 + portnum). Bit 1 indicates that the link
     34 ; activity is high. Bit 2 indicates that the link activity is medium. Bit
     35 ; 3 indicates that the link activity is low. If all three bits are clear, there
     36 ; is no activity on the link. Bit 4 indicates TX activity and Bit 5 indicates
     37 ; RX activity. See counter DMA task in $SDK/src/soc/counter.c
     38 ;
     39 ; Current implementation:
     40 ;
     41 ; L01-L12 reflects 10G link status:
     42 ;       Black: no link
     43 ;       Green: Link
     44 ; T01-T12 reflects port 1-12 TX activity
     45 ;       Black: idle
     46 ;       Green: TX (pulse extended to 1/3 sec)
     47 ; R01-R12 reflects port 1-12 RX activity
     48 ;       Black: idle
     49 ;       Green: RX (pulse extended to 1/3 sec)
     50 ; E01-E12 reflects 10G link enable
     51 ;       Black: Disable
     52 ;       Green: Enable
     53 ;
     54 
     55 TICKS           EQU     1
     56 SECOND_TICKS    EQU     (30*TICKS)
     57 
     58 ; hg4-hg15 are front panel ports (hg0-hg3 are back-plane ports)
     59 MIN_XE_PORT     EQU     4
     60 SKIP_PORT       EQU     8       ; Ports 8 and 9 are skipped in HUMV
     61 MAX_XE_PORT     EQU     17
     62 NUM_PORT        EQU     18
     63 
     64 HI_ACT          EQU      0x2    ; Hi activity bit mask
     65 ME_ACT          EQU      0x4    ; Medium activity bit mask
     66 LO_ACT          EQU      0x8    ; Low activity bit mask
     67 TX_ACT          EQU      0x10   ; TX activity
     68 RX_ACT          EQU      0x20   ; RX activity
     69 
     70 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS
     71 ; so they will be more visible.
     72 
     73 ACT_EXT_TICKS   EQU     (SECOND_TICKS/3)
     74 
     75 ;
     76 ; Main Update Routine
     77 ;
     78 ;  This routine is called once per tick.
     79 ;
     80 
     81 update:
     82         ; Put out 48 bits for 10G port
     83         ld      a, MIN_XE_PORT
     84 up1:
     85         port    a
     86 
     87         cmp     a, SKIP_PORT    ; On 16 ports HUMV, port 8 and 9 are
     88         jnz     valid_port      ; disabled. Therefore, we skip
     89         add     a, 2            ; port 8 and 9
     90         port    a
     91 
     92 valid_port:
     93         ;       LINKUP  TX, RX, LINKEN
     94         pushst  LINKUP
     95         call    get_link
     96         jnc     link_down
     97         tinv
     98 link_down:
     99         pack
    100 
    101         ld      (PORT_NUM), a
    102         call    tx_activity     ; get TX activity
    103         ld      a, (PORT_NUM)
    104 
    105         ld      (PORT_NUM), a
    106         call    rx_activity     ; get RX activity
    107         ld      a, (PORT_NUM)
    108 
    109         pushst  LINKEN
    110         tinv
    111         pack
    112 
    113         inc     a
    114         cmp     a, NUM_PORT
    115         jnz     up1
    116 
    117         send    48     ; 1 * 4 * 12 = 48
    118 
    119 ;
    120 ; get_link
    121 ;
    122 ;  This routine finds the link status LED for a port.
    123 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    124 ;
    125 ;  Inputs: Port number in a
    126 ;  Outputs: Carry flag set if link is up, clear if link is down.
    127 ;  Destroys: a, b
    128 ;
    129 
    130 get_link:
    131         ld      b,PORTDATA
    132         add     b,a
    133         ld      b,(b)
    134         tst     b,0
    135         ret
    136 
    137 tx_activity:
    138         ld      a, (PORT_NUM)
    139         ld      b, ACT_DATA
    140         add     b, a
    141         ld      b, (b)
    142 
    143         ld      a, TX_ACT
    144         and     a, b
    145         jz      tx_act1
    146 
    147         ld      b, TX_TIMERS     ; Start TX LED extension timer
    148         add     b, (PORT_NUM)
    149         ld      a, ACT_EXT_TICKS
    150         ld      (b),a
    151 
    152 tx_act1:
    153         ld      b, TX_TIMERS
    154         add     b, (PORT_NUM)
    155         dec     (b)
    156         jnc     led_green       ; TX active?
    157         inc     (b)
    158         jmp     led_black       ; No activity
    159 
    160 rx_activity:
    161         ld      a, (PORT_NUM)
    162         ld      b, ACT_DATA
    163         add     b, a
    164         ld      b, (b)
    165 
    166         ld      a, RX_ACT
    167         and     a, b
    168         jz      rx_act1
    169 
    170         ld      b, RX_TIMERS     ; Start RX LED extension timer
    171         add     b, (PORT_NUM)
    172         ld      a, ACT_EXT_TICKS
    173         ld      (b),a
    174 
    175 rx_act1:
    176         ld      b, RX_TIMERS
    177         add     b, (PORT_NUM)
    178         dec     (b)
    179         jnc     led_green       ; RX active?
    180         inc     (b)
    181         jmp     led_black       ; No activity
    182 
    183 led_black:
    184         pushst  ZERO
    185         tinv
    186         pack
    187         ret
    188 
    189 led_green:
    190         pushst  ONE
    191         tinv
    192         pack
    193         ret
    194 
    195 ;
    196 ; Variables (SDK software initializes LED memory from 0x80-0xff to 0)
    197 ;
    198 
    199 
    200 ;
    201 ; Port data, which must be updated continually by main CPU's
    202 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    203 ; In this program, bit 0 is assumed to contain the link up/down status.
    204 ;
    205 
    206 PORTDATA        equ     0x80               ; 20 bytes
    207 
    208 ;
    209 ; ACT_DATA must be updated continually by counter DMA tasks.
    210 ; See $SDK/src/soc/counter.c for examples.
    211 ; Bit
    212 ; 1   - If set, the link activity is more than 50% of line rate.
    213 ; 2   - If set, the link activity is between 25 to 50% of line rate.
    214 ; 3   - If set, the link activity is between 3 to 25% of line  rate.
    215 ; If bit 1, 2, and 3 are all clear, the link activity is less than 3%.
    216 ACT_DATA        equ     0x80+0x14          ; 20 bytes
    217 
    218 
    219 ;
    220 ; LED extension timers
    221 ;
    222 
    223 RX_TIMERS       equ     0xc0+0                  ; NUM_PORT bytes
    224 TX_TIMERS       equ     0xc0+NUM_PORT           ; NUM_PORT bytes
    225 PORT_NUM        equ     TX_TIMERS+NUM_PORT
    226 
    227 ;
    228 ; Symbolic names for the bits of the port status fields
    229 ;
    230 
    231 RX              equ     0x0     ; received packet
    232 TX              equ     0x1     ; transmitted packet
    233 COLL            equ     0x2     ; collision indicator
    234 SPEED_C         equ     0x3     ; 100 Mbps
    235 SPEED_M         equ     0x4     ; 1000 Mbps
    236 DUPLEX          equ     0x5     ; half/full duplex
    237 FLOW            equ     0x6     ; flow control capable
    238 LINKUP          equ     0x7     ; link down/up status
    239 LINKEN          equ     0x8     ; link disabled/enabled status
    240 ZERO            equ     0xE     ; always 0
    241 ONE             equ     0xF     ; always 1
    242