From 903575815458e4e3c12195418f0582f5a9350f81 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 3 Dec 2007 14:54:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@124 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chsem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/chsem.c') diff --git a/src/chsem.c b/src/chsem.c index 01ec80649..083e25412 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -33,6 +33,7 @@ */ void chSemInit(Semaphore *sp, t_cnt n) { + chDbgAssert(n >= 0, "chsem.c, chSemInit()"); fifo_init(&sp->s_queue); sp->s_cnt = n; } @@ -48,6 +49,7 @@ void chSemInit(Semaphore *sp, t_cnt n) { void chSemReset(Semaphore *sp, t_cnt n) { t_cnt cnt; + chDbgAssert(n >= 0, "chsem.c, chSemReset()"); chSysLock(); cnt = sp->s_cnt; @@ -73,6 +75,7 @@ void chSemReset(Semaphore *sp, t_cnt n) { void chSemResetI(Semaphore *sp, t_cnt n) { t_cnt cnt; + chDbgAssert(n >= 0, "chsem.c, chSemResetI()"); cnt = sp->s_cnt; sp->s_cnt = n; while (cnt++ < 0) @@ -116,10 +119,7 @@ t_msg chSemWaitS(Semaphore *sp) { #ifdef CH_USE_SEMAPHORES_TIMEOUT static void wakeup(void *p) { -#ifdef CH_USE_DEBUG - if (((Thread *)p)->p_state != PRWTSEM) - chDbgPanic("chsem.c, wakeup()"); -#endif + chDbgAssert(((Thread *)p)->p_state == PRWTSEM, "chsem.c, wakeup()"); chSemFastSignalI(((Thread *)p)->p_semp); chSchReadyI(dequeue(p), RDY_TIMEOUT); } -- cgit v1.2.3