git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@124 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
2467527dd5
commit
9035758154
|
@ -4,7 +4,7 @@
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
PROJECT_NAME = ChibiOS/RT
|
PROJECT_NAME = ChibiOS/RT
|
||||||
PROJECT_NUMBER = "0.4.3 beta"
|
PROJECT_NUMBER = "0.4.4 beta"
|
||||||
OUTPUT_DIRECTORY = .
|
OUTPUT_DIRECTORY = .
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
|
|
|
@ -13,7 +13,7 @@ Homepage</h2>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
||||||
Version 0.4.3<br>
|
Version 0.4.4<br>
|
||||||
-<br>
|
-<br>
|
||||||
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><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>
|
<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 ***
|
*** 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 ***
|
*** 0.4.3 ***
|
||||||
- Size optimization in the events code, now the chEvtWait() reuses the
|
- Size optimization in the events code, now the chEvtWait() reuses the
|
||||||
chEvtWaitTimeout() code if it is enabled.
|
chEvtWaitTimeout() code if it is enabled.
|
||||||
|
|
|
@ -143,10 +143,8 @@ t_eventid chEvtWait(t_eventmask ewmask,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wakeup(void *p) {
|
static void wakeup(void *p) {
|
||||||
#ifdef CH_USE_DEBUG
|
|
||||||
if (((Thread *)p)->p_state != PRWTEVENT)
|
chDbgAssert(((Thread *)p)->p_state == PRWTEVENT, "chevents.c, wakeup()");
|
||||||
chDbgPanic("chevents.c, wakeup()");
|
|
||||||
#endif
|
|
||||||
chSchReadyI(p, RDY_TIMEOUT);
|
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();
|
chSysLock();
|
||||||
|
|
||||||
|
chDbgAssert(tp->p_state != PRWTMSG, "chmsg.c, chMsgSendWithEvent()");
|
||||||
fifo_insert(currp, &tp->p_msgqueue);
|
fifo_insert(currp, &tp->p_msgqueue);
|
||||||
#ifdef CH_USE_DEBUG
|
|
||||||
if (tp->p_state == PRWTMSG)
|
|
||||||
chDbgPanic("chmsg.c, chMsgSendWithEvent()");
|
|
||||||
#endif
|
|
||||||
chEvtSendI(esp);
|
chEvtSendI(esp);
|
||||||
currp->p_msg = msg;
|
currp->p_msg = msg;
|
||||||
chSchGoSleepS(PRSNDMSG);
|
chSchGoSleepS(PRSNDMSG);
|
||||||
|
@ -84,10 +81,7 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) {
|
||||||
#ifdef CH_USE_MESSAGES_TIMEOUT
|
#ifdef CH_USE_MESSAGES_TIMEOUT
|
||||||
static void wakeup(void *p) {
|
static void wakeup(void *p) {
|
||||||
|
|
||||||
#ifdef CH_USE_DEBUG
|
chDbgAssert(((Thread *)p)->p_state == PRSNDMSG, "chmsg.c, wakeup()");
|
||||||
if (((Thread *)p)->p_state != PRSNDMSG)
|
|
||||||
chDbgPanic("chmsg.c, wakeup()");
|
|
||||||
#endif
|
|
||||||
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,10 +180,7 @@ void chMsgRelease(t_msg msg) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
#ifdef CH_USE_DEBUG
|
chDbgAssert(chMsgIsPendingI(currp), "chmsg.c, chMsgRelease()");
|
||||||
if (!chMsgIsPendingI(currp))
|
|
||||||
chDbgPanic("chmsg.c, chMsgRelease()");
|
|
||||||
#endif
|
|
||||||
chSchWakeupS(fifo_remove(&currp->p_msgqueue), msg);
|
chSchWakeupS(fifo_remove(&currp->p_msgqueue), msg);
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
*/
|
*/
|
||||||
void chSemInit(Semaphore *sp, t_cnt n) {
|
void chSemInit(Semaphore *sp, t_cnt n) {
|
||||||
|
|
||||||
|
chDbgAssert(n >= 0, "chsem.c, chSemInit()");
|
||||||
fifo_init(&sp->s_queue);
|
fifo_init(&sp->s_queue);
|
||||||
sp->s_cnt = n;
|
sp->s_cnt = n;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +49,7 @@ void chSemInit(Semaphore *sp, t_cnt n) {
|
||||||
void chSemReset(Semaphore *sp, t_cnt n) {
|
void chSemReset(Semaphore *sp, t_cnt n) {
|
||||||
t_cnt cnt;
|
t_cnt cnt;
|
||||||
|
|
||||||
|
chDbgAssert(n >= 0, "chsem.c, chSemReset()");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
cnt = sp->s_cnt;
|
cnt = sp->s_cnt;
|
||||||
|
@ -73,6 +75,7 @@ void chSemReset(Semaphore *sp, t_cnt n) {
|
||||||
void chSemResetI(Semaphore *sp, t_cnt n) {
|
void chSemResetI(Semaphore *sp, t_cnt n) {
|
||||||
t_cnt cnt;
|
t_cnt cnt;
|
||||||
|
|
||||||
|
chDbgAssert(n >= 0, "chsem.c, chSemResetI()");
|
||||||
cnt = sp->s_cnt;
|
cnt = sp->s_cnt;
|
||||||
sp->s_cnt = n;
|
sp->s_cnt = n;
|
||||||
while (cnt++ < 0)
|
while (cnt++ < 0)
|
||||||
|
@ -116,10 +119,7 @@ t_msg chSemWaitS(Semaphore *sp) {
|
||||||
#ifdef CH_USE_SEMAPHORES_TIMEOUT
|
#ifdef CH_USE_SEMAPHORES_TIMEOUT
|
||||||
static void wakeup(void *p) {
|
static void wakeup(void *p) {
|
||||||
|
|
||||||
#ifdef CH_USE_DEBUG
|
chDbgAssert(((Thread *)p)->p_state == PRWTSEM, "chsem.c, wakeup()");
|
||||||
if (((Thread *)p)->p_state != PRWTSEM)
|
|
||||||
chDbgPanic("chsem.c, wakeup()");
|
|
||||||
#endif
|
|
||||||
chSemFastSignalI(((Thread *)p)->p_semp);
|
chSemFastSignalI(((Thread *)p)->p_semp);
|
||||||
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,14 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CH_USE_DEBUG
|
||||||
|
static void memfill(BYTE8 *p, ULONG32 n, BYTE8 v) {
|
||||||
|
|
||||||
|
while (n)
|
||||||
|
*p++ = v, n--;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new thread.
|
* Creates a new thread.
|
||||||
* @param prio the priority level for the new thread. Usually the threads are
|
* @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) {
|
t_size wsize, t_tfunc pf, void *arg) {
|
||||||
Thread *tp = workspace;
|
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);
|
_InitThread(prio, mode, tp);
|
||||||
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
||||||
#ifdef CH_USE_RESUME
|
#ifdef CH_USE_RESUME
|
||||||
|
@ -108,6 +122,7 @@ Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
|
||||||
*/
|
*/
|
||||||
void chThdSetPriority(t_prio newprio) {
|
void chThdSetPriority(t_prio newprio) {
|
||||||
|
|
||||||
|
chDbgAssert(newprio <= HIGHPRIO, "chthreads.c, chThdSetPriority()")
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
#ifdef CH_USE_RT_SEMAPHORES
|
#ifdef CH_USE_RT_SEMAPHORES
|
||||||
|
@ -139,10 +154,7 @@ void chThdSuspend(Thread **tpp) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
#ifdef CH_USE_DEBUG
|
chDbgAssert(*tpp == NULL, "chthreads.c, chThdSuspend()");
|
||||||
if (*tpp)
|
|
||||||
chDbgPanic("chthreads.c, chThdSuspend()");
|
|
||||||
#endif
|
|
||||||
*tpp = currp;
|
*tpp = currp;
|
||||||
chSchGoSleepS(PRSUSPENDED);
|
chSchGoSleepS(PRSUSPENDED);
|
||||||
*tpp = NULL;
|
*tpp = NULL;
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
#define TRACE_BUFFER_SIZE 64
|
#define TRACE_BUFFER_SIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill value for threads working area in debug mode.
|
||||||
|
*/
|
||||||
|
#define MEM_FILL_PATTERN 0x55
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *cse_slpdata;
|
void *cse_slpdata;
|
||||||
t_time cse_time;
|
t_time cse_time;
|
||||||
|
@ -58,10 +63,24 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
#else /* CH_USE_DEBUG */
|
||||||
|
|
||||||
#define chDbgInit()
|
#define chDbgInit()
|
||||||
#define chDbgPanic(msg) {}
|
#define chDbgPanic(msg) {}
|
||||||
|
#define chDbgAssert(c, m) {}
|
||||||
|
|
||||||
#endif /* CH_USE_DEBUG */
|
#endif /* CH_USE_DEBUG */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue