Changes in kernel/arch/mips32/src/interrupt.c [2b698d8:d99c1d2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/interrupt.c
r2b698d8 rd99c1d2 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> … … 49 48 function virtual_timer_fnc = NULL; 50 49 static irq_t timer_irq; 51 static irq_t dorder_irq;52 53 // TODO: This is SMP unsafe!!!54 55 uint32_t count_hi = 0;56 static unsigned long nextcount;57 static unsigned long lastcount;58 50 59 51 /** Disable interrupts. … … 97 89 } 98 90 99 /** Check interrupts state. 100 * 101 * @return True if interrupts are disabled. 102 * 103 */ 104 bool interrupts_disabled(void) 105 { 106 return !(cp0_status_read() & cp0_status_ie_enabled_bit); 107 } 91 /* TODO: This is SMP unsafe!!! */ 92 uint32_t count_hi = 0; 93 static unsigned long nextcount; 94 static unsigned long lastcount; 108 95 109 /** Start hardware clock 110 * 111 */ 96 /** Start hardware clock */ 112 97 static void timer_start(void) 113 98 { … … 124 109 static void timer_irq_handler(irq_t *irq) 125 110 { 111 unsigned long drift; 112 126 113 if (cp0_count_read() < lastcount) 127 114 /* Count overflow detected */ 128 115 count_hi++; 129 130 116 lastcount = cp0_count_read(); 131 117 132 unsigned longdrift = cp0_count_read() - nextcount;118 drift = cp0_count_read() - nextcount; 133 119 while (drift > cp0_compare_value) { 134 120 drift -= cp0_compare_value; 135 121 CPU->missed_clock_ticks++; 136 122 } 137 138 123 nextcount = cp0_count_read() + cp0_compare_value - drift; 139 124 cp0_compare_write(nextcount); … … 143 128 * Release the lock, call clock() and reacquire the lock again. 144 129 */ 145 irq_spinlock_unlock(&irq->lock, false);130 spinlock_unlock(&irq->lock); 146 131 clock(); 147 irq_spinlock_lock(&irq->lock, false);132 spinlock_lock(&irq->lock); 148 133 149 134 if (virtual_timer_fnc != NULL) 150 135 virtual_timer_fnc(); 151 }152 153 static irq_ownership_t dorder_claim(irq_t *irq)154 {155 return IRQ_ACCEPT;156 }157 158 static void dorder_irq_handler(irq_t *irq)159 {160 dorder_ipi_ack(1 << dorder_cpuid());161 136 } 162 137 … … 175 150 timer_start(); 176 151 cp0_unmask_int(TIMER_IRQ); 177 178 irq_initialize(&dorder_irq);179 dorder_irq.devno = device_assign_devno();180 dorder_irq.inr = DORDER_IRQ;181 dorder_irq.claim = dorder_claim;182 dorder_irq.handler = dorder_irq_handler;183 irq_register(&dorder_irq);184 185 cp0_unmask_int(DORDER_IRQ);186 152 } 187 153
Note:
See TracChangeset
for help on using the changeset viewer.