git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@124 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
2467527dd5
commit
9035758154
|
@ -4,7 +4,7 @@
|
|||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ChibiOS/RT
|
||||
PROJECT_NUMBER = "0.4.3 beta"
|
||||
PROJECT_NUMBER = "0.4.4 beta"
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
|
|
@ -13,7 +13,7 @@ Homepage</h2>
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
||||
Version 0.4.3<br>
|
||||
Version 0.4.4<br>
|
||||
-<br>
|
||||
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br>
|
||||
<a href="html/index.html" target="_top" rel="me">Documentation</a><br>
|
||||
|
|
|
@ -39,6 +39,13 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
|
|||
*** Releases ***
|
||||
*****************************************************************************
|
||||
|
||||
*** 0.4.4 ***
|
||||
- Added a chDbgAssert() API to the debug subsystem.
|
||||
- Cleaned up the kernel source code using chDbgAssert() instead of a lot of
|
||||
"#ifdef CH_USE_DEBUG", it is much more readable now.
|
||||
- Now the threads working area is filled with a 0x55 when in debug mode, this
|
||||
will make easier to track stack usage using a JTAG probe.
|
||||
|
||||
*** 0.4.3 ***
|
||||
- Size optimization in the events code, now the chEvtWait() reuses the
|
||||
chEvtWaitTimeout() code if it is enabled.
|
||||
|
|
|
@ -143,10 +143,8 @@ t_eventid chEvtWait(t_eventmask ewmask,
|
|||
}
|
||||
|
||||
static void wakeup(void *p) {
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRWTEVENT)
|
||||
chDbgPanic("chevents.c, wakeup()");
|
||||
#endif
|
||||
|
||||
chDbgAssert(((Thread *)p)->p_state == PRWTEVENT, "chevents.c, wakeup()");
|
||||
chSchReadyI(p, RDY_TIMEOUT);
|
||||
}
|
||||
|
||||
|
|
15
src/chmsg.c
15
src/chmsg.c
|
@ -66,11 +66,8 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) {
|
|||
|
||||
chSysLock();
|
||||
|
||||
chDbgAssert(tp->p_state != PRWTMSG, "chmsg.c, chMsgSendWithEvent()");
|
||||
fifo_insert(currp, &tp->p_msgqueue);
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (tp->p_state == PRWTMSG)
|
||||
chDbgPanic("chmsg.c, chMsgSendWithEvent()");
|
||||
#endif
|
||||
chEvtSendI(esp);
|
||||
currp->p_msg = msg;
|
||||
chSchGoSleepS(PRSNDMSG);
|
||||
|
@ -84,10 +81,7 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) {
|
|||
#ifdef CH_USE_MESSAGES_TIMEOUT
|
||||
static void wakeup(void *p) {
|
||||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRSNDMSG)
|
||||
chDbgPanic("chmsg.c, wakeup()");
|
||||
#endif
|
||||
chDbgAssert(((Thread *)p)->p_state == PRSNDMSG, "chmsg.c, wakeup()");
|
||||
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
||||
}
|
||||
|
||||
|
@ -186,10 +180,7 @@ void chMsgRelease(t_msg msg) {
|
|||
|
||||
chSysLock();
|
||||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (!chMsgIsPendingI(currp))
|
||||
chDbgPanic("chmsg.c, chMsgRelease()");
|
||||
#endif
|
||||
chDbgAssert(chMsgIsPendingI(currp), "chmsg.c, chMsgRelease()");
|
||||
chSchWakeupS(fifo_remove(&currp->p_msgqueue), msg);
|
||||
|
||||
chSysUnlock();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,14 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef CH_USE_DEBUG
|
||||
static void memfill(BYTE8 *p, ULONG32 n, BYTE8 v) {
|
||||
|
||||
while (n)
|
||||
*p++ = v, n--;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Creates a new thread.
|
||||
* @param prio the priority level for the new thread. Usually the threads are
|
||||
|
@ -84,6 +92,12 @@ Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
|
|||
t_size wsize, t_tfunc pf, void *arg) {
|
||||
Thread *tp = workspace;
|
||||
|
||||
chDbgAssert((wsize > UserStackSize(0)) && (prio <= HIGHPRIO) &&
|
||||
(workspace != NULL) && (pf != NULL),
|
||||
"chthreads.c, chThdCreate()");
|
||||
#ifdef CH_USE_DEBUG
|
||||
memfill(workspace, wsize, MEM_FILL_PATTERN);
|
||||
#endif
|
||||
_InitThread(prio, mode, tp);
|
||||
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
||||
#ifdef CH_USE_RESUME
|
||||
|
@ -108,6 +122,7 @@ Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
|
|||
*/
|
||||
void chThdSetPriority(t_prio newprio) {
|
||||
|
||||
chDbgAssert(newprio <= HIGHPRIO, "chthreads.c, chThdSetPriority()")
|
||||
chSysLock();
|
||||
|
||||
#ifdef CH_USE_RT_SEMAPHORES
|
||||
|
@ -139,10 +154,7 @@ void chThdSuspend(Thread **tpp) {
|
|||
|
||||
chSysLock();
|
||||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (*tpp)
|
||||
chDbgPanic("chthreads.c, chThdSuspend()");
|
||||
#endif
|
||||
chDbgAssert(*tpp == NULL, "chthreads.c, chThdSuspend()");
|
||||
*tpp = currp;
|
||||
chSchGoSleepS(PRSUSPENDED);
|
||||
*tpp = NULL;
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
#define TRACE_BUFFER_SIZE 64
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Fill value for threads working area in debug mode.
|
||||
*/
|
||||
#define MEM_FILL_PATTERN 0x55
|
||||
|
||||
typedef struct {
|
||||
void *cse_slpdata;
|
||||
t_time cse_time;
|
||||
|
@ -58,10 +63,24 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Condition assertion, if the condition check fails then the kernel panics
|
||||
* with the specified message.
|
||||
* @param c the condition to be verified to be true
|
||||
* @param m the text message
|
||||
* @note The condition is tested only if the \p CH_USE_DEBUG switch is
|
||||
* specified in \p chconf.h else the macro does nothing.
|
||||
*/
|
||||
#define chDbgAssert(c, m) { \
|
||||
if (!(c)) \
|
||||
chDbgPanic(m); \
|
||||
}
|
||||
|
||||
#else /* CH_USE_DEBUG */
|
||||
|
||||
#define chDbgInit()
|
||||
#define chDbgPanic(msg) {}
|
||||
#define chDbgAssert(c, m) {}
|
||||
|
||||
#endif /* CH_USE_DEBUG */
|
||||
|
||||
|
|
Loading…
Reference in New Issue