From 517440bad9d6d2f27689e4e3de72794d869d2c26 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 5 Sep 2008 13:04:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@425 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chthreads.c | 3 +++ src/include/sleep.h | 2 -- src/include/threads.h | 3 +++ src/templates/chconf.h | 26 +++++++++++++++++++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/chthreads.c b/src/chthreads.c index 2069fe389..a936fb6dc 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -50,6 +50,9 @@ void init_thread(tprio_t prio, tmode_t mode, Thread *tp) { #ifdef CH_USE_EXIT_EVENT chEvtInit(&tp->p_exitesource); #endif +#ifdef CH_USE_THREAD_EXT + THREAD_EXT_INIT(tp); +#endif } #ifdef CH_USE_DEBUG diff --git a/src/include/sleep.h b/src/include/sleep.h index c718bb4ba..36ba9470a 100644 --- a/src/include/sleep.h +++ b/src/include/sleep.h @@ -28,9 +28,7 @@ #ifdef __cplusplus extern "C" { #endif -#ifdef CH_USE_SLEEP void chThdSleep(systime_t time); -#endif /* CH_USE_SLEEP */ #ifdef CH_USE_SYSTEMTIME bool_t chSysInTimeWindow(systime_t start, systime_t end); #endif /* CH_USE_SYSTEMTIME */ diff --git a/src/include/threads.h b/src/include/threads.h index 2a53cb1fd..8c3974820 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -106,6 +106,9 @@ struct Thread { /** Thread's own, non-inherited, priority. */ tprio_t p_realprio; #endif +#ifdef CH_USE_THREAD_EXT + THREAD_EXT_FIELDS +#endif }; /** Thread state: Ready to run, waiting on the ready list.*/ diff --git a/src/templates/chconf.h b/src/templates/chconf.h index 1f6fc879e..d7e42dbed 100644 --- a/src/templates/chconf.h +++ b/src/templates/chconf.h @@ -35,12 +35,19 @@ * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED +/** Configuration option: it specified this option enables the \p Thread + * extension fields and initiazation code. + * @see THREAD_EXT_FIELDS + * @see THREAD_EXT_INIT + */ +#define CH_USE_THREAD_EXT + /** Configuration option: if specified then the Virtual Timers subsystem is * included in the kernel.*/ #define CH_USE_VIRTUAL_TIMERS /** Configuration option: if specified then the kernel performs the round - * robin scheduling algorithm on threads of equal priority. */ + * robin scheduling algorithm on threads of equal priority.*/ #define CH_USE_ROUNDROBIN /** Configuration option: if specified then the System Timer subsystem is @@ -173,6 +180,23 @@ */ #define CH_USE_TRACE +/** User fields added to the end of the \p Thread structure if the + * \p CH_USE_THREAD_EXT option is enabled. + * @see CH_USE_THREAD_EXT + */ +#define THREAD_EXT_FIELDS \ +struct { \ + /* Add fields here.*/ \ +}; + +/** User initialization code added to the \p chThdCreate() API if the + * \p CH_USE_THREAD_EXT option is enabled. + * @see CH_USE_THREAD_EXT + */ +#define THREAD_EXT_INIT(tp) { \ + /* Add initialization code here.*/ \ +} + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3