Changeset 2a0cda72 in mainline
- Timestamp:
- 2006-12-14T18:14:47Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7f95cc5d
- Parents:
- aeaebcc
- Location:
- kernel/arch/sparc64
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/cpu.h
raeaebcc r2a0cda72 56 56 ver_reg_t ver; 57 57 uint32_t clock_frequency; /**< Processor frequency in MHz. */ 58 uint64_t next_tick_cmpr; /**< Next clock interrupt should be 59 * generated in this amount of ticks. 60 */ 58 61 }; 59 62 -
kernel/arch/sparc64/include/cycle.h
raeaebcc r2a0cda72 40 40 static inline uint64_t get_cycle(void) 41 41 { 42 return 0; /* not yet supported */42 return tick_read(); 43 43 } 44 44 -
kernel/arch/sparc64/src/drivers/tick.c
raeaebcc r2a0cda72 53 53 interrupt_register(14, "tick_int", tick_interrupt); 54 54 compare.int_dis = false; 55 compare.tick_cmpr = CPU->arch.clock_frequency/HZ; 55 compare.tick_cmpr = CPU->arch.clock_frequency / HZ; 56 CPU->arch.next_tick_cmpr = compare.tick_cmpr; 56 57 tick_compare_write(compare.value); 57 58 tick_write(0); … … 66 67 { 67 68 softint_reg_t softint, clear; 68 uint64_t next, compare, start, stop;69 uint64_t drift; 69 70 70 71 softint.value = softint_read(); … … 88 89 89 90 /* 90 * Restart counter. 91 * Reprogram the compare register. 92 * For now, we can ignore the potential of the registers to overflow. 93 * On a 360MHz Ultra 60, the 63-bit compare counter will overflow in 94 * about 812 years. If there was a 2GHz UltraSPARC computer, it would 95 * overflow only in 146 years. 91 96 */ 92 compare = CPU->arch.clock_frequency/HZ; 93 start = tick_read(); 94 next = start - compare; 95 while (next >= compare - TICK_RESTART_TIME) { 96 next -= compare; 97 drift = tick_read() - CPU->arch.next_tick_cmpr; 98 while (drift > CPU->arch.clock_frequency / HZ) { 99 drift -= CPU->arch.clock_frequency / HZ; 97 100 CPU->missed_clock_ticks++; 98 101 } 99 stop = tick_read();100 tick_write(next + (stop - start));101 102 CPU->arch.next_tick_cmpr = tick_read() + (CPU->arch.clock_frequency / HZ) 103 - drift; 104 tick_compare_write(CPU->arch.next_tick_cmpr); 102 105 clock(); 103 106 }
Note:
See TracChangeset
for help on using the changeset viewer.