Changeset 0287820 in mainline
- Timestamp:
- 2007-12-02T00:54:24Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8df2eab
- Parents:
- d4e38c7
- Location:
- kernel/arch/mips32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/include/cycle.h
rd4e38c7 r0287820 36 36 #define KERN_mips32_CYCLE_H_ 37 37 38 #include <arch/cp0.h> 39 #include <arch/interrupt.h> 40 38 41 static inline uint64_t get_cycle(void) 39 42 { 40 return 0;43 return ((uint64_t) count_hi << 32) + ((uint64_t) cp0_count_read()); 41 44 } 42 45 -
kernel/arch/mips32/include/interrupt.h
rd4e38c7 r0287820 43 43 44 44 extern function virtual_timer_fnc; 45 extern uint32_t count_hi; 45 46 46 47 extern void interrupt_init(void); -
kernel/arch/mips32/src/interrupt.c
rd4e38c7 r0287820 90 90 91 91 /* TODO: This is SMP unsafe!!! */ 92 uint32_t count_hi = 0; 92 93 static unsigned long nextcount; 94 static unsigned long lastcount; 95 93 96 /** Start hardware clock */ 94 97 static void timer_start(void) 95 98 { 99 lastcount = cp0_count_read(); 96 100 nextcount = cp0_compare_value + cp0_count_read(); 97 101 cp0_compare_write(nextcount); … … 106 110 { 107 111 unsigned long drift; 108 112 113 if (cp0_count_read() < lastcount) { 114 /* Count overflow detection */ 115 count_hi++; 116 lastcount = cp0_count_read(); 117 } 118 109 119 drift = cp0_count_read() - nextcount; 110 120 while (drift > cp0_compare_value) { … … 114 124 nextcount = cp0_count_read() + cp0_compare_value - drift; 115 125 cp0_compare_write(nextcount); 116 126 117 127 /* 118 128 * We are holding a lock which prevents preemption.
Note:
See TracChangeset
for help on using the changeset viewer.