Permalink
Browse files

fix the cause register clear bug

  • Loading branch information...
1 parent 2b28d1c commit 39e52955378e4b32b67894dddd42ec03df5af334 @yajin yajin committed with Jan 15, 2009
Showing with 16 additions and 17 deletions.
  1. +7 −7 hw/mips_jz.c
  2. +9 −10 hw/mips_jz_glue.h
View
@@ -503,7 +503,8 @@ static void jz4740_intc_write(void *opaque, target_phys_addr_t addr,
s->icmr &= ~value;
break;
case 0x10:
- s->icpr = value;
+ s->icpr &= ~value;
+ qemu_set_irq(s->parent_irq, 0);
break;
default:
cpu_abort(s->soc->env,
@@ -533,19 +534,18 @@ static void jz4740_set_irq(void *opaque, int irq, int level)
struct jz4740_intc_s *s = (struct jz4740_intc_s *) opaque;
uint32_t irq_mask = 1 << irq;
- s->icpr &= ~irq_mask;
+
if (level)
{
s->icsr |= irq_mask;
- //printf("s->icmr %x \n",s->icmr);
+ s->icpr &= ~irq_mask;
if (!(s->icmr & irq_mask))
{
s->icpr |= irq_mask;
qemu_set_irq(s->parent_irq, 1);
}
}
- else
- qemu_set_irq(s->parent_irq, 0);
+
}
static qemu_irq *jz4740_intc_init(struct jz_state_s *soc, qemu_irq parent_irq)
@@ -1588,8 +1588,8 @@ static void jz4740_tcu_update_interrupt(struct jz4740_tcu_s *s)
{
qemu_set_irq(s->tcu_irq0, 1);
}
- // else
- // qemu_set_irq(s->tcu_irq0, 0);
+ else
+ qemu_set_irq(s->tcu_irq0, 0);
#if 0
if (((s->tfr & 0x2) & (~(s->tmr & 0x2)))
|| ((s->tfr & 0x20000) & (~(s->tmr & 0x20000))))
View
@@ -110,23 +110,23 @@ static inline void glue(jz4740_tcu_start_full,
debug_out(DEBUG_TCU, "s->tsr %d s->ter %d s->freq[TCU_INDEX] %d \n",
s->tsr , s->ter ,s->freq[TCU_INDEX]);
-printf("s->tsr %d s->ter %d s->freq[TCU_INDEX] %d \n",
- s->tsr , s->ter ,s->freq[TCU_INDEX]);
+//printf("s->tsr %d s->ter %d s->freq[TCU_INDEX] %d \n",
+ // s->tsr , s->ter ,s->freq[TCU_INDEX]);
if ((!(s->tsr & (1 << TCU_INDEX))) && (s->ter & (1 << TCU_INDEX))
&& (s->freq[TCU_INDEX] != 0))
{
glue(jz4740_tcu_time_sync, TCU_INDEX) (s);
- printf("tdfr %x \n",s->tdfr[TCU_INDEX] );
+ //printf("tdfr %x \n",s->tdfr[TCU_INDEX] );
/*calculate next fire time */
count =
(s->tdfr[TCU_INDEX] - s->tcnt[TCU_INDEX]) * s->prescale[TCU_INDEX];
- printf("tdfr11 %x count %lld\n",s->tdfr[TCU_INDEX],count );
+ //printf("tdfr11 %x count %lld\n",s->tdfr[TCU_INDEX],count );
next += muldiv64(count, ticks_per_sec, s->freq[TCU_INDEX]);
qemu_mod_timer(s->full_timer[TCU_INDEX], next);
debug_out(DEBUG_TCU, "s->tdfr[TCU_INDEX] %d s->tcnt[TCU_INDEX] %d next %lld \n",
s->tdfr[TCU_INDEX] , s->tcnt[TCU_INDEX] ,next);
- printf("s->tdfr[TCU_INDEX]22 %x s->tcnt[TCU_INDEX] %x next %lld \n",
- s->tdfr[TCU_INDEX] , s->tcnt[TCU_INDEX] ,next);
+ //printf("s->tdfr[TCU_INDEX]22 %x s->tcnt[TCU_INDEX] %x next %lld \n",
+ // s->tdfr[TCU_INDEX] , s->tcnt[TCU_INDEX] ,next);
}
else
@@ -221,8 +221,8 @@ static void glue(jz4740_tcu_write, TCU_INDEX) (void *opaque,
debug_out(DEBUG_TCU, "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
addr, value);
-printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
- addr, value);
+//printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
+// addr, value);
addr -= 0x40 + TCU_INDEX * 0x10;
switch (addr)
@@ -231,7 +231,7 @@ printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
/*TDFR*/
s->tdfr[TCU_INDEX] = value & 0xffff;
- printf("s->tdfr[TCU_INDEX] %x \n",s->tdfr[TCU_INDEX] );
+ //printf("s->tdfr[TCU_INDEX] %x \n",s->tdfr[TCU_INDEX] );
glue(jz4740_tcu_start_full, TCU_INDEX) (s);
break;
case 0x4:
@@ -263,7 +263,6 @@ printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
break;
}
s->prescale[TCU_INDEX] = 1 << (((value & 0x38) >> 3) * 2);
- printf("s->prescale[TCU_INDEX] %x\n",s->prescale[TCU_INDEX] );
glue(jz4740_tcu_start_half, TCU_INDEX) (s);
glue(jz4740_tcu_start_full, TCU_INDEX) (s);
break;

0 comments on commit 39e5295

Please sign in to comment.