Changeset d6e5cbc in mainline for arch/mips32/src/interrupt.c


Ignore:
Timestamp:
2006-05-28T18:17:36Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5552d60
Parents:
3bf5976
Message:

Added 'realtime' clock interface.
Added some asm macros as memory barriers.
Added drift computing for mips platform.

File:
1 edited

Legend:

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

    r3bf5976 rd6e5cbc  
    7777}
    7878
     79/* TODO: This is SMP unsafe!!! */
     80static unsigned long nextcount;
     81/** Start hardware clock */
     82static void timer_start(void)
     83{
     84        nextcount = cp0_compare_value + cp0_count_read();
     85        cp0_compare_write(nextcount);
     86}
     87
    7988static void timer_exception(int n, istate_t *istate)
    8089{
    81         cp0_compare_write(cp0_count_read() + cp0_compare_value);
     90        unsigned long drift;
     91
     92        drift = cp0_count_read() - nextcount;
     93        while (drift > cp0_compare_value) {
     94                drift -= cp0_compare_value;
     95                CPU->missed_clock_ticks++;
     96        }
     97        nextcount = cp0_count_read() + cp0_compare_value - drift;
     98        cp0_compare_write(nextcount);
    8299        clock();
    83100}
     
    101118        int_register(0, "swint0", swint0);
    102119        int_register(1, "swint1", swint1);
     120        timer_start();
    103121}
    104122
Note: See TracChangeset for help on using the changeset viewer.