timer_count32.h 433 B

123456789101112131415161718192021
  1. #ifndef _TIMER_COUNT32_H__
  2. #define _TIMER_COUNT32_H__
  3. #include "os/os_types.h"
  4. void timer_count32_init(void);
  5. u32 timer_count32_get(void);
  6. u32 timer_count32_delta(u32 now, u32 prev);
  7. #define COUNT_CLK (1000 * 1000)
  8. static __inline__ u32 timer_get_5us_ticks(u32 now, u32 count) {
  9. u32 delta = now - count;
  10. if (now < count) { //wrap
  11. delta = 0xFFFFFFFF - count + now + 1;
  12. }
  13. return (delta);
  14. }
  15. #endif /* _TIMER_COUNT32_H__ */