timex.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:1k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /* $Id: timex.h,v 1.1 1998/08/25 09:22:03 ralf Exp $
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1998, 1999 by Ralf Baechle
  8.  *
  9.  * FIXME: For some of the supported machines this is dead wrong.
  10.  */
  11. #ifndef __ASM_MIPS_TIMEX_H
  12. #define __ASM_MIPS_TIMEX_H
  13. #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
  14. #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
  15. #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * 
  16. (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) 
  17. << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
  18. #ifdef __KERNEL__
  19. /*
  20.  * Standard way to access the cycle counter.
  21.  * Currently only used on SMP for scheduling.
  22.  *
  23.  * Only the low 32 bits are available as a continuously counting entity. 
  24.  * But this only means we'll force a reschedule every 8 seconds or so,
  25.  * which isn't an evil thing.
  26.  *
  27.  * We know that all SMP capable CPUs have cycle counters.
  28.  */
  29. typedef unsigned int cycles_t;
  30. extern cycles_t cacheflush_time;
  31. static inline cycles_t get_cycles (void)
  32. {
  33. return read_32bit_cp0_register(CP0_COUNT);
  34. }
  35. #endif /* __KERNEL__ */
  36. #endif /*  __ASM_MIPS_TIMEX_H */