summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_st.c
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2006-05-13 23:41:16 +0000
committercognet <cognet@FreeBSD.org>2006-05-13 23:41:16 +0000
commit2e58b619628d5c8e5ecbe445140aade714d9c2f3 (patch)
treead2cd12970015c6c1b03b6f9f087319ea6f2e34f /sys/arm/at91/at91_st.c
parent456f2593a536e19a6666580ad6ede280d3e7459e (diff)
downloadFreeBSD-src-2e58b619628d5c8e5ecbe445140aade714d9c2f3.zip
FreeBSD-src-2e58b619628d5c8e5ecbe445140aade714d9c2f3.tar.gz
Resurrect Skyeye support :
Add a new option, SKYEYE_WORKAROUNDS, which as the name suggests adds workarounds for things skyeye doesn't simulate. Specifically : - Use USART0 instead of DBGU as the console, make it not use DMA, and manually provoke an interrupt when we're done in the transmit function. - Skyeye maintains an internal counter for clock, but apparently there's no way to access it, so hack the timecounter code to return a value which is increased at every clock interrupts. This is gross, but I didn't find a better way to implement timecounters without hacking Skyeye to get the counter value. - Force the write-back of PTEs once we're done writing them, even if they are supposed to be write-through. I don't know why I have to do that.
Diffstat (limited to 'sys/arm/at91/at91_st.c')
-rw-r--r--sys/arm/at91/at91_st.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/arm/at91/at91_st.c b/sys/arm/at91/at91_st.c
index 1960e61..10cccc3 100644
--- a/sys/arm/at91/at91_st.c
+++ b/sys/arm/at91/at91_st.c
@@ -72,7 +72,11 @@ static unsigned at91st_get_timecount(struct timecounter *tc);
static struct timecounter at91st_timecounter = {
at91st_get_timecount, /* get_timecount */
NULL, /* no poll_pps */
+#ifdef SKYEYE_WORKAROUNDS
+ 0xffffffffu, /* counter_mask */
+#else
0xfffffu, /* counter_mask */
+#endif
32768, /* frequency */
"AT91RM9200 timer", /* name */
0 /* quality */
@@ -122,10 +126,18 @@ static devclass_t at91st_devclass;
DRIVER_MODULE(at91_st, atmelarm, at91st_driver, at91st_devclass, 0, 0);
+#ifdef SKYEYE_WORKAROUNDS
+static unsigned long tot_count = 0;
+#endif
+
static unsigned
at91st_get_timecount(struct timecounter *tc)
{
+#ifdef SKYEYE_WORKAROUNDS
+ return (tot_count);
+#else
return (st_crtr());
+#endif
}
static void
@@ -134,8 +146,12 @@ clock_intr(void *arg)
struct trapframe *fp = arg;
/* The interrupt is shared, so we have to make sure it's for us. */
- if (RD4(ST_SR) & ST_SR_PITS)
+ if (RD4(ST_SR) & ST_SR_PITS) {
+#ifdef SKYEYE_WORKAROUNDS
+ tot_count += 32768 / hz;
+#endif
hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp));
+ }
}
void
OpenPOWER on IntegriCloud