Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix the cause register clear bug

  • Loading branch information...
commit 39e52955378e4b32b67894dddd42ec03df5af334 1 parent 2b28d1c
yajin authored January 15, 2009 mthuurne committed July 21, 2010
14  hw/mips_jz.c
@@ -503,7 +503,8 @@ static void jz4740_intc_write(void *opaque, target_phys_addr_t addr,
503 503
         s->icmr &= ~value;
504 504
         break;
505 505
     case 0x10:
506  
-    	 s->icpr = value;
  506
+    	 s->icpr &= ~value;
  507
+    	 qemu_set_irq(s->parent_irq, 0);
507 508
     	 break;
508 509
     default:
509 510
         cpu_abort(s->soc->env,
@@ -533,19 +534,18 @@ static void jz4740_set_irq(void *opaque, int irq, int level)
533 534
     struct jz4740_intc_s *s = (struct jz4740_intc_s *) opaque;
534 535
     uint32_t irq_mask = 1 << irq;
535 536
 
536  
-	s->icpr &= ~irq_mask;
  537
+	
537 538
 	if (level)
538 539
     {
539 540
     	s->icsr |= irq_mask;
540  
-    	//printf("s->icmr %x \n",s->icmr);
  541
+    	s->icpr &= ~irq_mask;
541 542
     	if (!(s->icmr & irq_mask))
542 543
     	{
543 544
     		s->icpr |= irq_mask;
544 545
     		qemu_set_irq(s->parent_irq, 1);
545 546
     	}
546 547
     }
547  
-    else
548  
-    	qemu_set_irq(s->parent_irq, 0);
  548
+	
549 549
 }
550 550
 
551 551
 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)
1588 1588
     {
1589 1589
         qemu_set_irq(s->tcu_irq0, 1);
1590 1590
     }
1591  
-   // else
1592  
-   //     qemu_set_irq(s->tcu_irq0, 0);
  1591
+    else
  1592
+        qemu_set_irq(s->tcu_irq0, 0);
1593 1593
 #if 0
1594 1594
     if (((s->tfr & 0x2) & (~(s->tmr & 0x2)))
1595 1595
         || ((s->tfr & 0x20000) & (~(s->tmr & 0x20000))))
19  hw/mips_jz_glue.h
@@ -110,23 +110,23 @@ static inline void glue(jz4740_tcu_start_full,
110 110
         
111 111
 	debug_out(DEBUG_TCU, "s->tsr %d  s->ter %d  s->freq[TCU_INDEX]  %d \n",
112 112
        			          s->tsr ,  s->ter ,s->freq[TCU_INDEX]);
113  
-printf("s->tsr %d  s->ter %d  s->freq[TCU_INDEX]  %d \n",
114  
-       			          s->tsr ,  s->ter ,s->freq[TCU_INDEX]);
  113
+//printf("s->tsr %d  s->ter %d  s->freq[TCU_INDEX]  %d \n",
  114
+   //    			          s->tsr ,  s->ter ,s->freq[TCU_INDEX]);
115 115
     if ((!(s->tsr & (1 << TCU_INDEX))) && (s->ter & (1 << TCU_INDEX))
116 116
         && (s->freq[TCU_INDEX] != 0))
117 117
     {
118 118
         glue(jz4740_tcu_time_sync, TCU_INDEX) (s);
119  
-        printf("tdfr %x \n",s->tdfr[TCU_INDEX] );
  119
+        //printf("tdfr %x \n",s->tdfr[TCU_INDEX] );
120 120
         /*calculate next fire time */
121 121
         count =
122 122
             (s->tdfr[TCU_INDEX] - s->tcnt[TCU_INDEX]) * s->prescale[TCU_INDEX];
123  
-        printf("tdfr11 %x count %lld\n",s->tdfr[TCU_INDEX],count );
  123
+        //printf("tdfr11 %x count %lld\n",s->tdfr[TCU_INDEX],count );
124 124
         next += muldiv64(count, ticks_per_sec, s->freq[TCU_INDEX]);
125 125
         qemu_mod_timer(s->full_timer[TCU_INDEX], next);
126 126
                 debug_out(DEBUG_TCU, "s->tdfr[TCU_INDEX]  %d  s->tcnt[TCU_INDEX] %d  next  %lld \n",
127 127
        			          s->tdfr[TCU_INDEX] ,  s->tcnt[TCU_INDEX]  ,next);
128  
-			printf("s->tdfr[TCU_INDEX]22  %x  s->tcnt[TCU_INDEX] %x next  %lld \n",
129  
-       			          s->tdfr[TCU_INDEX] ,  s->tcnt[TCU_INDEX]  ,next);
  128
+			//printf("s->tdfr[TCU_INDEX]22  %x  s->tcnt[TCU_INDEX] %x next  %lld \n",
  129
+       	//		          s->tdfr[TCU_INDEX] ,  s->tcnt[TCU_INDEX]  ,next);
130 130
 
131 131
     }
132 132
     else
@@ -221,8 +221,8 @@ static void glue(jz4740_tcu_write, TCU_INDEX) (void *opaque,
221 221
 
222 222
     debug_out(DEBUG_TCU, "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
223 223
               addr, value);
224  
-printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
225  
-              addr, value);
  224
+//printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
  225
+//              addr, value);
226 226
     addr -= 0x40 + TCU_INDEX * 0x10;
227 227
 
228 228
     switch (addr)
@@ -231,7 +231,7 @@ printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
231 231
          /*TDFR*/ 
232 232
          
233 233
          s->tdfr[TCU_INDEX] = value & 0xffff;
234  
-         printf("s->tdfr[TCU_INDEX]  %x \n",s->tdfr[TCU_INDEX] );
  234
+         //printf("s->tdfr[TCU_INDEX]  %x \n",s->tdfr[TCU_INDEX] );
235 235
         glue(jz4740_tcu_start_full, TCU_INDEX) (s);
236 236
         break;
237 237
     case 0x4:
@@ -263,7 +263,6 @@ printf( "jz4740_tcu_write%x addr %x value %x \n", TCU_INDEX,
263 263
             break;
264 264
         }
265 265
         s->prescale[TCU_INDEX] = 1 << (((value & 0x38) >> 3) * 2);
266  
-        printf("s->prescale[TCU_INDEX]  %x\n",s->prescale[TCU_INDEX] );
267 266
         glue(jz4740_tcu_start_half, TCU_INDEX) (s);
268 267
         glue(jz4740_tcu_start_full, TCU_INDEX) (s);
269 268
         break;

0 notes on commit 39e5295

Please sign in to comment.
Something went wrong with that request. Please try again.