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

sdk56460.asm (4303B)


      1 ;
      2 ;
      3 ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 ; 
      5 ; Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 ; 
      7 ;
      8 ; This is the program used for testing the BCM56460 SVK with LED board.
      9 ; To start it, use the following commands from BCM:
     10 ;
     11 ;       led 0 load sdk56460.hex
     12 ;       led 0 auto on
     13 ;       led 0 start
     14 ;
     15 ; TEST LED board used . 1 LED per port is considered. 
     16 ; There are two bits per  LED with the following colors:
     17 ;       ZERO, ZERO      Black
     18 ;       ZERO, ONE       Amber
     19 ;       ONE, ZERO       Green
     20 ;
     21 ; Each chip drives only its own LEDs and needs to write them in the order:
     22 ;       LA01, LA02, ..., LA04
     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 (0xA0 + 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 as below and is being tested with TEST LED board:
     32 ;
     33 ; LA01 reflects port 1 link/activity status:
     34 ;       Black: no link
     35 ;       Green: Link
     36 ;       Green Blink: Activity
     37 ;
     38 
     39 TICKS           EQU     1
     40 SECOND_TICKS    EQU     (30*TICKS)
     41 
     42 MIN_PORT        EQU     1
     43 MAX_PORT        EQU     28
     44 
     45 NUM_PORT        EQU     28
     46 
     47 ;
     48 ; Main Update Routine
     49 ;
     50 ; This routine is called once per tick.
     51 ;
     52 
     53 update:
     54         call    delay
     55         ld      a, MIN_PORT
     56 
     57 up1:
     58         port    a
     59         ld      (PORT_NUM),a
     60         call    delay
     61         call    delay
     62         call    activity        
     63 
     64         ld      a,(PORT_NUM)
     65         inc     a
     66         cmp     a, MAX_PORT+1 
     67         jnz     up1
     68 
     69         ; Update various timers
     70 
     71 up2:
     72         send    28 *2 ;  
     73 
     74 ;
     75 ; activity
     76 ;
     77 ; This routine calculates the activity LED for the current port.
     78 ; It extends the activity lights using timers (new activity overrides
     79 ; and resets the timers).
     80 ;
     81 ; Inputs: (PORT_NUM)
     82 ; Outputs: Two bits sent to LED stream
     83 ;
     84 
     85 delay:  ld      a,0x50
     86 delay1: dec     a
     87         jnz     delay1
     88         ret
     89 
     90 activity:
     91         ld      a,(PORT_NUM)
     92         ld      b,PORTDATA
     93         add     b,a
     94         ld      b,(b)
     95         tst     b,0
     96 
     97         jnc     led_off
     98 
     99 
    100 
    101         tst  b,4
    102         push  cy
    103         tst  b,5
    104         push  cy
    105         tor
    106         pop
    107         jnc     clr_blink
    108 
    109         ld    b,(PORT_NUM)
    110         add   b,0x60
    111         ld    a,(b)
    112 
    113         inc  a
    114         ld    (b),a
    115 
    116         tst  a,0
    117         jc   led_off  
    118 clr_blink:
    119         ld    a,0
    120         ld    (b),a
    121 
    122 glow_link:
    123 
    124         jmp     led_green
    125 
    126 
    127 ;
    128 ; led_off, led_yellow, led_green
    129 ;
    130 ; Inputs: None
    131 ; Outputs: Two bits to the LED stream indicating color
    132 ; Destroys: None
    133 ;
    134 
    135 led_yellow:
    136         push  1
    137         pack
    138         push  0
    139         pack
    140         ret
    141 
    142 led_green:
    143         push  0
    144         pack
    145         push  1
    146         pack
    147         ret
    148 
    149 led_off:
    150         push  0
    151         pack
    152         push  0
    153         pack
    154         ret
    155 
    156 ;
    157 ; Variables (SDK software initializes LED memory from 0xa0-0xff to 0)
    158 ;
    159 
    160 TXRX_ALT_COUNT  equ     0xe0
    161 HD_COUNT        equ     0xe1
    162 GIG_ALT_COUNT   equ     0xe2
    163 PORT_NUM        equ     0xe3
    164 PD_TEMP        equ     0xe5
    165 
    166 ;
    167 ; Port data, which must be updated continually by main CPU's
    168 ; linkscan task.  See $SDK/src/appl/diag/esw/ledproc.c for examples.
    169 ; In this program, bit 0 is assumed to contain the link up/down status.
    170 ;
    171 
    172 PORTDATA        equ     0xa0    ; Size 24 + 6? bytes
    173 
    174 ;
    175 ; LED extension timers
    176 ;
    177 
    178 TXRX_TIMERS     equ     0xe4         ; NUM_PORT bytes C0 - DF
    179 ;TX_TIMERS       equ     0xe0           ; NUM_PORT bytes E0 - FF
    180 
    181 ;
    182 ; Symbolic names for the bits of the port status fields
    183 ;
    184 
    185 RX              equ     0x0     ; received packet
    186 TX              equ     0x1     ; transmitted packet
    187 COLL            equ     0x2     ; collision indicator
    188 SPEED_C         equ     0x3     ; 100 Mbps
    189 SPEED_M         equ     0x4     ; 1000 Mbps
    190 DUPLEX          equ     0x5     ; half/full duplex
    191 FLOW            equ     0x6     ; flow control capable
    192 LINKUP          equ     0x7     ; link down/up status
    193 LINKEN          equ     0x8     ; link disabled/enabled status
    194 ZERO            equ     0xE     ; always 0
    195 ONE             equ     0xF     ; always 1
    196