diff options
author | danicampora <danicampora@gmail.com> | 2015-03-14 09:59:47 +0100 |
---|---|---|
committer | danicampora <danicampora@gmail.com> | 2015-03-14 10:08:47 +0100 |
commit | 2c103d5200ec513dc0e5ffb9925a345a5ffaad06 (patch) | |
tree | aeae3f1d9524cc875df53f06924ff4ce2f5e2dff /cc3200/misc/mperror.c | |
parent | d432bcb9acb7105274c10c6b4bee3736a1a690b5 (diff) |
cc3200: Rewrite the PRCM RTC functionality methods.
This allows to use the On-Chip retention registers for both the
RTC and to share notification flags between the bootloader and the
application. The two flags being shared right now are the "safe boot"
request and the WDT reset cause. we still have 2 more bits free for
future use.
Diffstat (limited to 'cc3200/misc/mperror.c')
-rw-r--r-- | cc3200/misc/mperror.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/cc3200/misc/mperror.c b/cc3200/misc/mperror.c index a1c35421e..85ed0a646 100644 --- a/cc3200/misc/mperror.c +++ b/cc3200/misc/mperror.c @@ -56,8 +56,6 @@ #define MPERROR_HEARTBEAT_ON_MS (80) #define MPERROR_HEARTBEAT_OFF_MS (4920) -#define MPERROR_SAFE_BOOT_REG_IDX (0) - /****************************************************************************** DECLARE PRIVATE DATA ******************************************************************************/ @@ -102,7 +100,7 @@ void mperror_init0 (void) { mperror_heart_beat.beating = false; } -void mperror_check_reset_cause (void) { +void mperror_bootloader_check_reset_cause (void) { // if we are recovering from a WDT reset, trigger // a hibernate cycle for a clean boot if (MAP_PRCMSysResetCauseGet() == PRCM_WDT_RESET) { @@ -115,6 +113,10 @@ void mperror_check_reset_cause (void) { UtilsDelay(800); HWREG(0x4402F024) &= 0xF7FFFFFF; + // since the reset cause will be changed, we must store the right reason + // so that the application knows we booting the next time + PRCMSignalWDTReset(); + MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR); // set the sleep interval to 10ms MAP_PRCMHibernateIntervalSet(330); @@ -136,21 +138,6 @@ void mperror_signal_error (void) { } } -void mperror_request_safe_boot (void) { - MAP_PRCMOCRRegisterWrite(MPERROR_SAFE_BOOT_REG_IDX, 1); -} - -void mperror_clear_safe_boot (void) { - MAP_PRCMOCRRegisterWrite(MPERROR_SAFE_BOOT_REG_IDX, 0); -} - -// returns the last state of the safe boot request and clears the register -bool mperror_safe_boot_requested (void) { - bool ret = MAP_PRCMOCRRegisterRead(MPERROR_SAFE_BOOT_REG_IDX); - mperror_clear_safe_boot(); - return ret; -} - void mperror_enable_heartbeat (void) { mperror_heart_beat.enabled = true; } |