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