aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-12 18:47:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-12 18:47:41 +0000
commite889040710fe8e5ee4454b01803d0c8522f489f0 (patch)
tree0ab29def1ed6bd4cf57ba901649a425c46586c4e /os/kernel/include
parent630bc516bf10c219d98d1c04466ce79de400d2ba (diff)
downloadChibiOS-e889040710fe8e5ee4454b01803d0c8522f489f0.tar.gz
ChibiOS-e889040710fe8e5ee4454b01803d0c8522f489f0.tar.bz2
ChibiOS-e889040710fe8e5ee4454b01803d0c8522f489f0.zip
Separated the dynamic threads code from the static threads code.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2349 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/include')
-rw-r--r--os/kernel/include/ch.h1
-rw-r--r--os/kernel/include/chdynamic.h67
-rw-r--r--os/kernel/include/chthreads.h27
3 files changed, 72 insertions, 23 deletions
diff --git a/os/kernel/include/ch.h b/os/kernel/include/ch.h
index 07fc070d1..24b669333 100644
--- a/os/kernel/include/ch.h
+++ b/os/kernel/include/ch.h
@@ -84,6 +84,7 @@
#include "chheap.h"
#include "chmempools.h"
#include "chthreads.h"
+#include "chdynamic.h"
#include "chregistry.h"
#include "chinline.h"
#include "chqueues.h"
diff --git a/os/kernel/include/chdynamic.h b/os/kernel/include/chdynamic.h
new file mode 100644
index 000000000..76de4ae09
--- /dev/null
+++ b/os/kernel/include/chdynamic.h
@@ -0,0 +1,67 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file chdynamic.h
+ * @brief Dynamic threads macros and structures.
+ *
+ * @addtogroup dynamic_threads
+ * @{
+ */
+
+#ifndef _CHDYNAMIC_H_
+#define _CHDYNAMIC_H_
+
+#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
+
+/*
+ * Module dependencies check.
+ */
+#if CH_USE_DYNAMIC && !CH_USE_WAITEXIT
+#error "CH_USE_DYNAMIC requires CH_USE_WAITEXIT"
+#endif
+#if CH_USE_DYNAMIC && !CH_USE_HEAP && !CH_USE_MEMPOOLS
+#error "CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS"
+#endif
+
+/*
+ * Dynamic threads APIs.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ Thread *chThdAddRef(Thread *tp);
+ void chThdRelease(Thread *tp);
+#if CH_USE_HEAP
+ Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size,
+ tprio_t prio, tfunc_t pf, void *arg);
+#endif
+#if CH_USE_MEMPOOLS
+ Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
+ tfunc_t pf, void *arg);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CH_USE_DYNAMIC */
+
+#endif /* _CHDYNAMIC_H_ */
+
+/** @} */
diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h
index e862c8c1a..677f0be58 100644
--- a/os/kernel/include/chthreads.h
+++ b/os/kernel/include/chthreads.h
@@ -28,16 +28,6 @@
#ifndef _CHTHREADS_H_
#define _CHTHREADS_H_
-/*
- * Module dependencies check.
- */
-#if CH_USE_DYNAMIC && !CH_USE_WAITEXIT
-#error "CH_USE_DYNAMIC requires CH_USE_WAITEXIT"
-#endif
-#if CH_USE_DYNAMIC && !CH_USE_HEAP && !CH_USE_MEMPOOLS
-#error "CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS"
-#endif
-
/**
* @extends ThreadsQueue
*
@@ -211,19 +201,14 @@ typedef msg_t (*tfunc_t)(void *);
#ifdef __cplusplus
extern "C" {
#endif
- Thread *init_thread(Thread *tp, tprio_t prio);
+ Thread *_thread_init(Thread *tp, tprio_t prio);
+#if CH_DBG_FILL_THREADS
+ void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v);
+#endif
Thread *chThdCreateI(void *wsp, size_t size,
tprio_t prio, tfunc_t pf, void *arg);
Thread *chThdCreateStatic(void *wsp, size_t size,
tprio_t prio, tfunc_t pf, void *arg);
-#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP
- Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size,
- tprio_t prio, tfunc_t pf, void *arg);
-#endif
-#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS
- Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
- tfunc_t pf, void *arg);
-#endif
tprio_t chThdSetPriority(tprio_t newprio);
Thread *chThdResume(Thread *tp);
void chThdTerminate(Thread *tp);
@@ -231,10 +216,6 @@ extern "C" {
void chThdSleepUntil(systime_t time);
void chThdYield(void);
void chThdExit(msg_t msg);
-#if CH_USE_DYNAMIC
- Thread *chThdAddRef(Thread *tp);
- void chThdRelease(Thread *tp);
-#endif
#if CH_USE_WAITEXIT
msg_t chThdWait(Thread *tp);
#endif