diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-29 13:28:35 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-29 13:28:35 +0000 |
commit | 61f841306aaa11b1471db1deb00470ea48f646fd (patch) | |
tree | 0f69b278240b26d0dd4e20da5fe6de2a2b840992 /os/kernel/include/chsys.h | |
parent | 0cb6bc9b9d260beb05fcc9e2ec4d72f0ba621b71 (diff) | |
download | ChibiOS-61f841306aaa11b1471db1deb00470ea48f646fd.tar.gz ChibiOS-61f841306aaa11b1471db1deb00470ea48f646fd.tar.bz2 ChibiOS-61f841306aaa11b1471db1deb00470ea48f646fd.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6037 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/include/chsys.h')
-rw-r--r-- | os/kernel/include/chsys.h | 23 |
1 files changed, 21 insertions, 2 deletions
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);
}
|