aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/oslib/include
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-24 17:37:38 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-24 17:37:38 +0000
commit276a56324dec125d1b431a0b1a02db8e15b27070 (patch)
treecdb4644993df167f0b9926d32eb921be107a07c5 /os/common/oslib/include
parentbcd636ef745d0988a945ca31b0798b743eba8314 (diff)
downloadChibiOS-276a56324dec125d1b431a0b1a02db8e15b27070.tar.gz
ChibiOS-276a56324dec125d1b431a0b1a02db8e15b27070.tar.bz2
ChibiOS-276a56324dec125d1b431a0b1a02db8e15b27070.zip
Fixed problems with the new factory, implemented part of its test sequence.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10898 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/oslib/include')
-rw-r--r--os/common/oslib/include/chfactory.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h
index 7ac414719..1804e7260 100644
--- a/os/common/oslib/include/chfactory.h
+++ b/os/common/oslib/include/chfactory.h
@@ -103,6 +103,10 @@
#error "invalid CH_CFG_FACTORY_MAX_NAMES_LENGTH value"
#endif
+#if (CH_CFG_USE_MUTEXES == FALSE) && (CH_CFG_USE_SEMAPHORES == FALSE)
+#error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
+#endif
+
#if CH_CFG_USE_MEMCORE == FALSE
#error "CH_CFG_USE_FACTORY requires CH_CFG_USE_MEMCORE"
#endif
@@ -256,6 +260,14 @@ typedef struct ch_dyn_objects_fifo {
*/
typedef struct ch_objects_factory {
/**
+ * @brief Factory access mutex or semaphore.
+ */
+#if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
+ mutex_t mtx;
+#else
+ semaphore_t sem;
+#endif
+ /**
* @brief List of the registered objects.
*/
dyn_list_t obj_list;