Changeset da1bafb in mainline for kernel/arch/mips32/src/interrupt.c


Ignore:
Timestamp:
2010-05-24T18:57:31Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0095368
Parents:
666f492
Message:

major code revision

  • replace spinlocks taken with interrupts disabled with irq_spinlocks
  • change spacing (not indendation) to be tab-size independent
  • use unsigned integer types where appropriate (especially bit flags)
  • visual separation
  • remove argument names in function prototypes
  • string changes
  • correct some formating directives
  • replace various cryptic single-character variables (t, a, m, c, b, etc.) with proper identifiers (thread, task, timeout, as, itm, itc, etc.)
  • unify some assembler constructs
  • unused page table levels are now optimized out in compile time
  • replace several ints (with boolean semantics) with bools
  • use specifically sized types instead of generic types where appropriate (size_t, uint32_t, btree_key_t)
  • improve comments
  • split asserts with conjuction into multiple independent asserts
File:
1 edited

Legend:

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

    r666f492 rda1bafb  
    4848function virtual_timer_fnc = NULL;
    4949static irq_t timer_irq;
     50
     51// TODO: This is SMP unsafe!!!
     52
     53uint32_t count_hi = 0;
     54static unsigned long nextcount;
     55static unsigned long lastcount;
    5056
    5157/** Disable interrupts.
     
    99105}
    100106
    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 */
    107110static void timer_start(void)
    108111{
     
    119122static void timer_irq_handler(irq_t *irq)
    120123{
    121         unsigned long drift;
    122        
    123124        if (cp0_count_read() < lastcount)
    124125                /* Count overflow detected */
    125126                count_hi++;
     127       
    126128        lastcount = cp0_count_read();
    127129       
    128         drift = cp0_count_read() - nextcount;
     130        unsigned long drift = cp0_count_read() - nextcount;
    129131        while (drift > cp0_compare_value) {
    130132                drift -= cp0_compare_value;
    131133                CPU->missed_clock_ticks++;
    132134        }
     135       
    133136        nextcount = cp0_count_read() + cp0_compare_value - drift;
    134137        cp0_compare_write(nextcount);
     
    138141         * Release the lock, call clock() and reacquire the lock again.
    139142         */
    140         spinlock_unlock(&irq->lock);
     143        irq_spinlock_unlock(&irq->lock, false);
    141144        clock();
    142         spinlock_lock(&irq->lock);
     145        irq_spinlock_lock(&irq->lock, false);
    143146       
    144147        if (virtual_timer_fnc != NULL)
Note: See TracChangeset for help on using the changeset viewer.