aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsys.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-16 15:41:08 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-16 15:41:08 +0000
commita9b4e8fc7225e8e2f26554b388f9d069d8f05b5e (patch)
tree5460fa94e99d7c5c5a2c60bfeabd7e825e6e2246 /src/chsys.c
parenta50a5627b641b3c6b82c5fbdf708eb16fafbe8f8 (diff)
downloadChibiOS-a9b4e8fc7225e8e2f26554b388f9d069d8f05b5e.tar.gz
ChibiOS-a9b4e8fc7225e8e2f26554b388f9d069d8f05b5e.tar.bz2
ChibiOS-a9b4e8fc7225e8e2f26554b388f9d069d8f05b5e.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@621 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chsys.c')
-rw-r--r--src/chsys.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/chsys.c b/src/chsys.c
index 45ce8b0f8..2f4c796a8 100644
--- a/src/chsys.c
+++ b/src/chsys.c
@@ -52,6 +52,7 @@ static void idle_thread(void *p) {
void chSysInit(void) {
static Thread mainthread;
+ sys_init();
chSchInit();
chDbgInit();
chVTInit();
@@ -94,37 +95,20 @@ 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.
- * @note The code of this API is may be inlined or not depending on the
- * @p CH_OPTIMIZE_SPEED setting.
- * @see CH_USE_NESTED_LOCKS, chSysLockInline()
- */
+#if defined(CH_USE_NESTED_LOCKS) && !defined(CH_OPTIMIZE_SPEED)
void chSysLock(void) {
- chSysLockInline();
+ chDbgAssert(currp->p_locks >= 0, "chinit.c, chSysLock()");
+ if (currp->p_locks++ == 0)
+ sys_lock();
}
-/**
- * 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.
- * @note The code of this API is may be inlined or not depending on the
- * @p CH_OPTIMIZE_SPEED setting.
- * @see CH_USE_NESTED_LOCKS, chSysUnlockInline()
- */
void chSysUnlock(void) {
-#ifdef CH_USE_NESTED_LOCKS
chDbgAssert(currp->p_locks > 0, "chinit.c, chSysUnlock()");
-#endif
- chSysUnlockInline();
+ if (--currp->p_locks == 0)
+ sys_unlock();
}
-#endif /* !CH_OPTIMIZE_SPEED */
+#endif /* defined(CH_USE_NESTED_LOCKS) && !defined(CH_OPTIMIZE_SPEED) */
/** @} */