41 #ifndef RTIMER_ARCH_H_ 42 #define RTIMER_ARCH_H_ 47 #if JN516X_EXTERNAL_CRYSTAL_OSCILLATOR 48 #define RTIMER_ARCH_SECOND 32768 50 #define RTIMER_ARCH_SECOND 32000 54 #define RTIMER_ARCH_SECOND (F_CPU / 2) 58 #define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \ 59 (((int32_t)(US) * (RTIMER_ARCH_SECOND) + 500000) / 1000000L) : \ 60 ((int32_t)(US) * (RTIMER_ARCH_SECOND) - 500000) / 1000000L) 62 #define RTIMERTICKS_TO_US(T) ((T) >= 0 ? \ 63 (((int32_t)(T) * 1000000L + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) : \ 64 ((int32_t)(T) * 1000000L - ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND)) 68 #define RTIMERTICKS_TO_US_64(T) ((uint32_t)(((uint64_t)(T) * 1000000 + ((RTIMER_ARCH_SECOND) / 2)) / (RTIMER_ARCH_SECOND))) 72 #define US_TO_RTIMERTICKS(D) ((int64_t)(D) << 4) 73 #define RTIMERTICKS_TO_US(T) ((int64_t)(T) >> 4) 74 #define RTIMERTICKS_TO_US_64(T) RTIMERTICKS_TO_US(T) 80 rtimer_clock_t rtimer_arch_time_to_rtimer(
void);
82 void rtimer_arch_reinit(rtimer_clock_t sleep_start, rtimer_clock_t wakeup_time);
84 void clock_arch_init(
int is_reinitialization);
86 void clock_arch_calibrate(
void);
88 void clock_arch_reinit(
void);
90 void clock_arch_schedule_interrupt(clock_time_t time_to_etimer, rtimer_clock_t ticks_to_rtimer);
92 clock_t clock_arch_time_to_etimer(
void);
95 #define JN516X_MIN_SLEEP_TIME (RTIMER_SECOND / 50) 97 #define JN516X_MAX_SLEEP_TIME RTIMER_SECOND 99 #define JN516X_SLEEP_GUARD_TIME (RTIMER_ARCH_SECOND / 100) 101 #define WAKEUP_TIMER E_AHI_WAKE_TIMER_0 102 #define WAKEUP_TIMER_MASK E_AHI_SYSCTRL_WK0_MASK 104 #define TICK_TIMER E_AHI_WAKE_TIMER_1 105 #define TICK_TIMER_MASK E_AHI_SYSCTRL_WK1_MASK 107 #define WAIT_FOR_EDGE(edge_t) do { \ 108 uint64_t start_t = u64AHI_WakeTimerReadLarge(TICK_TIMER); \ 110 edge_t = u64AHI_WakeTimerReadLarge(TICK_TIMER); \ 111 } while(edge_t == start_t); \ rtimer_clock_t rtimer_arch_now(void)
Returns the current real-time clock time.
Header file for the real-time timer module.