Changeset da1bafb in mainline for kernel/arch/mips32/src/interrupt.c
- Timestamp:
- 2010-05-24T18:57:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/interrupt.c
r666f492 rda1bafb 48 48 function virtual_timer_fnc = NULL; 49 49 static irq_t timer_irq; 50 51 // TODO: This is SMP unsafe!!! 52 53 uint32_t count_hi = 0; 54 static unsigned long nextcount; 55 static unsigned long lastcount; 50 56 51 57 /** Disable interrupts. … … 99 105 } 100 106 101 /* TODO: This is SMP unsafe!!! */ 102 uint32_t count_hi = 0; 103 static unsigned long nextcount; 104 static unsigned long lastcount; 105 106 /** Start hardware clock */ 107 /** Start hardware clock 108 * 109 */ 107 110 static void timer_start(void) 108 111 { … … 119 122 static void timer_irq_handler(irq_t *irq) 120 123 { 121 unsigned long drift;122 123 124 if (cp0_count_read() < lastcount) 124 125 /* Count overflow detected */ 125 126 count_hi++; 127 126 128 lastcount = cp0_count_read(); 127 129 128 drift = cp0_count_read() - nextcount;130 unsigned long drift = cp0_count_read() - nextcount; 129 131 while (drift > cp0_compare_value) { 130 132 drift -= cp0_compare_value; 131 133 CPU->missed_clock_ticks++; 132 134 } 135 133 136 nextcount = cp0_count_read() + cp0_compare_value - drift; 134 137 cp0_compare_write(nextcount); … … 138 141 * Release the lock, call clock() and reacquire the lock again. 139 142 */ 140 spinlock_unlock(&irq->lock);143 irq_spinlock_unlock(&irq->lock, false); 141 144 clock(); 142 spinlock_lock(&irq->lock);145 irq_spinlock_lock(&irq->lock, false); 143 146 144 147 if (virtual_timer_fnc != NULL)
Note:
See TracChangeset
for help on using the changeset viewer.