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.
This commit is contained in:
Joel Sherrill
2008-09-22 21:50:15 +00:00
parent 872645dc2c
commit 87b9739e98
8 changed files with 76 additions and 60 deletions

View File

@@ -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.

View File

@@ -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 \

View File

@@ -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")

View File

@@ -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 *

View File

@@ -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

View File

@@ -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
}

View File

@@ -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;
}

View File

@@ -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;
}