aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src/chsem.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-08-12 11:10:19 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-08-12 11:10:19 +0000
commit43752ee8d132fc57028a9ff15156c5bfcd81c013 (patch)
treeeb4a8eafaaac4084e1c0c307850a8ce17939e58f /os/kernel/src/chsem.c
parente0309ba9738efc707f8c43de43e04d2c62a32e8c (diff)
downloadChibiOS-43752ee8d132fc57028a9ff15156c5bfcd81c013.tar.gz
ChibiOS-43752ee8d132fc57028a9ff15156c5bfcd81c013.tar.bz2
ChibiOS-43752ee8d132fc57028a9ff15156c5bfcd81c013.zip
Extended state check to all kernel I-class and s-class APIs, corrected some test cases where call protocol rules were not strictly observerd. No the whole test suite pass with the state checker enabled.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3223 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src/chsem.c')
-rw-r--r--os/kernel/src/chsem.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c
index c22a568ea..bf985bead 100644
--- a/os/kernel/src/chsem.c
+++ b/os/kernel/src/chsem.c
@@ -129,8 +129,8 @@ void chSemReset(Semaphore *sp, cnt_t n) {
void chSemResetI(Semaphore *sp, cnt_t n) {
cnt_t cnt;
+ chDbgCheckClassI();
chDbgCheck((sp != NULL) && (n >= 0), "chSemResetI");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemResetI(), #1",
@@ -177,8 +177,8 @@ msg_t chSemWait(Semaphore *sp) {
*/
msg_t chSemWaitS(Semaphore *sp) {
+ chDbgCheckClassS();
chDbgCheck(sp != NULL, "chSemWaitS");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemWaitS(), #1",
@@ -242,8 +242,8 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
*/
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
+ chDbgCheckClassS();
chDbgCheck(sp != NULL, "chSemWaitTimeoutS");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemWaitTimeoutS(), #1",
@@ -271,7 +271,6 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
void chSemSignal(Semaphore *sp) {
chDbgCheck(sp != NULL, "chSemSignal");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemSignal(), #1",
@@ -296,8 +295,8 @@ void chSemSignal(Semaphore *sp) {
*/
void chSemSignalI(Semaphore *sp) {
+ chDbgCheckClassI();
chDbgCheck(sp != NULL, "chSemSignalI");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemSignalI(), #1",
@@ -327,8 +326,8 @@ void chSemSignalI(Semaphore *sp) {
*/
void chSemAddCounterI(Semaphore *sp, cnt_t n) {
+ chDbgCheckClassI();
chDbgCheck((sp != NULL) && (n > 0), "chSemAddCounterI");
-
chDbgAssert(((sp->s_cnt >= 0) && isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && notempty(&sp->s_queue)),
"chSemAddCounterI(), #1",
@@ -361,12 +360,10 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
msg_t msg;
chDbgCheck((sps != NULL) && (spw != NULL), "chSemSignalWait");
-
chDbgAssert(((sps->s_cnt >= 0) && isempty(&sps->s_queue)) ||
((sps->s_cnt < 0) && notempty(&sps->s_queue)),
"chSemSignalWait(), #1",
"inconsistent semaphore");
-
chDbgAssert(((spw->s_cnt >= 0) && isempty(&spw->s_queue)) ||
((spw->s_cnt < 0) && notempty(&spw->s_queue)),
"chSemSignalWait(), #2",