From 43752ee8d132fc57028a9ff15156c5bfcd81c013 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 12 Aug 2011 11:10:19 +0000 Subject: 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 --- os/kernel/src/chsem.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'os/kernel/src/chsem.c') 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", -- cgit v1.2.3