#ifndef _TIMER_COUNT32_H__ #define _TIMER_COUNT32_H__ #include "os/os_type.h" typedef struct { u32 exec_count; u32 exec_time; u32 intval_count; u32 intval_time; u32 exec_max_time; u32 exec_max_error_time; u32 exec_time_error; u32 intval_time_error; }measure_time_t; void timer_count32_init(void); u32 timer_count32_get(void); u32 timer_count32_delta_us(u32 prev_count, u32 *p_update); void time_measure_start(measure_time_t *m); void time_measure_end(measure_time_t *m); #define COUNT_CLK (10 * 1000000) #define COUNT_2_US(c) (c/120) static __inline__ u32 timer_count32_getus(u32 now, u32 count) { u32 delta = now - count; if (now < count) { //wrap delta = 0xFFFFFFFF - count + now + 1; } return COUNT_2_US(delta); } #endif /* _TIMER_COUNT32_H__ */