summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c
diff options
context:
space:
mode:
authorThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2008-09-22 11:30:09 +0000
committerThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2008-09-22 11:30:09 +0000
commit5aeed173cf2cbdd7c003ce6f67658e274efc9b05 (patch)
tree4b6663898770eb47d745e61f421b43a2d725dc6f /c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c
parentlpc24xx: New BSP (diff)
downloadrtems-5aeed173cf2cbdd7c003ce6f67658e274efc9b05.tar.bz2
lpc24xx: new BSP
Diffstat (limited to 'c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c')
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c b/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c
new file mode 100644
index 0000000000..5317f6560a
--- /dev/null
+++ b/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c
@@ -0,0 +1,88 @@
+/**
+ * @file
+ *
+ * @ingroup lpc24xx
+ *
+ * @brief Startup code.
+ */
+
+/*
+ * Copyright (c) 2008
+ * Embedded Brains GmbH
+ * Obere Lagerstr. 30
+ * D-82178 Puchheim
+ * Germany
+ * rtems@embedded-brains.de
+ *
+ * The license and distribution terms for this file may be found in the file
+ * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
+ */
+
+#include <string.h>
+
+#include <bsp.h>
+#include <bsp/bootcard.h>
+#include <bsp/irq.h>
+#include <bsp/linker-symbols.h>
+#include <bsp/lpc24xx.h>
+#include <bsp/start.h>
+#include <bsp/system-clocks.h>
+
+void bsp_start_hook_0( void)
+{
+ /* Re-map interrupt vectors to internal RAM */
+ SET_MEMMAP_MAP( MEMMAP, 2);
+}
+
+void bsp_start_hook_1( void)
+{
+ unsigned zero = 0;
+ unsigned *out = bsp_section_bss_start;
+
+ /* Clear BSS */
+ while (out < bsp_section_bss_end) {
+ *out = zero;
+ ++out;
+ }
+}
+
+void bsp_start( void)
+{
+ printk( "CPU Clock: %u\n", lpc24xx_cclk());
+
+ /* Exceptions */
+ rtems_exception_init_mngt();
+
+ /* Interrupts */
+ if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
+ /* FIXME */
+ printk( "Cannot intitialize interrupt support\n");
+ while (1) {
+ /* Spin forever */
+ }
+ }
+}
+
+void bsp_reset( void)
+{
+ /* Do nothing */
+}
+
+#define ULSR_THRE 0x00000020U
+
+static void my_BSP_output_char( char c)
+{
+ while (REG_FLAG_IS_CLEARED( U0LSR, ULSR_THRE)) {
+ /* Wait */
+ }
+ U0THR = c;
+
+ if (c == '\n') {
+ while (REG_FLAG_IS_CLEARED( U0LSR, ULSR_THRE)) {
+ /* Wait */
+ }
+ U0THR = '\r';
+ }
+}
+
+BSP_output_char_function_type BSP_output_char = my_BSP_output_char;