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

ex3.asm (1729B)


      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 ;Here is an example program for programming the LEDs on the 5605.
      9 ;It is like example #2, but the scan out order is different.
     10 ;
     11 ;The situation is this:
     12 ;
     13 ;    26 ports (port 0-25) each have three LEDs.
     14 ;          led 0: RX
     15 ;          led 1: TX
     16 ;          led 2: link enabled
     17 ;
     18 ;    The scan out order is RX for ports 0 to 25, then TX for
     19 ;    ports 0 to 25, then link enable for ports 0 to 25.
     20 ;
     21 ;
     22 ;-------------------------- start of program --------------------------
     23 
     24 begin:
     25 	ld	B, RX
     26 	call	portsub
     27 
     28 	ld	B, TX
     29 	call	portsub
     30 
     31 	ld	B, COLL
     32 	call	portsub
     33 
     34 	send	78		; send 26*3 LED pulses and halt
     35 
     36 
     37 portsub:
     38 	ld	A,0		; start with port 0
     39 	ld	(portnum),A
     40 
     41 portloop:
     42 	port	A		; specify which port we're dealing with
     43 	pushst	B		; extract given status bit
     44 	pack			; send to output buffer
     45 	inc	(portnum)
     46 	ld	A,(portnum)
     47 	cmp	A,26
     48 	jnz	portloop
     49 
     50 	ret			; return from subroutine
     51 
     52 
     53 ; data storage
     54 portnum		equ	0x7F	; temp to hold which port we're working on
     55 
     56 
     57 ; symbolic labels
     58 ; this gives symbolic names to the various bits of the port status fields
     59 
     60 RX		equ	0x0	; received packet
     61 TX		equ	0x1	; transmitted packet
     62 COLL		equ	0x2	; collision indicator
     63 SPEED_C		equ	0x3	;  100 Mbps
     64 SPEED_M		equ	0x4	; 1000 Mbps
     65 DUPLEX		equ	0x5	; half/full duplex
     66 FLOW		equ	0x6	; flow control capable
     67 LINKUP		equ	0x7	; link down/up status
     68 LINKEN		equ	0x8	; link disabled/enabled status
     69 
     70 ;-------------------------- end of program --------------------------
     71 ;
     72 ;This program is 30 bytes in length and is only slightly more complicated
     73 ;than Example #2.
     74 ;