summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-22 21:50:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-22 21:50:54 +0000
commit54cf1198e320e1a67efe501efed98290d24b582d (patch)
tree566dc713aae7891cdb70ecf2ab812ad049a17efc /c
parent2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-54cf1198e320e1a67efe501efed98290d24b582d.tar.bz2
2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* bspclean.c, include/bootcard.h: 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. * bspreset.c, bspreset_fatal.c, bspreset_loop.c: New files.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/shared/ChangeLog9
-rw-r--r--c/src/lib/libbsp/shared/bspclean.c25
-rw-r--r--c/src/lib/libbsp/shared/bspreset.c19
-rw-r--r--c/src/lib/libbsp/shared/bspreset_fatal.c17
-rw-r--r--c/src/lib/libbsp/shared/bspreset_loop.c19
-rw-r--r--c/src/lib/libbsp/shared/include/bootcard.h2
6 files changed, 91 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog
index b4ee54d914..07275db6d6 100644
--- a/c/src/lib/libbsp/shared/ChangeLog
+++ b/c/src/lib/libbsp/shared/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * bspclean.c, include/bootcard.h: 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.
+ * bspreset.c, bspreset_fatal.c, bspreset_loop.c: New files.
+
2008-09-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
* clockdrv_shell.c: Install_clock has now static linkage. Initialize
diff --git a/c/src/lib/libbsp/shared/bspclean.c b/c/src/lib/libbsp/shared/bspclean.c
index c3651736db..142988cf31 100644
--- a/c/src/lib/libbsp/shared/bspclean.c
+++ b/c/src/lib/libbsp/shared/bspclean.c
@@ -11,6 +11,31 @@
* $Id$
*/
+#include <rtems.h>
+#include <rtems/bspIo.h>
+#include <bsp.h>
+#include <bspopts.h>
+#include <bsp/bootcard.h>
+
void bsp_cleanup( void )
{
+ #if (BSP_PRESS_KEY_FOR_RESET)
+ printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." );
+
+ /*
+ * Wait for a key to be pressed
+ */
+ while ( getchark() == -1 )
+ ;
+
+ printk("\n");
+ #endif
+
+ /*
+ * Check both conditions -- if you want to ask for reboot, then
+ * you must have meant to reset the board.
+ */
+ #if (BSP_PRESS_KEY_FOR_RESET) || (BSP_RESET_BOARD_AT_EXIT)
+ bsp_reset();
+ #endif
}
diff --git a/c/src/lib/libbsp/shared/bspreset.c b/c/src/lib/libbsp/shared/bspreset.c
new file mode 100644
index 0000000000..f2cf27829e
--- /dev/null
+++ b/c/src/lib/libbsp/shared/bspreset.c
@@ -0,0 +1,19 @@
+/*
+ * This is a dummy bsp_reset routine.
+ *
+ * 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/bootcard.h>
+
+void bsp_reset( void )
+{
+}
diff --git a/c/src/lib/libbsp/shared/bspreset_fatal.c b/c/src/lib/libbsp/shared/bspreset_fatal.c
new file mode 100644
index 0000000000..fc85968295
--- /dev/null
+++ b/c/src/lib/libbsp/shared/bspreset_fatal.c
@@ -0,0 +1,17 @@
+/*
+ * 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>
+
+void bsp_reset( void )
+{
+ rtems_fatal_error_occurred(0);
+}
diff --git a/c/src/lib/libbsp/shared/bspreset_loop.c b/c/src/lib/libbsp/shared/bspreset_loop.c
new file mode 100644
index 0000000000..e3e9029ee6
--- /dev/null
+++ b/c/src/lib/libbsp/shared/bspreset_loop.c
@@ -0,0 +1,19 @@
+/*
+ * 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/bootcard.h>
+
+void bsp_reset( void )
+{
+ while (1)
+ ;
+}
diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h
index 7960005382..15db611de6 100644
--- a/c/src/lib/libbsp/shared/include/bootcard.h
+++ b/c/src/lib/libbsp/shared/include/bootcard.h
@@ -46,6 +46,8 @@ void bsp_postdriver_hook(void);
void bsp_cleanup(void);
+void bsp_reset(void);
+
#ifdef BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL