Changes in kernel/arch/mips32/src/interrupt.c [da1bafb:d99c1d2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/interrupt.c
rda1bafb rd99c1d2 49 49 static irq_t timer_irq; 50 50 51 // TODO: This is SMP unsafe!!!52 53 uint32_t count_hi = 0;54 static unsigned long nextcount;55 static unsigned long lastcount;56 57 51 /** Disable interrupts. 58 52 * … … 95 89 } 96 90 97 /** Check interrupts state. 98 * 99 * @return True if interrupts are disabled. 100 * 101 */ 102 bool interrupts_disabled(void) 103 { 104 return !(cp0_status_read() & cp0_status_ie_enabled_bit); 105 } 91 /* TODO: This is SMP unsafe!!! */ 92 uint32_t count_hi = 0; 93 static unsigned long nextcount; 94 static unsigned long lastcount; 106 95 107 /** Start hardware clock 108 * 109 */ 96 /** Start hardware clock */ 110 97 static void timer_start(void) 111 98 { … … 122 109 static void timer_irq_handler(irq_t *irq) 123 110 { 111 unsigned long drift; 112 124 113 if (cp0_count_read() < lastcount) 125 114 /* Count overflow detected */ 126 115 count_hi++; 127 128 116 lastcount = cp0_count_read(); 129 117 130 unsigned longdrift = cp0_count_read() - nextcount;118 drift = cp0_count_read() - nextcount; 131 119 while (drift > cp0_compare_value) { 132 120 drift -= cp0_compare_value; 133 121 CPU->missed_clock_ticks++; 134 122 } 135 136 123 nextcount = cp0_count_read() + cp0_compare_value - drift; 137 124 cp0_compare_write(nextcount); … … 141 128 * Release the lock, call clock() and reacquire the lock again. 142 129 */ 143 irq_spinlock_unlock(&irq->lock, false);130 spinlock_unlock(&irq->lock); 144 131 clock(); 145 irq_spinlock_lock(&irq->lock, false);132 spinlock_lock(&irq->lock); 146 133 147 134 if (virtual_timer_fnc != NULL)
Note:
See TracChangeset
for help on using the changeset viewer.