Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/interrupt.c

    rda1bafb rd99c1d2  
    4949static irq_t timer_irq;
    5050
    51 // TODO: This is SMP unsafe!!!
    52 
    53 uint32_t count_hi = 0;
    54 static unsigned long nextcount;
    55 static unsigned long lastcount;
    56 
    5751/** Disable interrupts.
    5852 *
     
    9589}
    9690
    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!!! */
     92uint32_t count_hi = 0;
     93static unsigned long nextcount;
     94static unsigned long lastcount;
    10695
    107 /** Start hardware clock
    108  *
    109  */
     96/** Start hardware clock */
    11097static void timer_start(void)
    11198{
     
    122109static void timer_irq_handler(irq_t *irq)
    123110{
     111        unsigned long drift;
     112       
    124113        if (cp0_count_read() < lastcount)
    125114                /* Count overflow detected */
    126115                count_hi++;
    127        
    128116        lastcount = cp0_count_read();
    129117       
    130         unsigned long drift = cp0_count_read() - nextcount;
     118        drift = cp0_count_read() - nextcount;
    131119        while (drift > cp0_compare_value) {
    132120                drift -= cp0_compare_value;
    133121                CPU->missed_clock_ticks++;
    134122        }
    135        
    136123        nextcount = cp0_count_read() + cp0_compare_value - drift;
    137124        cp0_compare_write(nextcount);
     
    141128         * Release the lock, call clock() and reacquire the lock again.
    142129         */
    143         irq_spinlock_unlock(&irq->lock, false);
     130        spinlock_unlock(&irq->lock);
    144131        clock();
    145         irq_spinlock_lock(&irq->lock, false);
     132        spinlock_lock(&irq->lock);
    146133       
    147134        if (virtual_timer_fnc != NULL)
Note: See TracChangeset for help on using the changeset viewer.