diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-07-25 08:36:08 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-07-25 08:36:08 +0000 |
commit | 4c7b7f38ba237508f2953bc37d2aff482909f369 (patch) | |
tree | c8e496127828c6f10a5cc28ce1cb0462ef28f0f8 | |
parent | 591b09c2ee9176b3d60218f69486f45f495def82 (diff) | |
download | ChibiOS-4c7b7f38ba237508f2953bc37d2aff482909f369.tar.gz ChibiOS-4c7b7f38ba237508f2953bc37d2aff482909f369.tar.bz2 ChibiOS-4c7b7f38ba237508f2953bc37d2aff482909f369.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7078 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | demos/SPC5/NIL-SPC560D-EVB/nilconf.h | 8 | ||||
-rw-r--r-- | os/nil/include/nil.h | 7 | ||||
-rw-r--r-- | os/nil/src/nil.c | 11 | ||||
-rw-r--r-- | os/nil/templates/nilconf.h | 8 |
4 files changed, 26 insertions, 8 deletions
diff --git a/demos/SPC5/NIL-SPC560D-EVB/nilconf.h b/demos/SPC5/NIL-SPC560D-EVB/nilconf.h index ad25ddc22..1903f7dd1 100644 --- a/demos/SPC5/NIL-SPC560D-EVB/nilconf.h +++ b/demos/SPC5/NIL-SPC560D-EVB/nilconf.h @@ -118,6 +118,14 @@ /*===========================================================================*/
/**
+ * @brief System initialization hook.
+ */
+#if !defined(NIL_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
+#define NIL_CFG_SYSTEM_INIT_HOOK() { \
+}
+#endif
+
+/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
diff --git a/os/nil/include/nil.h b/os/nil/include/nil.h index d6a7945d7..83d4208d2 100644 --- a/os/nil/include/nil.h +++ b/os/nil/include/nil.h @@ -182,6 +182,13 @@ typedef struct nil_thread thread_t; #endif
/**
+ * @brief System initialization hook.
+ */
+#if !defined(NIL_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
+#define NIL_CFG_SYSTEM_INIT_HOOK() {}
+#endif
+
+/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
diff --git a/os/nil/src/nil.c b/os/nil/src/nil.c index d7afe3b87..90e4b8379 100644 --- a/os/nil/src/nil.c +++ b/os/nil/src/nil.c @@ -75,6 +75,9 @@ void chSysInit(void) { /* Port layer initialization.*/
port_init();
+ /* System initialization hook.*/
+ NIL_CFG_SYSTEM_INIT_HOOK();
+
/* Iterates through the list of defined threads.*/
tp = &nil.threads[0];
tcp = nil_thd_configs;
@@ -87,9 +90,7 @@ void chSysInit(void) { PORT_SETUP_CONTEXT(tp, tcp->wend, tcp->funcp, tcp->arg);
/* Initialization hook.*/
-#if defined(NIL_CFG_THREAD_EXT_INIT_HOOK)
NIL_CFG_THREAD_EXT_INIT_HOOK(tp);
-#endif
tp++, tcp++;
}
@@ -129,9 +130,7 @@ void chSysHalt(const char *reason) { (void)reason;
#endif
-#if defined(NIL_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
NIL_CFG_SYSTEM_HALT_HOOK(reason);
-#endif
/* Harmless infinite loop.*/
while (true)
@@ -300,11 +299,9 @@ void chSchRescheduleS(void) { thread_t *otp = nil.current;
nil.current = nil.next;
-#if defined(NIL_CFG_IDLE_LEAVE_HOOK)
if (otp == &nil.threads[NIL_CFG_NUM_THREADS]) {
NIL_CFG_IDLE_LEAVE_HOOK();
}
-#endif
port_switch(nil.next, otp);
}
}
@@ -376,11 +373,9 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t timeout) { /* Is this thread ready to execute?*/
if (NIL_THD_IS_READY(ntp)) {
nil.current = nil.next = ntp;
-#if defined(NIL_CFG_IDLE_ENTER_HOOK)
if (ntp == &nil.threads[NIL_CFG_NUM_THREADS]) {
NIL_CFG_IDLE_ENTER_HOOK();
}
-#endif
port_switch(ntp, otp);
return nil.current->u1.msg;
}
diff --git a/os/nil/templates/nilconf.h b/os/nil/templates/nilconf.h index 97826e307..f95b082ee 100644 --- a/os/nil/templates/nilconf.h +++ b/os/nil/templates/nilconf.h @@ -118,6 +118,14 @@ /*===========================================================================*/
/**
+ * @brief System initialization hook.
+ */
+#if !defined(NIL_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
+#define NIL_CFG_SYSTEM_INIT_HOOK() { \
+}
+#endif
+
+/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.
*/
|