summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon/startup/boardinit.S
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-13 22:40:29 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-13 22:40:29 +0000
commitb21b0ab3e77d91fc32e4324d3dfaf57ce24096ab (patch)
treef20f740d0789c29c4ee5784b1455ef841c14ae36 /c/src/lib/libbsp/sparc/leon/startup/boardinit.S
parent2000-11-13 Jiri Gaisler <jgais@ws.estec.esa.nl> (diff)
downloadrtems-b21b0ab3e77d91fc32e4324d3dfaf57ce24096ab.tar.bz2
2000-11-13 Jiri Gaisler <jgais@ws.estec.esa.nl>
* .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.in, times, clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, console/.cvsignore, console/Makefile.am, console/console.c, console/consolereserveresources.c, console/debugputs.c, gnatsupp/.cvsignore, gnatsupp/Makefile.am, gnatsupp/gnatsupp.c, include/.cvsignore, include/Makefile.am, include/bsp.h, include/coverhd.h, include/leon.h, start/.cvsignore, start/Makefile.am, startup/.cvsignore, startup/Makefile.am, startup/boardinit.S, startup/linkcmds, startup/setvec.c, startup/spurious.c, timer/.cvsignore, timer/Makefile.am, timer/timer.c, tools/.cvsignore, tools/Makefile.am, tools/configure.in, tools/runtest.in, wrapup/.cvsignore, wrapup/Makefile.am: New file.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/sparc/leon/startup/boardinit.S64
1 files changed, 64 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon/startup/boardinit.S b/c/src/lib/libbsp/sparc/leon/startup/boardinit.S
new file mode 100644
index 0000000000..54fa6f576b
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon/startup/boardinit.S
@@ -0,0 +1,64 @@
+/*
+ * boardinit.s
+ *
+ * Start code for the LEON.
+ *
+ * $Id$
+ */
+
+#include <asm.h>
+#include <leon.h>
+
+ .global __bsp_board_init
+
+__bsp_board_init:
+
+/* Check if LEON is initialised. If not, this means that we are
+ running on the simulator. Initiate some of the parameters
+ that are done by the boot-prom otherwise.
+*/
+
+ set SYM(LEON_REG), %l0 ! %l0 = base address of peripherals
+ ld [%l0+LEON_REG_CACHECTRL_OFFSET], %l1 ! Check if LEON has been initialised
+ andcc %l1, 3, %g0
+ bne 2f
+ nop
+
+
+ flush
+ set 0x1000f, %l1
+ st %l1, [%l0 + LEON_REG_CACHECTRL_OFFSET] ! enable caches
+ ld [%l0 + LEON_REG_SIM_ROM_SIZE_OFFSET], %g1 ! load simulator rom size
+ clr %l2
+ srl %g1, 13, %g1 ! calculate appropriate rom size
+1:
+ srl %g1, 1, %g1
+ tst %g1
+ bne,a 1b
+ inc %l2
+ sll %l2, 14, %l2
+ st %l2, [%l0 + LEON_REG_MEMCFG1_OFFSET] ! set prom size in memcfg1
+
+ set 0, %l2
+ ld [%l0 + LEON_REG_SIM_RAM_SIZE_OFFSET], %g2 ! load simulator ram size
+ srl %g2, 13, %g1 ! calculate appropriate ram size
+1:
+ srl %g1, 1, %g1
+ tst %g1
+ bne,a 1b
+ inc %l2
+ sll %l2, 9, %l2
+ st %l2, [%l0 + LEON_REG_MEMCFG2_OFFSET] ! set ram size in memcfg2
+
+ set SYM(RAM_START), %l1 ! Cannot use RAM_END due to bug in linker
+ set SYM(RAM_SIZE), %l2
+ add %l1, %l2, %sp
+ set 49, %l2
+ st %l2, [%l0 + LEON_REG_SCALER_LOAD_OFFSET] ! scaler reload register
+ st %l2, [%l0 + LEON_REG_SCALERCNT_OFFSET] ! scaler counter register
+
+2:
+ retl
+ nop
+
+/* end of file */