aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-17 11:52:50 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-17 11:52:50 +0000
commit155ef8ed75b12442fde1d80e4ca880d0e7f7c1f1 (patch)
treecb27035ab0b6a7c157f992d9edb6a2c7c5d669e9 /os/rt/src
parent120b97e07051b35a67be2a173b51b7edc2a0ae19 (diff)
downloadChibiOS-155ef8ed75b12442fde1d80e4ca880d0e7f7c1f1.tar.gz
ChibiOS-155ef8ed75b12442fde1d80e4ca880d0e7f7c1f1.tar.bz2
ChibiOS-155ef8ed75b12442fde1d80e4ca880d0e7f7c1f1.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6169 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src')
-rw-r--r--os/rt/src/chcond.c30
-rw-r--r--os/rt/src/chdebug.c35
-rw-r--r--os/rt/src/chdynamic.c4
-rw-r--r--os/rt/src/chevents.c8
-rw-r--r--os/rt/src/chlists.c4
-rw-r--r--os/rt/src/chmboxes.c68
-rw-r--r--os/rt/src/chmtx.c2
-rw-r--r--os/rt/src/chschd.c6
-rw-r--r--os/rt/src/chsem.c46
-rw-r--r--os/rt/src/chsys.c10
-rw-r--r--os/rt/src/chthreads.c2
11 files changed, 104 insertions, 111 deletions
diff --git a/os/rt/src/chcond.c b/os/rt/src/chcond.c
index 9ea003c7b..cc3ee2e40 100644
--- a/os/rt/src/chcond.c
+++ b/os/rt/src/chcond.c
@@ -93,7 +93,7 @@ void chCondSignal(condition_variable_t *cp) {
chSysLock();
if (queue_notempty(&cp->c_queue))
- chSchWakeupS(queue_fifo_remove(&cp->c_queue), RDY_OK);
+ chSchWakeupS(queue_fifo_remove(&cp->c_queue), MSG_OK);
chSysUnlock();
}
@@ -115,7 +115,7 @@ void chCondSignalI(condition_variable_t *cp) {
if (queue_notempty(&cp->c_queue)) {
thread_t *tp = queue_fifo_remove(&cp->c_queue);
- tp->p_u.rdymsg = RDY_OK;
+ tp->p_u.rdymsg = MSG_OK;
chSchReadyI(tp);
}
}
@@ -152,10 +152,10 @@ void chCondBroadcastI(condition_variable_t *cp) {
chDbgCheck(cp != NULL);
/* Empties the condition variable queue and inserts all the threads into the
- ready list in FIFO order. The wakeup message is set to @p RDY_RESET in
+ ready list in FIFO order. The wakeup message is set to @p MSG_RESET in
order to make a chCondBroadcast() detectable from a chCondSignal().*/
while (cp->c_queue.p_next != (void *)&cp->c_queue)
- chSchReadyI(queue_fifo_remove(&cp->c_queue))->p_u.rdymsg = RDY_RESET;
+ chSchReadyI(queue_fifo_remove(&cp->c_queue))->p_u.rdymsg = MSG_RESET;
}
/**
@@ -168,9 +168,9 @@ void chCondBroadcastI(condition_variable_t *cp) {
* @param[in] cp pointer to the @p condition_variable_t structure
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condition variable has been signaled using
+ * @retval MSG_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condition variable has been signaled using
+ * @retval MSG_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
*
* @api
@@ -194,9 +194,9 @@ msg_t chCondWait(condition_variable_t *cp) {
* @param[in] cp pointer to the @p condition_variable_t structure
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condition variable has been signaled using
+ * @retval MSG_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condition variable has been signaled using
+ * @retval MSG_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
*
* @sclass
@@ -239,11 +239,11 @@ msg_t chCondWaitS(condition_variable_t *cp) {
* .
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condition variable has been signaled using
+ * @retval MSG_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condition variable has been signaled using
+ * @retval MSG_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
- * @retval RDY_TIMEOUT if the condition variable has not been signaled within
+ * @retval MSG_TIMEOUT if the condition variable has not been signaled within
* the specified timeout.
*
* @api
@@ -276,11 +276,11 @@ msg_t chCondWaitTimeout(condition_variable_t *cp, systime_t time) {
* .
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condition variable has been signaled using
+ * @retval MSG_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condition variable has been signaled using
+ * @retval MSG_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
- * @retval RDY_TIMEOUT if the condition variable has not been signaled within
+ * @retval MSG_TIMEOUT if the condition variable has not been signaled within
* the specified timeout.
*
* @sclass
@@ -297,7 +297,7 @@ msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time) {
currp->p_u.wtobjp = cp;
queue_prio_insert(currp, &cp->c_queue);
msg = chSchGoSleepTimeoutS(CH_STATE_WTCOND, time);
- if (msg != RDY_TIMEOUT)
+ if (msg != MSG_TIMEOUT)
chMtxLockS(mp);
return msg;
}
diff --git a/os/rt/src/chdebug.c b/os/rt/src/chdebug.c
index 05b746357..696a293cd 100644
--- a/os/rt/src/chdebug.c
+++ b/os/rt/src/chdebug.c
@@ -83,7 +83,7 @@
void _dbg_check_disable(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#1");
+ chSysHalt("SV#1");
}
/**
@@ -94,7 +94,7 @@ void _dbg_check_disable(void) {
void _dbg_check_suspend(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#2");
+ chSysHalt("SV#2");
}
/**
@@ -105,7 +105,7 @@ void _dbg_check_suspend(void) {
void _dbg_check_enable(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#3");
+ chSysHalt("SV#3");
}
/**
@@ -116,7 +116,7 @@ void _dbg_check_enable(void) {
void _dbg_check_lock(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#4");
+ chSysHalt("SV#4");
_dbg_enter_lock();
}
@@ -128,7 +128,7 @@ void _dbg_check_lock(void) {
void _dbg_check_unlock(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt <= 0))
- chDbgPanic("SV#5");
+ chSysHalt("SV#5");
_dbg_leave_lock();
}
@@ -140,7 +140,7 @@ void _dbg_check_unlock(void) {
void _dbg_check_lock_from_isr(void) {
if ((ch.dbg_isr_cnt <= 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#6");
+ chSysHalt("SV#6");
_dbg_enter_lock();
}
@@ -152,7 +152,7 @@ void _dbg_check_lock_from_isr(void) {
void _dbg_check_unlock_from_isr(void) {
if ((ch.dbg_isr_cnt <= 0) || (ch.dbg_lock_cnt <= 0))
- chDbgPanic("SV#7");
+ chSysHalt("SV#7");
_dbg_leave_lock();
}
@@ -165,7 +165,7 @@ void _dbg_check_enter_isr(void) {
port_lock_from_isr();
if ((ch.dbg_isr_cnt < 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#8");
+ chSysHalt("SV#8");
ch.dbg_isr_cnt++;
port_unlock_from_isr();
}
@@ -179,7 +179,7 @@ void _dbg_check_leave_isr(void) {
port_lock_from_isr();
if ((ch.dbg_isr_cnt <= 0) || (ch.dbg_lock_cnt != 0))
- chDbgPanic("SV#9");
+ chSysHalt("SV#9");
ch.dbg_isr_cnt--;
port_unlock_from_isr();
}
@@ -195,7 +195,7 @@ void _dbg_check_leave_isr(void) {
void chDbgCheckClassI(void) {
if ((ch.dbg_isr_cnt < 0) || (ch.dbg_lock_cnt <= 0))
- chDbgPanic("SV#10");
+ chSysHalt("SV#10");
}
/**
@@ -209,7 +209,7 @@ void chDbgCheckClassI(void) {
void chDbgCheckClassS(void) {
if ((ch.dbg_isr_cnt != 0) || (ch.dbg_lock_cnt <= 0))
- chDbgPanic("SV#11");
+ chSysHalt("SV#11");
}
#endif /* CH_DBG_SYSTEM_STATE_CHECK */
@@ -244,17 +244,4 @@ void _dbg_trace(thread_t *otp) {
}
#endif /* CH_DBG_ENABLE_TRACE */
-#if CH_DBG_ENABLED || defined(__DOXYGEN__)
-/**
- * @brief Prints a panic message on the console and then halts the system.
- *
- * @param[in] msg the pointer to the panic message string
- */
-void chDbgPanic(const char *msg) {
-
- ch.dbg_panic_msg = msg;
- chSysHalt();
-}
-#endif /* CH_DBG_ENABLED */
-
/** @} */
diff --git a/os/rt/src/chdynamic.c b/os/rt/src/chdynamic.c
index 5f174eda7..5dbea6c7e 100644
--- a/os/rt/src/chdynamic.c
+++ b/os/rt/src/chdynamic.c
@@ -165,7 +165,7 @@ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
chSysLock();
tp = chThdCreateI(wsp, size, prio, pf, arg);
tp->p_flags = CH_FLAG_MODE_HEAP;
- chSchWakeupS(tp, RDY_OK);
+ chSchWakeupS(tp, MSG_OK);
chSysUnlock();
return tp;
}
@@ -217,7 +217,7 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,
tp = chThdCreateI(wsp, mp->mp_object_size, prio, pf, arg);
tp->p_flags = CH_FLAG_MODE_MEMPOOL;
tp->p_mpool = mp;
- chSchWakeupS(tp, RDY_OK);
+ chSchWakeupS(tp, MSG_OK);
chSysUnlock();
return tp;
}
diff --git a/os/rt/src/chevents.c b/os/rt/src/chevents.c
index ad59f51c0..6b76d0480 100644
--- a/os/rt/src/chevents.c
+++ b/os/rt/src/chevents.c
@@ -279,7 +279,7 @@ void chEvtSignalI(thread_t *tp, eventmask_t mask) {
((tp->p_epending & tp->p_u.ewmask) != 0)) ||
((tp->p_state == CH_STATE_WTANDEVT) &&
((tp->p_epending & tp->p_u.ewmask) == tp->p_u.ewmask))) {
- tp->p_u.rdymsg = RDY_OK;
+ tp->p_u.rdymsg = MSG_OK;
chSchReadyI(tp);
}
}
@@ -475,7 +475,7 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time) {
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
- if (chSchGoSleepTimeoutS(CH_STATE_WTOREVT, time) < RDY_OK) {
+ if (chSchGoSleepTimeoutS(CH_STATE_WTOREVT, time) < MSG_OK) {
chSysUnlock();
return (eventmask_t)0;
}
@@ -518,7 +518,7 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time) {
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
- if (chSchGoSleepTimeoutS(CH_STATE_WTOREVT, time) < RDY_OK) {
+ if (chSchGoSleepTimeoutS(CH_STATE_WTOREVT, time) < MSG_OK) {
chSysUnlock();
return (eventmask_t)0;
}
@@ -558,7 +558,7 @@ eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time) {
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
- if (chSchGoSleepTimeoutS(CH_STATE_WTANDEVT, time) < RDY_OK) {
+ if (chSchGoSleepTimeoutS(CH_STATE_WTANDEVT, time) < MSG_OK) {
chSysUnlock();
return (eventmask_t)0;
}
diff --git a/os/rt/src/chlists.c b/os/rt/src/chlists.c
index 5bba30078..a0b4df08b 100644
--- a/os/rt/src/chlists.c
+++ b/os/rt/src/chlists.c
@@ -67,7 +67,7 @@
* .
* @return The message from @p osalQueueWakeupOneI() or
* @p osalQueueWakeupAllI() functions.
- * @retval RDY_TIMEOUT if the thread has not been dequeued within the
+ * @retval MSG_TIMEOUT if the thread has not been dequeued within the
* specified timeout or if the function has been
* invoked with @p TIME_IMMEDIATE as timeout
* specification.
@@ -77,7 +77,7 @@
msg_t chQueueGoSleepTimeoutS(threads_queue_t *tqp, systime_t time) {
if (TIME_IMMEDIATE == time)
- return RDY_TIMEOUT;
+ return MSG_TIMEOUT;
queue_insert(currp, tqp);
return chSchGoSleepTimeoutS(CH_STATE_QUEUED, time);
diff --git a/os/rt/src/chmboxes.c b/os/rt/src/chmboxes.c
index 003c779ec..8e9e2bb40 100644
--- a/os/rt/src/chmboxes.c
+++ b/os/rt/src/chmboxes.c
@@ -96,7 +96,7 @@ void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n) {
/**
* @brief Resets a @p mailbox_t object.
- * @details All the waiting threads are resumed with status @p RDY_RESET and
+ * @details All the waiting threads are resumed with status @p MSG_RESET and
* the queued messages are lost.
*
* @param[in] mbp the pointer to an initialized @p mailbox_t object
@@ -128,9 +128,9 @@ void chMBReset(mailbox_t *mbp) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @api
*/
@@ -156,9 +156,9 @@ msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t time) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @sclass
*/
@@ -169,7 +169,7 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t time) {
chDbgCheck(mbp != NULL);
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, time);
- if (rdymsg == RDY_OK) {
+ if (rdymsg == MSG_OK) {
*mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top)
mbp->mb_wrptr = mbp->mb_buffer;
@@ -187,8 +187,8 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t time) {
* @param[in] mbp the pointer to an initialized @p mailbox_t object
* @param[in] msg the message to be posted on the mailbox
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_TIMEOUT if the mailbox is full and the message cannot be
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_TIMEOUT if the mailbox is full and the message cannot be
* posted.
*
* @iclass
@@ -199,13 +199,13 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
chDbgCheck(mbp != NULL);
if (chSemGetCounterI(&mbp->mb_emptysem) <= 0)
- return RDY_TIMEOUT;
+ return MSG_TIMEOUT;
chSemFastWaitI(&mbp->mb_emptysem);
*mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top)
mbp->mb_wrptr = mbp->mb_buffer;
chSemSignalI(&mbp->mb_fullsem);
- return RDY_OK;
+ return MSG_OK;
}
/**
@@ -221,9 +221,9 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @api
*/
@@ -249,9 +249,9 @@ msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t time) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @sclass
*/
@@ -262,7 +262,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t time) {
chDbgCheck(mbp != NULL);
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, time);
- if (rdymsg == RDY_OK) {
+ if (rdymsg == MSG_OK) {
if (--mbp->mb_rdptr < mbp->mb_buffer)
mbp->mb_rdptr = mbp->mb_top - 1;
*mbp->mb_rdptr = msg;
@@ -280,8 +280,8 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t time) {
* @param[in] mbp the pointer to an initialized @p mailbox_t object
* @param[in] msg the message to be posted on the mailbox
* @return The operation status.
- * @retval RDY_OK if a message has been correctly posted.
- * @retval RDY_TIMEOUT if the mailbox is full and the message cannot be
+ * @retval MSG_OK if a message has been correctly posted.
+ * @retval MSG_TIMEOUT if the mailbox is full and the message cannot be
* posted.
*
* @iclass
@@ -292,13 +292,13 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
chDbgCheck(mbp != NULL);
if (chSemGetCounterI(&mbp->mb_emptysem) <= 0)
- return RDY_TIMEOUT;
+ return MSG_TIMEOUT;
chSemFastWaitI(&mbp->mb_emptysem);
if (--mbp->mb_rdptr < mbp->mb_buffer)
mbp->mb_rdptr = mbp->mb_top - 1;
*mbp->mb_rdptr = msg;
chSemSignalI(&mbp->mb_fullsem);
- return RDY_OK;
+ return MSG_OK;
}
/**
@@ -314,9 +314,9 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly fetched.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly fetched.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @api
*/
@@ -342,9 +342,9 @@ msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t time) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval RDY_OK if a message has been correctly fetched.
- * @retval RDY_RESET if the mailbox has been reset while waiting.
- * @retval RDY_TIMEOUT if the operation has timed out.
+ * @retval MSG_OK if a message has been correctly fetched.
+ * @retval MSG_RESET if the mailbox has been reset while waiting.
+ * @retval MSG_TIMEOUT if the operation has timed out.
*
* @sclass
*/
@@ -355,7 +355,7 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t time) {
chDbgCheck((mbp != NULL) && (msgp != NULL));
rdymsg = chSemWaitTimeoutS(&mbp->mb_fullsem, time);
- if (rdymsg == RDY_OK) {
+ if (rdymsg == MSG_OK) {
*msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top)
mbp->mb_rdptr = mbp->mb_buffer;
@@ -373,8 +373,8 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t time) {
* @param[in] mbp the pointer to an initialized @p mailbox_t object
* @param[out] msgp pointer to a message variable for the received message
* @return The operation status.
- * @retval RDY_OK if a message has been correctly fetched.
- * @retval RDY_TIMEOUT if the mailbox is empty and a message cannot be
+ * @retval MSG_OK if a message has been correctly fetched.
+ * @retval MSG_TIMEOUT if the mailbox is empty and a message cannot be
* fetched.
*
* @iclass
@@ -385,13 +385,13 @@ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) {
chDbgCheck((mbp != NULL) && (msgp != NULL));
if (chSemGetCounterI(&mbp->mb_fullsem) <= 0)
- return RDY_TIMEOUT;
+ return MSG_TIMEOUT;
chSemFastWaitI(&mbp->mb_fullsem);
*msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top)
mbp->mb_rdptr = mbp->mb_buffer;
chSemSignalI(&mbp->mb_emptysem);
- return RDY_OK;
+ return MSG_OK;
}
#endif /* CH_CFG_USE_MAILBOXES */
diff --git a/os/rt/src/chmtx.c b/os/rt/src/chmtx.c
index 0eb02e2b5..001fa1dc3 100644
--- a/os/rt/src/chmtx.c
+++ b/os/rt/src/chmtx.c
@@ -315,7 +315,7 @@ mutex_t *chMtxUnlock(void) {
ump->m_owner = tp;
ump->m_next = tp->p_mtxlist;
tp->p_mtxlist = ump;
- chSchWakeupS(tp, RDY_OK);
+ chSchWakeupS(tp, MSG_OK);
}
else
ump->m_owner = NULL;
diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c
index f03c5eff3..572b2f822 100644
--- a/os/rt/src/chschd.c
+++ b/os/rt/src/chschd.c
@@ -159,7 +159,7 @@ static void wakeup(void *p) {
/* States requiring dequeuing.*/
queue_dequeue(tp);
}
- tp->p_u.rdymsg = RDY_TIMEOUT;
+ tp->p_u.rdymsg = MSG_TIMEOUT;
chSchReadyI(tp);
chSysUnlockFromISR();
}
@@ -169,7 +169,7 @@ static void wakeup(void *p) {
* timeout specification.
* @details The thread goes into a sleeping state, if it is not awakened
* explicitly within the specified timeout then it is forcibly
- * awakened with a @p RDY_TIMEOUT low level message. The possible
+ * awakened with a @p MSG_TIMEOUT low level message. The possible
* @ref thread_states are defined into @p threads.h.
*
* @param[in] newstate the new thread state
@@ -181,7 +181,7 @@ static void wakeup(void *p) {
* - @a TIME_IMMEDIATE this value is not allowed.
* .
* @return The wakeup message.
- * @retval RDY_TIMEOUT if a timeout occurs.
+ * @retval MSG_TIMEOUT if a timeout occurs.
*
* @sclass
*/
diff --git a/os/rt/src/chsem.c b/os/rt/src/chsem.c
index 388e50bc6..22e4413b6 100644
--- a/os/rt/src/chsem.c
+++ b/os/rt/src/chsem.c
@@ -111,7 +111,7 @@ void chSemObjectInit(semaphore_t *sp, cnt_t n) {
* to the specified, non negative, value.
* @note The released threads can recognize they were waked up by a reset
* rather than a signal because the @p chSemWait() will return
- * @p RDY_RESET instead of @p RDY_OK.
+ * @p MSG_RESET instead of @p MSG_OK.
*
* @param[in] sp pointer to a @p semaphore_t structure
* @param[in] n the new value of the semaphore counter. The value must
@@ -138,7 +138,7 @@ void chSemReset(semaphore_t *sp, cnt_t n) {
* reschedule must not be performed in ISRs.
* @note The released threads can recognize they were waked up by a reset
* rather than a signal because the @p chSemWait() will return
- * @p RDY_RESET instead of @p RDY_OK.
+ * @p MSG_RESET instead of @p MSG_OK.
*
* @param[in] sp pointer to a @p semaphore_t structure
* @param[in] n the new value of the semaphore counter. The value must
@@ -158,7 +158,7 @@ void chSemResetI(semaphore_t *sp, cnt_t n) {
cnt = sp->s_cnt;
sp->s_cnt = n;
while (++cnt <= 0)
- chSchReadyI(queue_lifo_remove(&sp->s_queue))->p_u.rdymsg = RDY_RESET;
+ chSchReadyI(queue_lifo_remove(&sp->s_queue))->p_u.rdymsg = MSG_RESET;
}
/**
@@ -167,9 +167,9 @@ void chSemResetI(semaphore_t *sp, cnt_t n) {
* @param[in] sp pointer to a @p semaphore_t structure
* @return A message specifying how the invoking thread has been
* released from the semaphore.
- * @retval RDY_OK if the thread has not stopped on the semaphore or the
+ * @retval MSG_OK if the thread has not stopped on the semaphore or the
* semaphore has been signaled.
- * @retval RDY_RESET if the semaphore has been reset using @p chSemReset().
+ * @retval MSG_RESET if the semaphore has been reset using @p chSemReset().
*
* @api
*/
@@ -188,9 +188,9 @@ msg_t chSemWait(semaphore_t *sp) {
* @param[in] sp pointer to a @p semaphore_t structure
* @return A message specifying how the invoking thread has been
* released from the semaphore.
- * @retval RDY_OK if the thread has not stopped on the semaphore or the
+ * @retval MSG_OK if the thread has not stopped on the semaphore or the
* semaphore has been signaled.
- * @retval RDY_RESET if the semaphore has been reset using @p chSemReset().
+ * @retval MSG_RESET if the semaphore has been reset using @p chSemReset().
*
* @sclass
*/
@@ -208,7 +208,7 @@ msg_t chSemWaitS(semaphore_t *sp) {
chSchGoSleepS(CH_STATE_WTSEM);
return currp->p_u.rdymsg;
}
- return RDY_OK;
+ return MSG_OK;
}
/**
@@ -222,10 +222,10 @@ msg_t chSemWaitS(semaphore_t *sp) {
* .
* @return A message specifying how the invoking thread has been
* released from the semaphore.
- * @retval RDY_OK if the thread has not stopped on the semaphore or the
+ * @retval MSG_OK if the thread has not stopped on the semaphore or the
* semaphore has been signaled.
- * @retval RDY_RESET if the semaphore has been reset using @p chSemReset().
- * @retval RDY_TIMEOUT if the semaphore has not been signaled or reset within
+ * @retval MSG_RESET if the semaphore has been reset using @p chSemReset().
+ * @retval MSG_TIMEOUT if the semaphore has not been signaled or reset within
* the specified timeout.
*
* @api
@@ -250,10 +250,10 @@ msg_t chSemWaitTimeout(semaphore_t *sp, systime_t time) {
* .
* @return A message specifying how the invoking thread has been
* released from the semaphore.
- * @retval RDY_OK if the thread has not stopped on the semaphore or the
+ * @retval MSG_OK if the thread has not stopped on the semaphore or the
* semaphore has been signaled.
- * @retval RDY_RESET if the semaphore has been reset using @p chSemReset().
- * @retval RDY_TIMEOUT if the semaphore has not been signaled or reset within
+ * @retval MSG_RESET if the semaphore has been reset using @p chSemReset().
+ * @retval MSG_TIMEOUT if the semaphore has not been signaled or reset within
* the specified timeout.
*
* @sclass
@@ -269,13 +269,13 @@ msg_t chSemWaitTimeoutS(semaphore_t *sp, systime_t time) {
if (--sp->s_cnt < 0) {
if (TIME_IMMEDIATE == time) {
sp->s_cnt++;
- return RDY_TIMEOUT;
+ return MSG_TIMEOUT;
}
currp->p_u.wtobjp = sp;
sem_insert(currp, &sp->s_queue);
return chSchGoSleepTimeoutS(CH_STATE_WTSEM, time);
}
- return RDY_OK;
+ return MSG_OK;
}
/**
@@ -294,7 +294,7 @@ void chSemSignal(semaphore_t *sp) {
chSysLock();
if (++sp->s_cnt <= 0)
- chSchWakeupS(queue_fifo_remove(&sp->s_queue), RDY_OK);
+ chSchWakeupS(queue_fifo_remove(&sp->s_queue), MSG_OK);
chSysUnlock();
}
@@ -321,7 +321,7 @@ void chSemSignalI(semaphore_t *sp) {
/* Note, it is done this way in order to allow a tail call on
chSchReadyI().*/
thread_t *tp = queue_fifo_remove(&sp->s_queue);
- tp->p_u.rdymsg = RDY_OK;
+ tp->p_u.rdymsg = MSG_OK;
chSchReadyI(tp);
}
}
@@ -349,7 +349,7 @@ void chSemAddCounterI(semaphore_t *sp, cnt_t n) {
while (n > 0) {
if (++sp->s_cnt <= 0)
- chSchReadyI(queue_fifo_remove(&sp->s_queue))->p_u.rdymsg = RDY_OK;
+ chSchReadyI(queue_fifo_remove(&sp->s_queue))->p_u.rdymsg = MSG_OK;
n--;
}
}
@@ -361,9 +361,9 @@ void chSemAddCounterI(semaphore_t *sp, cnt_t n) {
* @param[in] spw pointer to a @p semaphore_t structure to wait on
* @return A message specifying how the invoking thread has been
* released from the semaphore.
- * @retval RDY_OK if the thread has not stopped on the semaphore or the
+ * @retval MSG_OK if the thread has not stopped on the semaphore or the
* semaphore has been signaled.
- * @retval RDY_RESET if the semaphore has been reset using @p chSemReset().
+ * @retval MSG_RESET if the semaphore has been reset using @p chSemReset().
*
* @api
*/
@@ -380,7 +380,7 @@ msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
chSysLock();
if (++sps->s_cnt <= 0)
- chSchReadyI(queue_fifo_remove(&sps->s_queue))->p_u.rdymsg = RDY_OK;
+ chSchReadyI(queue_fifo_remove(&sps->s_queue))->p_u.rdymsg = MSG_OK;
if (--spw->s_cnt < 0) {
thread_t *ctp = currp;
sem_insert(ctp, &spw->s_queue);
@@ -390,7 +390,7 @@ msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
}
else {
chSchRescheduleS();
- msg = RDY_OK;
+ msg = MSG_OK;
}
chSysUnlock();
return msg;
diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c
index 9212cbf5f..89c2db5f7 100644
--- a/os/rt/src/chsys.c
+++ b/os/rt/src/chsys.c
@@ -166,12 +166,18 @@ void chSysInit(void) {
*
* @special
*/
-void chSysHalt(void) {
+void chSysHalt(const char *reason) {
port_disable();
+#if CH_DBG_ENABLED
+ ch.dbg_panic_msg = reason;
+#else
+ (void)reason;
+#endif
+
#if defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
- CH_CFG_SYSTEM_HALT_HOOK();
+ CH_CFG_SYSTEM_HALT_HOOK(reason);
#endif
/* Harmless infinite loop.*/
diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c
index dbcd1f754..5aaaeb5aa 100644
--- a/os/rt/src/chthreads.c
+++ b/os/rt/src/chthreads.c
@@ -217,7 +217,7 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
CH_DBG_STACK_FILL_VALUE);
#endif
chSysLock();
- chSchWakeupS(tp = chThdCreateI(wsp, size, prio, pf, arg), RDY_OK);
+ chSchWakeupS(tp = chThdCreateI(wsp, size, prio, pf, arg), MSG_OK);
chSysUnlock();
return tp;
}