aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-05 11:45:26 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-05 11:45:26 +0000
commitbb5acac94d079e107f8faa4bb6b2e5d1389c40d4 (patch)
tree541f2ddb756844458a632eb3dcfb311e28b5fc95 /src
parent64e5a24e28d6746dc78c1784a474bccf784a272d (diff)
downloadChibiOS-bb5acac94d079e107f8faa4bb6b2e5d1389c40d4.tar.gz
ChibiOS-bb5acac94d079e107f8faa4bb6b2e5d1389c40d4.tar.bz2
ChibiOS-bb5acac94d079e107f8faa4bb6b2e5d1389c40d4.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@579 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r--src/chinit.c27
-rw-r--r--src/templates/chconf.h9
2 files changed, 36 insertions, 0 deletions
diff --git a/src/chinit.c b/src/chinit.c
index a675d6910..613e7bfeb 100644
--- a/src/chinit.c
+++ b/src/chinit.c
@@ -76,4 +76,31 @@ void chSysTimerHandlerI(void) {
chVTDoTickI();
}
+#if !defined(CH_OPTIMIZE_SPEED)
+/**
+ * Enters the ChibiOS/RT system mutual exclusion zone.
+ * @note The use of system mutual exclusion zone is not recommended in
+ * the user code, it is a better idea to use the semaphores or mutexes
+ * instead.
+ * @see CH_USE_NESTED_LOCKS
+ */
+void chSysLock(void) {
+
+ chSysLockInline();
+}
+
+/**
+ * Leaves the ChibiOS/RT system mutual exclusion zone.
+ * @note The use of system mutual exclusion zone is not recommended in
+ * the user code, it is a better idea to use the semaphores or mutexes
+ * instead.
+ * @see CH_USE_NESTED_LOCKS
+ */
+void chSysUnlock(void) {
+
+ chDbgAssert(currp->p_locks > 0, "chinit.c, chSysUnlock()");
+ chSysUnlockInline();
+}
+#endif /* !CH_OPTIMIZE_SPEED */
+
/** @} */
diff --git a/src/templates/chconf.h b/src/templates/chconf.h
index a6071493b..005748b83 100644
--- a/src/templates/chconf.h
+++ b/src/templates/chconf.h
@@ -35,6 +35,15 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
+/** Configuration option: If enabled then the used of nested @p chSysLock() /
+ * @p chSysUnlock() operations is allowed.<br>
+ * For performance and code size reasons the recommended setting is leave
+ * this option disabled.<br>
+ * You can use this option if you need to merge with ChibiOS/RT external
+ * libraries that require nested lock/unlock operations.
+ */
+#define CH_USE_NESTED_LOCKS
+
/** Configuration option: if specified then the kernel performs the round
* robin scheduling algorithm on threads of equal priority.*/
#define CH_USE_ROUNDROBIN