From 34e9f2ac32fa845974a57d1ad969e3bf14093720 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 22 Sep 2008 21:49:15 +0000 Subject: 2008-09-22 Joel Sherrill * Makefile.am, configure.ac, 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. --- c/src/lib/libbsp/arm/csb337/ChangeLog | 10 +++++++ c/src/lib/libbsp/arm/csb337/Makefile.am | 3 +- c/src/lib/libbsp/arm/csb337/configure.ac | 9 ++++++ c/src/lib/libbsp/arm/csb337/startup/bspclean.c | 38 -------------------------- c/src/lib/libbsp/arm/csb337/startup/bspreset.c | 29 ++++++++++++++++++++ c/src/lib/libbsp/arm/csb337/startup/bspstart.c | 18 ------------ 6 files changed, 50 insertions(+), 57 deletions(-) delete mode 100644 c/src/lib/libbsp/arm/csb337/startup/bspclean.c create mode 100644 c/src/lib/libbsp/arm/csb337/startup/bspreset.c diff --git a/c/src/lib/libbsp/arm/csb337/ChangeLog b/c/src/lib/libbsp/arm/csb337/ChangeLog index 11ddbae629..f66e3c2eeb 100644 --- a/c/src/lib/libbsp/arm/csb337/ChangeLog +++ b/c/src/lib/libbsp/arm/csb337/ChangeLog @@ -1,3 +1,13 @@ +2008-09-22 Joel Sherrill + + * Makefile.am, configure.ac, 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-19 Joel Sherrill * Makefile.am, startup/linkcmds: Use top level shared diff --git a/c/src/lib/libbsp/arm/csb337/Makefile.am b/c/src/lib/libbsp/arm/csb337/Makefile.am index a835e38e9f..be74e76fae 100644 --- a/c/src/lib/libbsp/arm/csb337/Makefile.am +++ b/c/src/lib/libbsp/arm/csb337/Makefile.am @@ -27,7 +27,8 @@ dist_project_lib_DATA += startup/linkcmds startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \ ../../shared/bsppredriverhook.c ../../shared/bspgetworkarea.c \ - ../../shared/bsppretaskinghook.c startup/bspstart.c startup/bspclean.c \ + ../../shared/bsppretaskinghook.c startup/bspstart.c \ + ../../shared/bspclean.c startup/bspreset.c \ startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \ ../../shared/gnatinstallhandler.c console_SOURCES = console/uarts.c ../../shared/console.c diff --git a/c/src/lib/libbsp/arm/csb337/configure.ac b/c/src/lib/libbsp/arm/csb337/configure.ac index 121761c352..c350d05626 100644 --- a/c/src/lib/libbsp/arm/csb337/configure.ac +++ b/c/src/lib/libbsp/arm/csb337/configure.ac @@ -18,6 +18,15 @@ RTEMS_PROG_CCAS RTEMS_CHECK_NETWORKING AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") +RTEMS_BSPOPTS_SET([BSP_PRESS_KEY_FOR_RESET],[*],[1]) +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],[*],[1]) +RTEMS_BSPOPTS_HELP([BSP_RESET_BOARD_AT_EXIT], +[If defined, reset the board when the application exits.]) + RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION # Explicitly list all Makefiles here diff --git a/c/src/lib/libbsp/arm/csb337/startup/bspclean.c b/c/src/lib/libbsp/arm/csb337/startup/bspclean.c deleted file mode 100644 index c97f462dc9..0000000000 --- a/c/src/lib/libbsp/arm/csb337/startup/bspclean.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Cogent CSB337 Shutdown code - * - * Copyright (c) 2004 by Jay Monkman - * - * 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 -#include -#include -#include - -int dbgu_poll_read(int); - -void rtemsReboot (void) -{ - asm volatile ("b _start"); -} - -void bsp_cleanup(void) -{ - static char line[]="\nEXECUTIVE SHUTDOWN! Any key to reboot..."; - /* - * AT this point, the console driver is disconnected => we must - * use polled output/input. This is exactly what printk - * does. - */ - printk("\n"); - printk(line); - while (dbgu_poll_read(0) < 0) continue; -} diff --git a/c/src/lib/libbsp/arm/csb337/startup/bspreset.c b/c/src/lib/libbsp/arm/csb337/startup/bspreset.c new file mode 100644 index 0000000000..8a47d077db --- /dev/null +++ b/c/src/lib/libbsp/arm/csb337/startup/bspreset.c @@ -0,0 +1,29 @@ +/* + * Cogent CSB337 - AT91RM9200 Startup code + * + * Copyright (c) 2004 by Cogent Computer Systems + * Written by Jay Monkman + * + * 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 +#include +#include +#include + +void bsp_reset(void) +{ + rtems_interrupt_level level; + + rtems_interrupt_disable(level); + + /* Enable the watchdog timer, then wait for the world to end. */ + ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1; + + while(1); +} diff --git a/c/src/lib/libbsp/arm/csb337/startup/bspstart.c b/c/src/lib/libbsp/arm/csb337/startup/bspstart.c index e3d795d9c3..209588ea1d 100644 --- a/c/src/lib/libbsp/arm/csb337/startup/bspstart.c +++ b/c/src/lib/libbsp/arm/csb337/startup/bspstart.c @@ -101,21 +101,3 @@ static void fix_mac_addr(void) * can override the actual bsp_start routine used. */ void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); - -/* - * Reset the system. - * - * This functions enables the watchdog and waits for it to - * fire, thus resetting the system. - */ -void bsp_reset(void) -{ - rtems_interrupt_level level; - - rtems_interrupt_disable(level); - - /* Enable the watchdog timer, then wait for the world to end. */ - ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1; - - while(1); -} -- cgit v1.2.3