qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6206] ETRAX: Support timer count reads and correct frequencies.
@ 2009-01-07 13:24 Edgar E. Iglesias
  0 siblings, 0 replies; only message in thread
From: Edgar E. Iglesias @ 2009-01-07 13:24 UTC (permalink / raw)
  To: qemu-devel

Revision: 6206
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6206
Author:   edgar_igl
Date:     2009-01-07 13:24:40 +0000 (Wed, 07 Jan 2009)

Log Message:
-----------
ETRAX: Support timer count reads and correct frequencies.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

Modified Paths:
--------------
    trunk/hw/etraxfs_timer.c

Modified: trunk/hw/etraxfs_timer.c
===================================================================
--- trunk/hw/etraxfs_timer.c	2009-01-07 13:19:21 UTC (rev 6205)
+++ trunk/hw/etraxfs_timer.c	2009-01-07 13:24:40 UTC (rev 6206)
@@ -75,15 +75,6 @@
 	uint32_t r_masked_intr;
 };
 
-static uint32_t timer_rinvalid (void *opaque, target_phys_addr_t addr)
-{
-	struct fs_timer_t *t = opaque;
-	CPUState *env = t->env;
-	cpu_abort(env, "Unsupported short access. reg=" TARGET_FMT_plx "\n",
-		  addr);
-	return 0;
-}
-
 static uint32_t timer_readl (void *opaque, target_phys_addr_t addr)
 {
 	struct fs_timer_t *t = opaque;
@@ -91,9 +82,10 @@
 
 	switch (addr) {
 	case R_TMR0_DATA:
+		r = ptimer_get_count(t->ptimer_t0);
 		break;
 	case R_TMR1_DATA:
-		D(printf ("R_TMR1_DATA\n"));
+		r = ptimer_get_count(t->ptimer_t1);
 		break;
 	case R_TIME:
 		r = qemu_get_clock(vm_clock) / 10;
@@ -111,15 +103,6 @@
 	return r;
 }
 
-static void
-timer_winvalid (void *opaque, target_phys_addr_t addr, uint32_t value)
-{
-	struct fs_timer_t *t = opaque;
-	CPUState *env = t->env;
-	cpu_abort(env, "Unsupported short access. reg=" TARGET_FMT_plx "\n",
-		  addr);
-}
-
 #define TIMER_SLOWDOWN 1
 static void update_ctrl(struct fs_timer_t *t, int tnum)
 {
@@ -155,7 +138,7 @@
 	case 4: freq_hz =  29493000; break;
 	case 5: freq_hz =  32000000; break;
 	case 6: freq_hz =  32768000; break;
-	case 7: freq_hz = 100001000; break;
+	case 7: freq_hz = 100000000; break;
 	default:
 		abort();
 		break;
@@ -163,8 +146,8 @@
 
 	D(printf ("freq_hz=%d div=%d\n", freq_hz, div));
 	div = div * TIMER_SLOWDOWN;
-	div >>= 10;
-	freq_hz >>= 10;
+	div /= 1000;
+	freq_hz /= 1000;
 	ptimer_set_freq(timer, freq_hz);
 	ptimer_set_limit(timer, div, 0);
 
@@ -309,14 +292,12 @@
 }
 
 static CPUReadMemoryFunc *timer_read[] = {
-	&timer_rinvalid,
-	&timer_rinvalid,
+	NULL, NULL,
 	&timer_readl,
 };
 
 static CPUWriteMemoryFunc *timer_write[] = {
-	&timer_winvalid,
-	&timer_winvalid,
+	NULL, NULL,
 	&timer_writel,
 };
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-07 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 13:24 [Qemu-devel] [6206] ETRAX: Support timer count reads and correct frequencies Edgar E. Iglesias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).