mpc83xx: Add and use mpc83xx_reset()

The inline version makes it possible to use this code in different
memory areas.
This commit is contained in:
Sebastian Huber
2013-03-11 17:54:34 +01:00
parent f88da30ee8
commit faad192675
2 changed files with 22 additions and 15 deletions

View File

@@ -14,21 +14,9 @@
#include <bsp.h>
#include <bsp/bootcard.h>
#include <mpc83xx/mpc83xx.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;
mpc83xx_reset();
}

View File

@@ -820,6 +820,25 @@ typedef struct m83xxRegisters_ {
extern m83xxRegisters_t mpc83xx;
static inline void mpc83xx_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;
}
#endif /* !defined ASM */
/*
* some definitions used in assembler startup