2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>

* Makefile.am, console/console.c, include/bsp.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.
	* startup/bspreset.c: New file.
	* startup/bspclean.c: Removed.
This commit is contained in:
Joel Sherrill
2008-09-22 21:50:17 +00:00
parent 87b9739e98
commit 2fb1805ab6
6 changed files with 55 additions and 85 deletions

View File

@@ -1,3 +1,13 @@
2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, console/console.c, include/bsp.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.
* startup/bspreset.c: New file.
* startup/bspclean.c: Removed.
2008-09-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/bsp.h, network/network.c: Fix missed name change.

View File

@@ -53,7 +53,8 @@ startup_SOURCES = ../../shared/bsplibc.c \
../shared/src/tictac.c \
startup/cpuinit.c \
startup/bspstart.c \
startup/bspclean.c \
../../shared/bspclean.c \
startup/bspreset.c \
../../shared/bspgetworkarea.c \
startup/uboot_support.c \
../shared/uboot_getenv.c

View File

@@ -277,3 +277,10 @@ int bsp_uart_pollRead(int minor)
{
return Console_Port_Tbl [0].pDeviceFns->deviceRead(0);
}
int bsp_get_char(void)
{
return bsp_uart_pollRead(0);
}
BSP_polling_getchar_function_type BSP_poll_char = bsp_get_char;

View File

@@ -32,10 +32,6 @@
#define CONFIG_MPC83XX
#define CONFIG_HAS_ETH1
/* 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
#endif /* MPC8313ERDB */
#include <libcpu/powerpc-utility.h>
@@ -98,8 +94,6 @@ extern const size_t bsp_uboot_board_info_size;
#endif /* HAS_UBOOT */
#define MUST_WAIT_FOR_INTERRUPT 0
#define BSP_UART1_MINOR 0
#define BSP_UART2_MINOR 1

View File

@@ -1,78 +0,0 @@
/**
* @file
*
* @ingroup mpc83xx
*
* @brief Source for BSP 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.
*
* $Id$
*/
#include <string.h>
#include <rtems.h>
#include <rtems/bspIo.h>
#include <bsp.h>
#include <bsp/bootcard.h>
extern int bsp_uart_pollRead(int minor);
void bsp_reset(void)
{
#ifdef MPC8313ERDB
_ISR_Set_level( 0 );
/* Set Reset Protection Register (RPR) to "RSTE" */
mpc83xx.res.rpr = 0x52535445;
/*
* Wait for Control Register Enabled in the
* Reset Control Enable Register (RCER).
*/
while (mpc83xx.res.rcer != 0x00000001) {
/* Wait */
}
/* Set Software Hard Reset in the Reset Control Register (RCR) */
mpc83xx.res.rcr = 0x00000002;
#else /* MPC8313ERDB */
/* Do nothing */
#endif /* MPC8313ERDB */
}
void bsp_cleanup(void)
{
#if defined(BSP_PRESS_KEY_FOR_RESET)
printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." );
/*
* Wait for a key to be pressed
*/
while ( bsp_uart_pollRead(0) == -1 ) {
/* Wait */
}
#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)
bsp_reset();
#endif
}

View File

@@ -0,0 +1,36 @@
/*
* 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.
*
* $Id$
*/
#include <bsp.h>
#include <bsp/bootcard.h>
void bsp_reset(void)
{
_ISR_Set_level( 0 );
/* Set Reset Protection Register (RPR) to "RSTE" */
mpc83xx.res.rpr = 0x52535445;
/*
* Wait for Control Register Enabled in the
* Reset Control Enable Register (RCER).
*/
while (mpc83xx.res.rcer != 0x00000001) {
/* Wait */
}
/* Set Software Hard Reset in the Reset Control Register (RCR) */
mpc83xx.res.rcr = 0x00000002;
}