Changes in kernel/arch/mips32/src/interrupt.c [c5429fe:f4bb404] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/interrupt.c
rc5429fe rf4bb404 38 38 #include <arch.h> 39 39 #include <arch/cp0.h> 40 #include <arch/smp/dorder.h>41 40 #include <time/clock.h> 42 41 #include <ipc/sysipc.h> 43 44 #define IRQ_COUNT 845 #define TIMER_IRQ 746 47 #ifdef MACHINE_msim48 #define DORDER_IRQ 549 #endif50 51 function virtual_timer_fnc = NULL;52 static irq_t timer_irq;53 54 #ifdef MACHINE_msim55 static irq_t dorder_irq;56 #endif57 42 58 43 // TODO: This is SMP unsafe!!! … … 61 46 static unsigned long nextcount; 62 47 static unsigned long lastcount; 48 49 /** Table of interrupt handlers. */ 50 int_handler_t int_handler[MIPS_INTERRUPTS] = { }; 63 51 64 52 /** Disable interrupts. … … 122 110 } 123 111 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) 112 static void timer_interrupt_handler(unsigned int intr) 130 113 { 131 114 if (cp0_count_read() < lastcount) … … 144 127 cp0_compare_write(nextcount); 145 128 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);151 129 clock(); 152 irq_spinlock_lock(&irq->lock, false);153 154 if (virtual_timer_fnc != NULL)155 virtual_timer_fnc();156 130 } 157 158 #ifdef MACHINE_msim159 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 #endif169 131 170 132 /* Initialize basic tables for exception dispatching */ 171 133 void interrupt_init(void) 172 134 { 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); 135 int_handler[INT_TIMER] = timer_interrupt_handler; 180 136 181 137 timer_start(); 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 138 cp0_unmask_int(INT_TIMER); 193 139 } 194 140
Note:
See TracChangeset
for help on using the changeset viewer.