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

sdk56670.asm (5455B)


      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 BCM56670.
     10 ; There s one  LED processors on BCM56670.
     11 ; Each LED processor accomodates 64 ports.
     12 ; LED processor 0 : Physical Ports 1-64
     13 ;
     14 ; To start the first one, use the following commands from BCM:
     15 ;
     16 ;       led 0 load sdk56670.hex
     17 ;       led 0 auto on
     18 ;       led 0 start
     19 ;
     20 ; The are 2 LEDs per port one for Link(Top) and one for activity(Bottom).
     21 ;
     22 ; Each chip drives only its own LEDs and needs to write them in the order:
     23 ;       L01/A01, L02/A02, ..., L63/A63
     24 ;
     25 ; There are two bits per Ethernet LED for activity with the following colors:
     26 ;       ZERO, ZERO      Black
     27 ;       ZERO, ONE       Amber
     28 ;       ONE, ZERO       Green
     29 ;
     30 ; This program assumes link status is kept current in bit 0 of RAM byte (0xA0 + portnum).
     31 ; Generally, a program running on the main CPU must update these
     32 ; locations on link change; see linkscan callback in
     33 ; $SDK/src/appl/diag/ledproc.c.
     34 ;
     35 ; Current implementation:
     36 ;
     37 ; L01 reflects port 1 link status:
     38 ;       Black: no link
     39 ;       Green: Link
     40 ;
     41 ; A01 reflects port 1 activity status:
     42 ;       Black: no activity
     43 ;       Blinking Green and Black: TX activity
     44 ;       Blinking Amber and Black: RX activity
     45 ;       Blinking Green and Amber: TX and RX activity
     46 ;
     47 ;
     48 TICKS           EQU     1
     49 SECOND_TICKS    EQU     (30*TICKS)
     50 
     51 TXRX_ALT_TICKS  EQU     (SECOND_TICKS)
     52 
     53 MIN_PORT        EQU     0
     54 NUM_PORT        EQU     64 
     55 MAX_PORT        EQU     63 
     56 
     57 
     58 ; Assumptions
     59 ; Link status is injected by SDK from Linkscan task at PORTDATA offset
     60 
     61 ;
     62 ; Main Update Routine
     63 ;
     64 ;  This routine is called once per tick.
     65 ;
     66 
     67 update:
     68         ld      a,MIN_PORT
     69 port_loop:
     70 
     71         call    link_status    ; Top LED for this port
     72         call    chk_activity   ; Bottom LED for this port
     73 
     74         inc     a
     75         cmp     a,MAX_PORT
     76         jnz     port_loop
     77 
     78         ; Update various timers
     79         inc     (TXRX_ALT_COUNT)
     80 
     81         send    248 ; offset to shift bits so as to align LEDs on board intuitively
     82 
     83 
     84 ; Activity status LED update
     85 chk_activity:
     86         call    get_txact   ;get TX activity
     87         jnc     act1        ;TX not active, check if RX active
     88         jmp     act2        ;TX active, check if RX active
     89         ret
     90 act1:
     91         call    get_rxact
     92         jnc     led_black   ;no activity
     93         jmp     blink_amber ;only RX active
     94         ret
     95 act2:
     96         call    get_rxact
     97         jnc     blink_green ;only TX active
     98         jmp     blink_amg   ;TX and RX both active
     99         ret
    100 
    101 ; Link status LED update
    102 link_status:
    103         call    get_link
    104         jnc     led_black
    105         jmp     led_green
    106         clc
    107         ret
    108 
    109 ;
    110 ; get_link
    111 ;
    112 ;  This routine finds the link status for a port.
    113 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    114 ;
    115 ;  Inputs: Port number in a
    116 ;  Outputs: Carry flag set if link is up, clear if link is down.
    117 ;  Destroys: b
    118 ;
    119 
    120 get_link:
    121         clc
    122         ld      b,PORTDATA
    123         add     b,a
    124         ld      b,(b)
    125         tst     b,0
    126         ret
    127 
    128 ;
    129 ; get_txact
    130 ;
    131 ;  This routine finds the TX activity status for a port.
    132 ;  TX activity info is in bit 4 of the byte read from PORTDATA[port]
    133 ;
    134 ;  Inputs: Port number in a
    135 ;  Outputs: Carry flag set if TX activity is in progress, clear if not..
    136 ;  Destroys: b
    137 ;
    138 get_txact:
    139         clc
    140         ld      b,PORTDATA
    141         add     b,a
    142         ld      b,(b)
    143         tst     b,4
    144         ret
    145 
    146 ;
    147 ; get_rxact
    148 ;
    149 ;  This routine finds the RX activity status for a port.
    150 ;  TX activity info is in bit 5 of the byte read from PORTDATA[port]
    151 ;
    152 ;  Inputs: Port number in a
    153 ;  Outputs: Carry flag set if RX activity is in progress, clear if not..
    154 ;  Destroys: b
    155 ;
    156 get_rxact:
    157         clc
    158         ld      b,PORTDATA
    159         add     b,a
    160         ld      b,(b)
    161         tst     b,5
    162         ret
    163 
    164 ;
    165 ; blink_amber, blink_green, blink_amg
    166 ; Alteration between respective colors based on timer
    167 ;
    168 
    169 blink_amber:
    170         ld      b, (TXRX_ALT_COUNT)
    171         and     b, TXRX_ALT_TICKS
    172         jnz     led_amber
    173         jmp     led_black
    174         clc
    175         ret
    176 
    177 blink_green:
    178         ld      b, (TXRX_ALT_COUNT)
    179         and     b, TXRX_ALT_TICKS
    180         jnz     led_green
    181         jmp     led_black
    182         clc
    183         ret
    184 
    185 blink_amg:
    186         ld      b, (TXRX_ALT_COUNT)
    187         and     b, TXRX_ALT_TICKS
    188         jnz     led_amber
    189         jmp     led_green
    190         clc
    191         ret
    192 
    193 ;
    194 ; led_black, led_amber, led_green
    195 ;
    196 ;  Inputs: None
    197 ;  Outputs: Two bits to the LED stream indicating color
    198 ;  Destroys: None
    199 ;
    200 
    201 led_black:
    202         pushst  ZERO
    203         pack
    204         pushst  ZERO
    205         pack
    206         ret
    207 
    208 led_amber:
    209         pushst  ONE
    210         pack
    211         pushst  ZERO
    212         pack
    213         ret
    214 
    215 led_green:
    216         pushst  ZERO
    217         pack
    218         pushst  ONE
    219         pack
    220         ret
    221 
    222 ;
    223 ; Variables (SDK software initializes LED memory from 0xa0-0xff to 0)
    224 ;
    225 
    226 TXRX_ALT_COUNT  equ     0xe0
    227 
    228 ;
    229 ; Port data, which must be updated continually by main CPU's
    230 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    231 ; In this program, bit 0 is assumed to contain the link up/down status.
    232 ;
    233 
    234 ;LED scan chain assembly area
    235 ;Offset 0x20680 for LED 0
    236 PORTDATA        equ     0xa0    ; Size 4 bytes for each port starting A0,A4 ...
    237 
    238 ZERO            equ     0xE     ; always 0
    239 ONE             equ     0xF     ; always 1