Tweak the RTC. It seems to not crash anymore. Doesn't mean it works though.
This commit is contained in:
parent
2693a33046
commit
b175ddb83f
|
@ -10,7 +10,7 @@
|
|||
#include "simpleio.h"
|
||||
#include "timers.h"
|
||||
|
||||
static long rtc_ticks;
|
||||
static unsigned long rtc_ticks;
|
||||
|
||||
/*
|
||||
* Interrupt handler for the real time clock
|
||||
|
@ -18,8 +18,8 @@ static long rtc_ticks;
|
|||
void rtc_handle_int() {
|
||||
unsigned char flags;
|
||||
|
||||
/* Periodic interrupt: increment the ticks counter */
|
||||
flags = *RTC_FLAGS;
|
||||
flags = *RTC_FLAGS; /* Acknowledge the interrupt */
|
||||
|
||||
rtc_ticks++;
|
||||
}
|
||||
|
||||
|
@ -31,30 +31,28 @@ void rtc_init() {
|
|||
unsigned char rates;
|
||||
unsigned char enables;
|
||||
|
||||
log(LOG_TRACE, "rtc_init");
|
||||
TRACE("rtc_init");
|
||||
|
||||
int_disable(INT_RTC);
|
||||
|
||||
/* Make sure the RTC is on */
|
||||
*RTC_CTRL = (*RTC_CTRL & 0x07) | RTC_STOP;
|
||||
*RTC_CTRL = RTC_STOP;
|
||||
|
||||
/*
|
||||
* For the moment: Every so often, the RTC interrupt gets acknowledged
|
||||
* without clearing the flags. Until I can sort out why, I will use
|
||||
* the SOF A interrupt as a surrogate for the RTC jiffie timer
|
||||
*/
|
||||
|
||||
#if !(MODEL == MODEL_FOENIX_C256U || MODEL == MODEL_FOENIX_C256U_PLUS || MODEL == MODEL_FOENIX_FMX)
|
||||
// /* Set the periodic interrupt to 15 millisecs */
|
||||
// *RTC_RATES = RTC_RATE_15ms;
|
||||
//
|
||||
// int_register(INT_RTC, rtc_handle_int);
|
||||
//
|
||||
// /* Enable the periodic interrupt */
|
||||
// flags = *RTC_FLAGS;
|
||||
// *RTC_ENABLES = RTC_PIE;
|
||||
// rtc_ticks = 0;
|
||||
//
|
||||
// int_enable(INT_RTC);
|
||||
*RTC_RATES = RTC_RATE_15ms;
|
||||
|
||||
int_register(INT_RTC, rtc_handle_int);
|
||||
rtc_ticks = 0;
|
||||
|
||||
/* Enable the periodic interrupt */
|
||||
rtc_enable_ticks();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -64,7 +62,7 @@ void rtc_enable_ticks() {
|
|||
/* Set the periodic interrupt to 15 millisecs */
|
||||
*RTC_RATES = RTC_RATE_15ms;
|
||||
|
||||
unsigned char flags = *RTC_FLAGS;
|
||||
unsigned char flags = *RTC_FLAGS; /* Acknowledge any previous interrupt before we start. */
|
||||
|
||||
*RTC_ENABLES = RTC_PIE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue