Search
lxdream.org :: lxdream/src/sh4/intc.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/intc.c
changeset 265:5daf59b7f31b
prev157:fbe03268ad8a
next421:e51bf0aedd90
author nkeynes
date Sat Jan 06 04:06:36 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Implement event queue.
Fix pvr2 timing (yes, again).
file annotate diff log raw
1.1 --- a/src/sh4/intc.c Thu Jun 15 10:27:10 2006 +0000
1.2 +++ b/src/sh4/intc.c Sat Jan 06 04:06:36 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: intc.c,v 1.6 2006-06-15 10:27:10 nkeynes Exp $
1.6 + * $Id: intc.c,v 1.7 2007-01-06 04:06:36 nkeynes Exp $
1.7 *
1.8 * SH4 onboard interrupt controller (INTC) implementation
1.9 *
1.10 @@ -20,6 +20,7 @@
1.11 #include "sh4mmio.h"
1.12 #include "sh4core.h"
1.13 #include "intc.h"
1.14 +#include "eventq.h"
1.15
1.16 struct intc_sources_t {
1.17 char *name;
1.18 @@ -106,7 +107,8 @@
1.19 intc_state.num_pending = 0;
1.20 for( i=0; i<INT_NUM_SOURCES; i++ )
1.21 intc_state.priority[i] = intc_default_priority[i];
1.22 - sh4r.int_pending = 0;
1.23 + sh4r.event_pending = event_get_next_time();
1.24 + sh4r.event_types &= (~PENDING_IRQ);
1.25 }
1.26
1.27
1.28 @@ -123,7 +125,7 @@
1.29 }
1.30
1.31 /* We basically maintain a priority queue here, raise_interrupt adds an entry,
1.32 - * accept_interrupt takes it off. At the moment this is does as a simple
1.33 + * accept_interrupt takes it off. At the moment this is done as a simple
1.34 * ordered array, on the basis that in practice there's unlikely to be more
1.35 * than one at a time. There are lots of ways to optimize this if it turns out
1.36 * to be necessary, but I'd doubt it will be...
1.37 @@ -148,8 +150,10 @@
1.38 intc_state.pending[j] = intc_state.pending[j-1];
1.39 intc_state.pending[i] = which;
1.40
1.41 - if( i == intc_state.num_pending && (sh4r.sr&SR_BL)==0 && SH4_INTMASK() < pri )
1.42 - sh4r.int_pending = 1;
1.43 + if( i == intc_state.num_pending && (sh4r.sr&SR_BL)==0 && SH4_INTMASK() < pri ) {
1.44 + sh4r.event_pending = 0;
1.45 + sh4r.event_types |= PENDING_IRQ;
1.46 + }
1.47
1.48 intc_state.num_pending++;
1.49 }
1.50 @@ -180,9 +184,14 @@
1.51 void intc_mask_changed( void )
1.52 {
1.53 if( intc_state.num_pending > 0 && (sh4r.sr&SR_BL)==0 &&
1.54 - SH4_INTMASK() < PRIORITY(intc_state.pending[intc_state.num_pending-1]) )
1.55 - sh4r.int_pending = 1;
1.56 - else sh4r.int_pending = 0;
1.57 + SH4_INTMASK() < PRIORITY(intc_state.pending[intc_state.num_pending-1]) ) {
1.58 + sh4r.event_pending = 0;
1.59 + sh4r.event_types |= PENDING_IRQ ;
1.60 + }
1.61 + else {
1.62 + sh4r.event_pending = event_get_next_time();
1.63 + sh4r.event_types &= (~PENDING_IRQ);
1.64 + }
1.65 }
1.66
1.67
.