Changes in kernel/arch/mips32/src/interrupt.c [f4bb404:c5429fe] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/interrupt.c
rf4bb404 rc5429fe 38 38 #include <arch.h> 39 39 #include <arch/cp0.h> 40 #include <arch/smp/dorder.h> 40 41 #include <time/clock.h> 41 42 #include <ipc/sysipc.h> 43 44 #define IRQ_COUNT 8 45 #define TIMER_IRQ 7 46 47 #ifdef MACHINE_msim 48 #define DORDER_IRQ 5 49 #endif 50 51 function virtual_timer_fnc = NULL; 52 static irq_t timer_irq; 53 54 #ifdef MACHINE_msim 55 static irq_t dorder_irq; 56 #endif 42 57 43 58 // TODO: This is SMP unsafe!!! … … 46 61 static unsigned long nextcount; 47 62 static unsigned long lastcount; 48 49 /** Table of interrupt handlers. */50 int_handler_t int_handler[MIPS_INTERRUPTS] = { };51 63 52 64 /** Disable interrupts. … … 110 122 } 111 123 112 static void timer_interrupt_handler(unsigned int intr) 124 static irq_ownership_t timer_claim(irq_t *irq) 125 { 126 return IRQ_ACCEPT; 127 } 128 129 static void timer_irq_handler(irq_t *irq) 113 130 { 114 131 if (cp0_count_read() < lastcount) … … 127 144 cp0_compare_write(nextcount); 128 145 146 /* 147 * We are holding a lock which prevents preemption. 148 * Release the lock, call clock() and reacquire the lock again. 149 */ 150 irq_spinlock_unlock(&irq->lock, false); 129 151 clock(); 152 irq_spinlock_lock(&irq->lock, false); 153 154 if (virtual_timer_fnc != NULL) 155 virtual_timer_fnc(); 130 156 } 157 158 #ifdef MACHINE_msim 159 static irq_ownership_t dorder_claim(irq_t *irq) 160 { 161 return IRQ_ACCEPT; 162 } 163 164 static void dorder_irq_handler(irq_t *irq) 165 { 166 dorder_ipi_ack(1 << dorder_cpuid()); 167 } 168 #endif 131 169 132 170 /* Initialize basic tables for exception dispatching */ 133 171 void interrupt_init(void) 134 172 { 135 int_handler[INT_TIMER] = timer_interrupt_handler; 173 irq_init(IRQ_COUNT, IRQ_COUNT); 174 175 irq_initialize(&timer_irq); 176 timer_irq.inr = TIMER_IRQ; 177 timer_irq.claim = timer_claim; 178 timer_irq.handler = timer_irq_handler; 179 irq_register(&timer_irq); 136 180 137 181 timer_start(); 138 cp0_unmask_int(INT_TIMER); 182 cp0_unmask_int(TIMER_IRQ); 183 184 #ifdef MACHINE_msim 185 irq_initialize(&dorder_irq); 186 dorder_irq.inr = DORDER_IRQ; 187 dorder_irq.claim = dorder_claim; 188 dorder_irq.handler = dorder_irq_handler; 189 irq_register(&dorder_irq); 190 191 cp0_unmask_int(DORDER_IRQ); 192 #endif 139 193 } 140 194
Note:
See TracChangeset
for help on using the changeset viewer.