diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-03 17:14:03 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-03 17:14:03 +0000 |
commit | 2310f80695b4051cb63ca14878dfc5e76acb94e6 (patch) | |
tree | 70643e03f918333f051734336f97011644da076a /src | |
parent | 1b269aa139ba66288cc2c3f1b463c73821343262 (diff) | |
download | ChibiOS-2310f80695b4051cb63ca14878dfc5e76acb94e6.tar.gz ChibiOS-2310f80695b4051cb63ca14878dfc5e76acb94e6.tar.bz2 ChibiOS-2310f80695b4051cb63ca14878dfc5e76acb94e6.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@30 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/chsem.c | 21 | ||||
-rw-r--r-- | src/include/delta.h | 3 | ||||
-rw-r--r-- | src/include/semaphores.h | 2 | ||||
-rw-r--r-- | src/templates/chconf.h | 4 |
4 files changed, 16 insertions, 14 deletions
diff --git a/src/chsem.c b/src/chsem.c index 5c1ff0544..70741c4f0 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -138,13 +138,9 @@ t_msg chSemWaitTimeout(Semaphore *sp, t_time time) { fifo_insert(currp, &sp->s_queue);
currp->p_semp = sp;
chSchGoSleepI(PRWTSEM);
- msg = currp->p_rdymsg; // Note, got value *before* invoking CH_LEAVE_SYSTEM().
- if (!vt.vt_func) {
-
- chSysUnlock();
- return msg;
- }
- chVTResetI(&vt);
+ msg = currp->p_rdymsg;
+ if (vt.vt_func)
+ chVTResetI(&vt);
chSysUnlock();
return msg;
@@ -173,9 +169,8 @@ t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time) { fifo_insert(currp, &sp->s_queue);
currp->p_semp = sp;
chSchGoSleepI(PRWTSEM);
- if (!vt.vt_func)
- return currp->p_rdymsg;
- chVTResetI(&vt);
+ if (vt.vt_func)
+ chVTResetI(&vt);
return currp->p_rdymsg;
}
return RDY_OK;
@@ -211,6 +206,7 @@ void chSemSignalI(Semaphore *sp) { chSchReadyI(fifo_remove(&sp->s_queue));
}
+#ifdef CH_USE_SEMSW
/**
* Performs atomic signal and wait operations on two semaphores.
* @param sps pointer to a \p Semaphore structure to be signaled
@@ -235,6 +231,7 @@ void chSemSignalWait(Semaphore *sps, Semaphore *spw) { chSysUnlock();
}
+#endif /* CH_USE_SEMSW */
#ifdef CH_USE_RT_SEMAPHORES
/*
@@ -299,6 +296,7 @@ void chSemLowerPrioSignal(Semaphore *sp) { chSysUnlock();
}
+#ifdef CH_USE_SEMSW
/**
* Performs atomic signal and wait operations on two semaphores with priority
* boost.
@@ -326,7 +324,7 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) { if (!currp->p_rtcnt++)
currp->p_prio += MEPRIO;
- chSchRescheduleI();
+ chSchRescheduleI(); // Really needed ?
}
chSysUnlock();
@@ -360,6 +358,7 @@ void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) { chSysUnlock();
}
+#endif /* CH_USE_SEMSW */
#endif /* CH_USE_RT_SEMAPHORES */
diff --git a/src/include/delta.h b/src/include/delta.h index 14f5b550e..7639301e1 100644 --- a/src/include/delta.h +++ b/src/include/delta.h @@ -77,8 +77,7 @@ extern DeltaList dlist; while (!(vtp = dlist.dl_next)->vt_dtime) { \
t_vtfunc fn = vtp->vt_func; \
vtp->vt_func = 0; \
- vtp->vt_prev->vt_next = vtp->vt_next; \
- vtp->vt_next->vt_prev = vtp->vt_prev; \
+ (vtp->vt_next->vt_prev = (VirtualTimer *)&dlist)->vt_next = vtp->vt_next; \
fn(vtp->vt_par); \
} \
}
diff --git a/src/include/semaphores.h b/src/include/semaphores.h index 8179627f4..c1f3f9db6 100644 --- a/src/include/semaphores.h +++ b/src/include/semaphores.h @@ -46,7 +46,7 @@ t_msg chSemWaitTimeout(Semaphore *sp, t_time time); t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time);
void chSemSignal(Semaphore *sp);
void chSemSignalI(Semaphore *sp);
-void chSignalWait(Semaphore *sps, Semaphore *spw);
+void chSemSignalWait(Semaphore *sps, Semaphore *spw);
#ifdef CH_USE_RT_SEMAPHORES
void chSemRaisePrioWait(Semaphore *sp);
diff --git a/src/templates/chconf.h b/src/templates/chconf.h index 87f9a18b6..478abd8f9 100644 --- a/src/templates/chconf.h +++ b/src/templates/chconf.h @@ -64,6 +64,10 @@ * in the kernel.*/
#define CH_USE_SEMAPHORES
+/** Configuration option: if specified then the Semaphores atomic Signal+Wait
+ * APIs are included in the kernel.*/
+#define CH_USE_SEMSW
+
/** Configuration option: if specified then the Semaphores with timeout APIs
* are included in the kernel.
* @note requires \p CH_USE_SEMAPHORES.
|