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

bcm956820r24xg.asm (6905B)


      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+4 port) BCM956820R24XG board.
     10 ; To start it, use the following commands from BCM:
     11 ;
     12 ;       led load bcm956820r24xg.hex
     13 ;       led auto on
     14 ;       led start
     15 ;
     16 ; The is 1 LEDs per XE port. 
     17 ;
     18 ; There is one bit per 10 gigabit Ethernet LED with the following colors:
     19 ;       ONE 		Black
     20 ;       ZERO            Green
     21 ;
     22 ; Each chip drives only its own LEDs and needs to write them in the order:
     23 ;       A01/L01, L02/A02, ..., L24/A24
     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/A01 reflects port 1 link status:
     35 ;       Black: no link
     36 ;       Green: Link/Activity
     37 ;
     38 ;
     39 MIN_XE_PORT     EQU     1
     40 MAX_XE_PORT     EQU     24
     41 NUM_XE_PORT     EQU     24
     42 
     43 NUM_ALL_PORT    EQU     24
     44 
     45 MIN_PORT        EQU     1
     46 MAX_PORT        EQU     24
     47 NUM_PORT        EQU     24
     48 
     49 ; The TX/RX activity lights will be extended for ACT_EXT_TICKS
     50 ; so they will be more visible.
     51 TICKS           EQU     1
     52 SECOND_TICKS    EQU     (30*TICKS)
     53 ACT_EXT_TICKS   EQU     (SECOND_TICKS/3)
     54 TXRX_ALT_TICKS  EQU     (SECOND_TICKS/6)
     55 
     56 ;
     57 ; Main Update Routine
     58 ;
     59 ;  This routine is called once per tick.
     60 ;
     61 
     62 update:
     63 quad1:          ; 1 - 2
     64 	ld	a, 1
     65         port    a
     66         call    link
     67 
     68 	ld	a, 2
     69         port    a
     70         call    activity
     71         call    link
     72 
     73 	ld	a, 1
     74         port    a
     75         call    activity
     76 
     77 quad2:          ; 3 - 4
     78 	ld	a, 4
     79         port    a
     80         call    link
     81 
     82 	ld	a, 3
     83         port    a
     84         call    activity
     85         call    link
     86 
     87 	ld	a, 4
     88         port    a
     89         call    activity
     90 
     91 quad3:          ; 5 - 6
     92 	ld	a, 5
     93         port    a
     94         call    link
     95 
     96 	ld	a, 6
     97         port    a
     98         call    activity
     99         call    link
    100 
    101 	ld	a, 5
    102         port    a
    103         call    activity
    104 
    105 quad4:          ; 7 - 8
    106 	ld	a, 7
    107         port    a
    108         call    link
    109 
    110 	ld	a, 8
    111         port    a
    112         call    activity
    113         call    link
    114 
    115 	ld	a, 7
    116         port    a
    117         call    activity
    118 quad5:          ; 9 - 10
    119 	ld	a, 9
    120         port    a
    121         call    link
    122 
    123 	ld	a, 10
    124         port    a
    125         call    activity
    126         call    link
    127 
    128 	ld	a, 9
    129         port    a
    130         call    activity
    131 
    132 quad6:          ; 11 - 12
    133 	ld	a, 12
    134         port    a
    135         call    link
    136 
    137 	ld	a, 11
    138         port    a
    139         call    activity
    140         call    link
    141 
    142 	ld	a, 12
    143         port    a
    144         call    activity
    145 
    146 quad7:          ; 13 - 14
    147 	ld	a, 13
    148         port    a
    149         call    link
    150 
    151 	ld	a, 14
    152         port    a
    153         call    activity
    154         call    link
    155 
    156 	ld	a, 13
    157         port    a
    158         call    activity
    159 
    160 quad8:          ; 15 - 16
    161 	ld	a, 15
    162         port    a
    163         call    link
    164 
    165 	ld	a, 16
    166         port    a
    167         call    activity
    168         call    link
    169 
    170 	ld	a, 15
    171         port    a
    172         call    activity
    173 quad9:          ; 17 - 18
    174 	ld	a, 17
    175         port    a
    176         call    link
    177 
    178 	ld	a, 18
    179         port    a
    180         call    activity
    181         call    link
    182 
    183 	ld	a, 17
    184         port    a
    185         call    activity
    186 
    187 quad10:          ; 19 - 20
    188 	ld	a, 20
    189         port    a
    190         call    link
    191 
    192 	ld	a, 19
    193         port    a
    194         call    activity
    195         call    link
    196 
    197 	ld	a, 20
    198         port    a
    199         call    activity
    200 
    201 quad11:          ; 21 - 22
    202 	ld	a, 21
    203         port    a
    204         call    link
    205 
    206 	ld	a, 22
    207         port    a
    208         call    activity
    209         call    link
    210 
    211 	ld	a, 21
    212         port    a
    213         call    activity
    214 
    215 quad12:          ; 23 - 24
    216 	ld	a, 23
    217         port    a
    218         call    link
    219 
    220 	ld	a, 24
    221         port    a
    222         call    activity
    223         call    link
    224 
    225 	ld	a, 23
    226         port    a
    227         call    activity
    228 
    229         ; Update various timers
    230         inc     (TXRX_ALT_COUNT)
    231 
    232         send    NUM_PORT * 2 
    233 
    234 ;
    235 ; link
    236 ;
    237 ;  Inputs: (PORT_NUM)
    238 ;  Outputs: one bit sent to LED stream
    239 ;
    240 
    241 link:
    242         ;jmp     led_green       ;DEBUG ONLY
    243         call    get_link
    244         jnc     led_black
    245         jmp     led_green
    246 
    247 ;
    248 ; activity
    249 ;
    250 ;  This routine calculates the activity LED for the current port.
    251 ;  It extends the activity lights using timers (new activity overrides
    252 ;  and resets the timers).
    253 ;
    254 ;  Inputs: (PORT_NUM)
    255 ;  Outputs: one bit sent to LED stream
    256 ;
    257 
    258 activity:
    259         ;jmp     led_green       ;DEBUG ONLY
    260         call    get_link
    261         jnc     led_black
    262         port    a
    263         pushst  RX
    264         pushst  TX
    265         tor
    266         pop
    267 
    268         jnc     led_black       ; Always black Link up, No Activity
    269 
    270         ;jmp     led_green       ;DEBUG ONLY
    271 
    272         ld      b, (TXRX_ALT_COUNT)
    273         and     b, TXRX_ALT_TICKS 
    274         jnz     led_green
    275         jmp     led_black
    276 
    277 link_status:
    278         ;jmp     led_black       ;DEBUG ONLY
    279         call    get_link
    280         jnc     led_black
    281         jmp     led_green
    282 
    283 ;
    284 ; get_link
    285 ;
    286 ;  This routine finds the link status LED for a port.
    287 ;  Link info is in bit 0 of the byte read from PORTDATA[port]
    288 ;
    289 ;  Inputs: Port number in a
    290 ;  Outputs: Carry flag set if link is up, clear if link is down.
    291 ;  Destroys: a, b
    292 ;
    293 
    294 get_link:
    295         ld      b,PORTDATA
    296         add     b,a
    297         ld      b,(b)
    298         tst     b,0
    299         ret
    300 
    301 ;
    302 ; led_black, led_green
    303 ;
    304 ;  Inputs: None
    305 ;  Outputs: one bit  to the LED stream indicating color
    306 ;  Destroys: None
    307 ;
    308 
    309 led_black:
    310         pushst  ONE
    311         pack
    312         ret
    313 
    314 led_green:
    315         pushst  ZERO
    316         pack
    317         ret
    318 
    319 ;
    320 ; Variables (SDK software initializes LED memory from 0xa0-0xff to 0)
    321 ;
    322 
    323 TXRX_ALT_COUNT  equ     0xe0
    324 PORT_NUM        equ     0xe1
    325 
    326 ;
    327 ; Port data, which must be updated continually by main CPU's
    328 ; linkscan task.  See $SDK/src/appl/diag/ledproc.c for examples.
    329 ; In this program, bit 0 is assumed to contain the link up/down status.
    330 ;
    331 
    332 ;Offset 0x1e00 - 0x80
    333 ;LED scan chain assembly area
    334 
    335 ;Offset 0x1e80 - 0xa0
    336 PORTDATA        equ     0xa0    ; Size 48 + 1 + 4 bytes
    337 
    338 ;
    339 ; Symbolic names for the bits of the port status fields
    340 ;
    341 
    342 RX              equ     0x0     ; received packet
    343 TX              equ     0x1     ; transmitted packet
    344 COLL            equ     0x2     ; collision indicator
    345 SPEED_C         equ     0x3     ; 100 Mbps
    346 SPEED_M         equ     0x4     ; 1000 Mbps
    347 DUPLEX          equ     0x5     ; half/full duplex
    348 FLOW            equ     0x6     ; flow control capable
    349 LINKUP          equ     0x7     ; link down/up status
    350 LINKEN          equ     0x8     ; link disabled/enabled status
    351 ZERO            equ     0xE     ; always 0
    352 ONE             equ     0xF     ; always 1