diff options
Diffstat (limited to 'pk')
-rw-r--r-- | pk/kernel/pk_api.h | 14 | ||||
-rw-r--r-- | pk/trace/pk_trace_core.c | 7 |
2 files changed, 13 insertions, 8 deletions
diff --git a/pk/kernel/pk_api.h b/pk/kernel/pk_api.h index 75515b8b..e1d49d86 100644 --- a/pk/kernel/pk_api.h +++ b/pk/kernel/pk_api.h @@ -300,10 +300,12 @@ /// This is the unscaled timebase frequency in Hz. #ifdef APPCFG_USE_EXT_TIMEBASE -#define PK_BASE_FREQ_HZ 25000000 +#define PK_BASE_FREQ_HZ (uint32_t)25000000 #else -#define PK_BASE_FREQ_HZ 400000000 +#define PK_BASE_FREQ_HZ (uint32_t)400000000 #endif /* APPCFG_USE_EXT_TIMEBASE */ +#define PK_BASE_FREQ_KHZ (PK_BASE_FREQ_HZ / 1000) +#define PK_BASE_FREQ_MHZ (PK_BASE_FREQ_HZ / 1000000) /// Scale a time interval to be _closer_ to what was actually requested /// base on the actual timebase frequency. @@ -313,7 +315,7 @@ /// ignored. The application can redefine this macro. #ifndef PK_SECONDS -#define PK_SECONDS(s) ((PkInterval)(PK_BASE_FREQ_HZ * (PkInterval)(s))) +#define PK_SECONDS(s) ((PkInterval)(PK_BASE_FREQ_HZ * (s))) #endif /// Convert a time in integral milliseconds to a time interval - overflows are @@ -321,7 +323,7 @@ /// assumed. The application can redefine this macro. #ifndef PK_MILLISECONDS -#define PK_MILLISECONDS(m) ((PkInterval)((PK_BASE_FREQ_HZ * (PkInterval)(m)) / 1000)) +#define PK_MILLISECONDS(m) ( (PkInterval)(PK_BASE_FREQ_KHZ * (m)) ) #endif /// Convert a time in integral microseconds to a time interval - overflows are @@ -329,7 +331,7 @@ /// assumed. The application can redefine this macro. #ifndef PK_MICROSECONDS -#define PK_MICROSECONDS(u) ((PkInterval)((PK_BASE_FREQ_HZ * (PkInterval)(u)) / 1000000)) +#define PK_MICROSECONDS(u) ( (PkInterval)(PK_BASE_FREQ_MHZ * (u)) ) #endif /// Convert a time in integral nanoseconds to a time interval - overflows are @@ -337,7 +339,7 @@ /// assumed. The application can redefine this macro. #ifndef PK_NANOSECONDS -#define PK_NANOSECONDS(n) ((PkInterval)((PK_BASE_FREQ_HZ * (PkInterval)(n)) / 1000000000)) +#define PK_NANOSECONDS(n) ( (PkInterval)( ( ((PK_BASE_FREQ_MHZ<<10)/1000) * (n) ) >> 10) ) #endif diff --git a/pk/trace/pk_trace_core.c b/pk/trace/pk_trace_core.c index 93072bd8..429679db 100644 --- a/pk/trace/pk_trace_core.c +++ b/pk/trace/pk_trace_core.c @@ -91,12 +91,15 @@ void pk_trace_tiny(uint32_t i_parm) // This function is called periodically in order to ensure that the max ticks // between trace entries is no more than what will fit inside a 32bit value. +#ifndef PK_TRACE_TIMER_OUTPUT +#define PK_TRACE_TIMER_OUTPUT 1 +#endif void pk_trace_timer_callback(void* arg) { - +#if PK_TRACE_TIMER_OUTPUT // guarantee at least one trace before the lower 32bit timebase flips PK_TRACE("PERIODIC TIMESTAMPING TRACE"); - +#endif // restart the timer pk_timer_schedule(&g_pk_trace_timer, PK_TRACE_TIMER_PERIOD); |