aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-05-13 17:20:39 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-05-13 17:20:39 +0000
commit85f17ebe017f0ef2a42d96eb3525346db5b9c65e (patch)
treed8bf0aaf3ff0fc37d9c78eab9206fb2bbd08a823 /os
parent16feb88c2dc82420390b56226e8fe7cbc49aeb3b (diff)
downloadChibiOS-85f17ebe017f0ef2a42d96eb3525346db5b9c65e.tar.gz
ChibiOS-85f17ebe017f0ef2a42d96eb3525346db5b9c65e.tar.bz2
ChibiOS-85f17ebe017f0ef2a42d96eb3525346db5b9c65e.zip
Customer CR.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2951 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/kernel/src/chsys.c4
-rw-r--r--os/kernel/src/chthreads.c3
-rw-r--r--os/kernel/templates/chconf.h17
3 files changed, 22 insertions, 2 deletions
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index 29f4bdc7e..5d3c0bcf4 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -35,6 +35,7 @@
#include "ch.h"
+#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
/**
* @brief Idle thread working area.
* @see IDLE_THREAD_STACK_SIZE
@@ -59,6 +60,7 @@ void _idle_thread(void *p) {
IDLE_LOOP_HOOK();
}
}
+#endif /* CH_NO_IDLE_THREAD */
/**
* @brief ChibiOS/RT initialization.
@@ -93,11 +95,13 @@ void chSysInit(void) {
currp->p_state = THD_STATE_CURRENT;
chSysEnable();
+#if !CH_NO_IDLE_THREAD
/* This thread has the lowest priority in the system, its role is just to
serve interrupts in its context while keeping the lowest energy saving
mode compatible with the system status.*/
chThdCreateStatic(_idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO,
(tfunc_t)_idle_thread, NULL);
+#endif
}
/**
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index 234cd6ae1..7df276bea 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -206,8 +206,7 @@ Thread *chThdCreateStatic(void *wsp, size_t size,
tprio_t chThdSetPriority(tprio_t newprio) {
tprio_t oldprio;
- chDbgCheck((newprio >= LOWPRIO) && (newprio <= HIGHPRIO),
- "chThdSetPriority");
+ chDbgCheck(newprio <= HIGHPRIO, "chThdSetPriority");
chSysLock();
#if CH_USE_MUTEXES
diff --git a/os/kernel/templates/chconf.h b/os/kernel/templates/chconf.h
index 04fa822cc..14109b635 100644
--- a/os/kernel/templates/chconf.h
+++ b/os/kernel/templates/chconf.h
@@ -90,6 +90,23 @@
#define CH_MEMCORE_SIZE 0
#endif
+/**
+ * @brief Idle thread automatic spawn suppression.
+ * @details When this option is activated the function @p chSysInit()
+ * does not spawn the idle thread automatically. The application has
+ * then the responsibility to do one of the following:
+ * - Spawn a custom idle thread at priority @p IDLEPRIO.
+ * - Change the main() thread priority to @p IDLEPRIO then enter
+ * an endless loop. In this scenario the @p main() thread acts as
+ * the idle thread.
+ * .
+ * @note Unless an idle thread is spawned the @p main() thread must not
+ * enter a sleep state.
+ */
+#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
+#define CH_NO_IDLE_THREAD FALSE
+#endif
+
/*===========================================================================*/
/* Performance options. */
/*===========================================================================*/