diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/kernel/include/chsys.h | 1 | ||||
-rw-r--r-- | os/kernel/templates/chconf.h | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h index 7c3a77d5c..f807182ac 100644 --- a/os/kernel/include/chsys.h +++ b/os/kernel/include/chsys.h @@ -76,6 +76,7 @@ */
#define chSysSwitch(ntp, otp) { \
dbg_trace(otp); \
+ THREAD_CONTEXT_SWITCH_HOOK(ntp, otp); \
port_switch(ntp, otp); \
}
diff --git a/os/kernel/templates/chconf.h b/os/kernel/templates/chconf.h index 6a365d96a..9dd831c96 100644 --- a/os/kernel/templates/chconf.h +++ b/os/kernel/templates/chconf.h @@ -483,6 +483,16 @@ #endif
/**
+ * @brief Context switch hook.
+ * @details This hook is invoked just before switching between threads.
+ */
+#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
+#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \
+ /* System halt code here.*/ \
+}
+#endif
+
+/**
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
|