summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-22 21:50:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-22 21:50:15 +0000
commit87b9739e9881148ee2fc1a9a852f09b18aaef11d (patch)
tree61f8b1fbfb9ae81c635a19d19fdfe86835d69f78 /c
parent2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-87b9739e9881148ee2fc1a9a852f09b18aaef11d.tar.bz2
2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, console/console.c, include/bsp.h, startup/bspstart.c: Use standardized bsp_cleanup() which can optionally print a message, poll for user to press key, and call bsp_reset(). Using this eliminates the various bsp_cleanup() implementations which had their own implementation and variety of string constants. * startup/bspreset.c: New file. * startup/bspclean.c: Removed.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/ChangeLog11
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/Makefile.am3
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/configure.ac12
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/console/console.c19
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/include/bsp.h4
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c51
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/startup/bspreset.c32
-rw-r--r--c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c4
8 files changed, 76 insertions, 60 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen5200/ChangeLog b/c/src/lib/libbsp/powerpc/gen5200/ChangeLog
index 3ba328df10..7587a3fbcf 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/gen5200/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac, console/console.c, include/bsp.h,
+ startup/bspstart.c: Use standardized bsp_cleanup() which can
+ optionally print a message, poll for user to press key, and call
+ bsp_reset(). Using this eliminates the various bsp_cleanup()
+ implementations which had their own implementation and variety of
+ string constants.
+ * startup/bspreset.c: New file.
+ * startup/bspclean.c: Removed.
+
2008-09-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
* startup/linkcmds.base: Fixed wrong section size symbols.
diff --git a/c/src/lib/libbsp/powerpc/gen5200/Makefile.am b/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
index 3ae1ea9324..91b529c1ca 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/gen5200/Makefile.am
@@ -104,7 +104,8 @@ startup_SOURCES = ../../shared/bootcard.c \
../shared/showbats.c \
../shared/uboot_dump_bdinfo.c \
../shared/uboot_getenv.c \
- startup/bspclean.c \
+ ../../shared/bspclean.c \
+ startup/bspreset.c \
../../shared/bspgetworkarea.c \
startup/bspstart.c \
startup/cpuinit.c \
diff --git a/c/src/lib/libbsp/powerpc/gen5200/configure.ac b/c/src/lib/libbsp/powerpc/gen5200/configure.ac
index 8898471c24..da701759bc 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/configure.ac
+++ b/c/src/lib/libbsp/powerpc/gen5200/configure.ac
@@ -29,10 +29,22 @@ RTEMS_BSPOPTS_SET([BENCHMARK_IRQ_PROCESSING],[*],[0])
RTEMS_BSPOPTS_HELP([BENCHMARK_IRQ_PROCESSING],
[If defined, enable code to benchmark IRQ processing.])
+RTEMS_BSPOPTS_SET([ALLOW_IRQ_NESTING],[icecube],[0])
RTEMS_BSPOPTS_SET([ALLOW_IRQ_NESTING],[*],[1])
RTEMS_BSPOPTS_HELP([ALLOW_IRQ_NESTING],
[If defined, allow nested IRQ processing.])
+RTEMS_BSPOPTS_SET([BSP_PRESS_KEY_FOR_RESET],[icecube],[1])
+RTEMS_BSPOPTS_SET([BSP_PRESS_KEY_FOR_RESET],[*],[0])
+RTEMS_BSPOPTS_HELP([BSP_PRESS_KEY_FOR_RESET],
+[If defined, print a message and wait until pressed before resetting
+ board when application exits.])
+
+RTEMS_BSPOPTS_SET([BSP_RESET_BOARD_AT_EXIT],[icecube],[1])
+RTEMS_BSPOPTS_SET([BSP_RESET_BOARD_AT_EXIT],[*],[0])
+RTEMS_BSPOPTS_HELP([BSP_RESET_BOARD_AT_EXIT],
+[If defined, reset the board when the application exits.])
+
RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
diff --git a/c/src/lib/libbsp/powerpc/gen5200/console/console.c b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
index 0a33b2fdff..34e38886e4 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
@@ -142,8 +142,11 @@ uint32_t mpc5200_uart_avail_mask = GEN5200_UART_AVAIL_MASK;
#endif
static void A_BSP_output_char(char c);
+static int A_BSP_get_char(void);
BSP_output_char_function_type BSP_output_char = A_BSP_output_char;
+BSP_polling_getchar_function_type BSP_poll_char = A_BSP_get_char;
+
/* Used to handle premature outputs of printk */
uint32_t console_initialized = FALSE;
@@ -625,7 +628,7 @@ static void A_BSP_output_char(
* and we can just poll bytes out at any time.
*/
#if !defined(HAS_UBOOT)
- if (console_initialized == FALSE )
+ if (console_initialized == FALSE)
return;
#endif
@@ -637,6 +640,20 @@ static void A_BSP_output_char(
PRINTK_WRITE( PRINTK_MINOR, &cr, 1 );
}
+static int A_BSP_get_char(void)
+{
+ /*
+ * If we are using U-Boot, then the console is already initialized
+ * and we can just poll bytes in at any time.
+ */
+ #if !defined(HAS_UBOOT)
+ if (console_initialized == FALSE)
+ return;
+ #endif
+
+ return mpc5200_uart_pollRead(0);
+}
+
/*
***************
* BOILERPLATE *
diff --git a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
index 4e3153f28e..2ce065139a 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
@@ -120,10 +120,6 @@ LINKER_SYMBOL(MBAR);
/* we only have PSC1 */
#define GEN5200_UART_AVAIL_MASK 0x01
-/* We want to prompt for a reset and then reset the board */
-#define BSP_PRESS_KEY_FOR_RESET 1
-#define BSP_RESET_BOARD_AT_EXIT 1
-
#else
#error "board type not defined"
#endif
diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c
deleted file mode 100644
index b5a14bda78..0000000000
--- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspclean.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * COPYRIGHT (c) 1989-2008.
- * 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.com/license/LICENSE.
- *
- * $Id$
- */
-
-#include <rtems.h>
-#include <rtems/bspIo.h>
-#include <bsp.h>
-#include <bsp/mpc5200.h>
-#include <bsp/bootcard.h>
-
-extern int mpc5200_uart_pollRead(int minor);
-
-void bsp_cleanup( void )
-{
-
- #if (BENCHMARK_IRQ_PROCESSING == 1)
- {
- BSP_IRQ_Benchmarking_Report();
- }
- #endif
-
- #if defined(BSP_PRESS_KEY_FOR_RESET)
- printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." );
-
- /*
- * Wait for a key to be pressed
- */
- while ( mpc5200_uart_pollRead(0) == -1 ) ;
- #endif
-
- /*
- * Check both conditions -- if you want to ask for reboot, then
- * you must have meant to reset the board.
- */
- #if defined(BSP_PRESS_KEY_FOR_RESET) || defined(BSP_RESET_BOARD_AT_EXIT)
- /*
- * Now reset the CPU
- */
- _ISR_Set_level( 0 );
-
- mpc5200.gpt[0].count_in = 0xf;
- mpc5200.gpt[0].emsel = 0x9004;
- #endif
-}
diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspreset.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspreset.c
new file mode 100644
index 0000000000..4690b2a168
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspreset.c
@@ -0,0 +1,32 @@
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include <bsp/mpc5200.h>
+#include <bsp/bootcard.h>
+
+void bsp_reset( void )
+{
+ #if (BENCHMARK_IRQ_PROCESSING == 1)
+ {
+ BSP_IRQ_Benchmarking_Report();
+ }
+ #endif
+
+ /*
+ * Now reset the CPU
+ */
+ _ISR_Set_level( 0 );
+
+ mpc5200.gpt[0].count_in = 0xf;
+ mpc5200.gpt[0].emsel = 0x9004;
+}
diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
index d81133229d..d1df3ef0e1 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
@@ -156,7 +156,7 @@ void bsp_start(void)
cpu_init();
- bsp_clicks_per_usec = (IPB_CLOCK/1000000);
+ bsp_clicks_per_usec = (IPB_CLOCK/1000000);
/*
* Enable instruction and data caches. Do not force writethrough mode.
@@ -192,7 +192,6 @@ void bsp_start(void)
#ifdef SHOW_MORE_INIT_SETTINGS
printk("Exit from bspstart\n");
#endif
-
}
/*
@@ -213,4 +212,3 @@ Thread _Thread_Idle_body(uint32_t ignored)
}
return 0;
}
-