summaryrefslogtreecommitdiffstats
path: root/bsps/powerpc/ss555/start/bspstart.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/powerpc/ss555/start/bspstart.c')
-rw-r--r--bsps/powerpc/ss555/start/bspstart.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/bsps/powerpc/ss555/start/bspstart.c b/bsps/powerpc/ss555/start/bspstart.c
new file mode 100644
index 0000000000..f47ca7d5be
--- /dev/null
+++ b/bsps/powerpc/ss555/start/bspstart.c
@@ -0,0 +1,97 @@
+/*
+ * This routine does the bulk of the system initialization.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ *
+ * SS555 port sponsored by Defence Research and Development Canada - Suffield
+ * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
+ *
+ * Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c:
+ *
+ * Modifications for MBX860:
+ * Copyright (c) 1999, National Research Council of Canada
+ */
+
+#include <rtems/bspIo.h>
+#include <rtems/counter.h>
+#include <bsp/bootcard.h>
+#include <rtems/powerpc/powerpc.h>
+
+#include <libcpu/cpuIdent.h>
+#include <libcpu/spr.h>
+
+#include <bsp/irq.h>
+#include <bsp.h>
+
+SPR_RW(SPRG1)
+
+extern unsigned long intrStackPtr;
+
+/*
+ * Driver configuration parameters
+ */
+uint32_t bsp_clicks_per_usec;
+uint32_t bsp_clock_speed; /* Serial clocks per second */
+
+/*
+ * bsp_start()
+ *
+ * Board-specific initialization code. Called from the generic boot_card()
+ * function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
+ * does some of the board independent initialization. It is called from the
+ * SS555 entry point _start() defined in
+ * rtems/c/src/lib/libbsp/powerpc/ss555/start/start.S
+ *
+ * _start() has set up a stack, has zeroed the .bss section, has set up the
+ * .data section from contents stored in ROM, has turned off interrupts,
+ * and placed the processor in the supervisor mode. boot_card() has left
+ * the processor in that state when bsp_start() was called.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * Return values: NONE
+ */
+void bsp_start(void)
+{
+ register unsigned char* intrStack;
+
+ /*
+ * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
+ * function stores the result in global variables so that it can be used
+ * later.
+ */
+ get_ppc_cpu_type();
+ get_ppc_cpu_revision();
+
+ /*
+ * Initialize some SPRG registers related to irq handling
+ */
+ intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
+ _write_SPRG1((unsigned int)intrStack);
+
+ /*
+ * Install our own set of exception vectors
+ */
+ initialize_exceptions();
+
+ /*
+ * initialize the device driver parameters
+ */
+ bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
+ bsp_clock_speed = BSP_CLOCK_HZ; /* for SCI baud rate generator */
+ rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
+
+ /*
+ * Initalize RTEMS IRQ system
+ */
+ BSP_rtems_irq_mng_init(0);
+}