so we have two copier routines one for each half.
- Control key debugging
+ - Review and test signal handling paths more
- AtomIDE driver (prob need minimal copiers in high stubs)
- RTC driver
- Serial driver
Filesystem on Atomlite. If using simcoupe dd it 534 bytes into the image
Select device 0 for boot to get atomlite (you can do partitions)
-
DONE - Crashes on interrupt preempt (Fixed I hope)
DONE - Fix signal handling crashes ( ditto )
DONE - Run out of pages - suggests child exit/bank32 isn't cleaning
#include <kernel.h>
#include <kdata.h>
+#include <printf.h>
#include <rtc.h>
#include <msm6242b.h>
static uint8_t rtc_buf[6];
-static uint8_t samrtc = 0;
+uint8_t samrtc;
uint8_t platform_rtc_secs(void)
{
do {
r = samrtc_in(0);
- v = samrtc_in(1);
+ v = samrtc_in(0x10);
} while (r != samrtc_in(0));
return v * 10 + r;
uint8_t *p = rtc_buf;
uint8_t n = 0;
- while(n < 12) {
- *p++ = samrtc_in(n) | (samrtc_in(n + 1) << 4);
- n += 2;
+ while(n < 0xC0) {
+ *p++ = samrtc_in(n) | (samrtc_in(n + 0x10) << 4);
+ n += 0x20;
}
}
uint8_t *p = cmos.data.bytes;
if (!samrtc) {
+ kputs("nortc\n");
udata.u_error = -EOPNOTSUPP;
return -1;
}
read_clock();
y = rtc_buf[5];
- /* 1980 based year , if its 0x20 or more we are in 2000-2079 and
- need to adjust the clock up by 2000 and back by 10. If not well
- then its 1980-1999 so just needs 0x1980 adding to the 0-9 we have */
- if (y >= 0x20)
- y += 0x19F0;
- else
- y += 0x1980;
- *p++ = y >> 8;
+ /* Year is the low 2 digits. We work on the basis that it's past
+ 2000 now so just assume 20xx */
+ *p++ = 0x20;
*p++ = y;
- *p++ = rtc_buf[4]; /* month */
+ *p++ = rtc_buf[4] - 1; /* month (convert from 1 based) */
*p++ = rtc_buf[3]; /* day */
*p++ = rtc_buf[2]; /* Hour */
*p++ = rtc_buf[1]; /* Minute */
{
uint8_t r;
+ if (samrtc)
+ return 1;
+
for (r = 0; r < 12; r++) {
if (samrtc_in(r) > 9)
return 0;
}
/* Now play with 24 hour mode */
- r = samrtc_in(15);
+ r = samrtc_in(0xF0);
r &= ~4;
- samrtc_out(15 | (r << 8));
- if (samrtc_in(15) != r)
+ samrtc_out(0xF0 | (r << 8));
+ if (samrtc_in(0xF0) != r)
return 0;
r |= 4; /* 24 hour */
- samrtc_out(15 | (r << 8));
- if (samrtc_in(15) != r)
+ samrtc_out(0xF0 | (r << 8));
+ if (samrtc_in(0xF0) != r)
return 0;
/* Looks like we have a valid Sam RTC */
samrtc = 1;