git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6027 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2013-07-24 15:38:50 +00:00
parent 7aaa7099fd
commit b21e9a01e5
2 changed files with 9 additions and 10 deletions

View File

@ -90,16 +90,9 @@
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
* @details When this option is activated the function @p chSysInit() * @details When this option is activated the function @p chSysInit()
* does not spawn the idle thread automatically. The application has * does not spawn the idle thread. The application @p main()
* then the responsibility to do one of the following: * function becomes the idle thread and must implement an
* - Spawn a custom idle thread at priority @p IDLEPRIO. * infinite loop. */
* - 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_CFG_NO_IDLE_THREAD) || defined(__DOXYGEN__) #if !defined(CH_CFG_NO_IDLE_THREAD) || defined(__DOXYGEN__)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif #endif

View File

@ -115,8 +115,14 @@ void chSysInit(void) {
_trace_init(); _trace_init();
#endif #endif
#if !CH_CFG_NO_IDLE_THREAD
/* Now this instructions flow becomes the main thread.*/ /* Now this instructions flow becomes the main thread.*/
setcurrp(_thread_init(&mainthread, NORMALPRIO)); setcurrp(_thread_init(&mainthread, NORMALPRIO));
#else
/* Now this instructions flow becomes the main thread.*/
setcurrp(_thread_init(&mainthread, IDLEPRIO));
#endif
currp->p_state = CH_STATE_CURRENT; currp->p_state = CH_STATE_CURRENT;
#if CH_DBG_ENABLE_STACK_CHECK #if CH_DBG_ENABLE_STACK_CHECK
/* This is a special case because the main thread thread_t structure is not /* This is a special case because the main thread thread_t structure is not