From 61f841306aaa11b1471db1deb00470ea48f646fd Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 29 Jul 2013 13:28:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6037 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chsys.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'os/kernel/include/chsys.h') diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h index 5086e0b7f..3dc6623e9 100644 --- a/os/kernel/include/chsys.h +++ b/os/kernel/include/chsys.h @@ -61,7 +61,8 @@ */ #define CH_IRQ_PROLOGUE() \ PORT_IRQ_PROLOGUE(); \ - dbg_check_enter_isr(); + dbg_check_enter_isr(); \ + _stats_increase_irq() /** * @brief IRQ handler exit code. @@ -73,7 +74,7 @@ */ #define CH_IRQ_EPILOGUE() \ dbg_check_leave_isr(); \ - PORT_IRQ_EPILOGUE(); + PORT_IRQ_EPILOGUE() /** * @brief Standard normal IRQ handler declaration. @@ -99,6 +100,23 @@ #define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id) /** @} */ +/** + * @brief Returns the current value of the system real time counter. + * @note This function can be called from any context. + * @note If the port does not support a realtime counter then this + * function returns the system time. + * + * @return The value of the system realtime counter of + * type rtcnt_t. + * + * @special + */ +#if CH_PORT_SUPPORTS_RT || defined(__DOXYGEN__) +#define chSysGetRealtimeCounterX() (rtcnt_t)port_rt_get_counter_value() +#else +#define chSysGetRealtimeCounterX() (rtcnt_t)chVTGetSystemTimeX() +#endif + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ @@ -132,6 +150,7 @@ extern "C" { static inline void chSysSwitch(thread_t *ntp, thread_t *otp) { dbg_trace(otp); + _stats_increase_ctxswc(); CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); port_switch(ntp, otp); } -- cgit v1.2.3