Removed the CH_USE_SEMAPHORES_TIMEOUT configuration option.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@962 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
7506cef74c
commit
a6feec221c
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW FALSE
|
#define CH_USE_SEMSW FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT FALSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -104,8 +104,10 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
removed the CH_USE_MESSAGES_EVENT configuration option.
|
removed the CH_USE_MESSAGES_EVENT configuration option.
|
||||||
- CHANGE: Modified the test suite assertions in order to save RAM on the AVR
|
- CHANGE: Modified the test suite assertions in order to save RAM on the AVR
|
||||||
targets. The test suite now uses much less string space.
|
targets. The test suite now uses much less string space.
|
||||||
- CHANGE: Removed the CH_USE_SERIAL_HALFDUPLEX, CH_USE_QUEUES_TIMEOUT and
|
- CHANGE: Removed the CH_USE_SERIAL_HALFDUPLEX, CH_USE_QUEUES_TIMEOUT,
|
||||||
CH_USE_QUEUES_HALFDUPLEX configuration options.
|
CH_USE_QUEUES_HALFDUPLEX, CH_USE_SEMAPHORES_TIMEOUT configuration options.
|
||||||
|
- CHANGE: Made CH_DBG_THREADS_PROFILING default to TRUE in all demos because
|
||||||
|
the changes to the function test_cpu_pulse().
|
||||||
|
|
||||||
*** 1.2.0 ***
|
*** 1.2.0 ***
|
||||||
- Added license exception text to the 1.2.0 branch.
|
- Added license exception text to the 1.2.0 branch.
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <ch.h>
|
#include <ch.h>
|
||||||
|
|
||||||
#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT
|
#if CH_USE_MAILBOXES
|
||||||
/**
|
/**
|
||||||
* @brief Initializes a Mailbox object.
|
* @brief Initializes a Mailbox object.
|
||||||
*
|
*
|
||||||
|
@ -239,6 +239,6 @@ msg_t chMBFetchS(Mailbox *mbp, msg_t *msgp, systime_t time) {
|
||||||
}
|
}
|
||||||
return rdymsg;
|
return rdymsg;
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT */
|
#endif /* CH_USE_MAILBOXES */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -90,39 +90,6 @@ msg_t chIQPutI(InputQueue *iqp, uint8_t b) {
|
||||||
return Q_OK;
|
return Q_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !CH_USE_SEMAPHORES_TIMEOUT || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief Input queue read.
|
|
||||||
* @details This function reads a byte value from an input queue. If the queue
|
|
||||||
* is empty then the calling thread is suspended until a byte arrives
|
|
||||||
* in the queue.
|
|
||||||
*
|
|
||||||
* @param[in] iqp pointer to an @p InputQueue structure
|
|
||||||
* @return A byte value from the queue or:
|
|
||||||
* @retval Q_RESET if the queue was reset.
|
|
||||||
*/
|
|
||||||
msg_t chIQGet(InputQueue *iqp) {
|
|
||||||
uint8_t b;
|
|
||||||
msg_t msg;
|
|
||||||
|
|
||||||
chSysLock();
|
|
||||||
if ((msg = chSemWaitS(&iqp->q_sem)) < RDY_OK) {
|
|
||||||
chSysUnlock();
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
b = *iqp->q_rdptr++;
|
|
||||||
if (iqp->q_rdptr >= iqp->q_top)
|
|
||||||
iqp->q_rdptr = iqp->q_buffer;
|
|
||||||
|
|
||||||
if (iqp->q_notify)
|
|
||||||
iqp->q_notify();
|
|
||||||
|
|
||||||
chSysUnlock();
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
#endif /* !CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief Input queue read with timeout.
|
* @brief Input queue read with timeout.
|
||||||
* @details This function reads a byte value from an input queue. If the queue
|
* @details This function reads a byte value from an input queue. If the queue
|
||||||
|
@ -138,9 +105,6 @@ msg_t chIQGet(InputQueue *iqp) {
|
||||||
* @return A byte value from the queue or:
|
* @return A byte value from the queue or:
|
||||||
* @retval Q_TIMEOUT if the specified time expired.
|
* @retval Q_TIMEOUT if the specified time expired.
|
||||||
* @retval Q_RESET if the queue was reset.
|
* @retval Q_RESET if the queue was reset.
|
||||||
*
|
|
||||||
* @note The function is only available when the @p CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
* kernel option is activated,
|
|
||||||
*/
|
*/
|
||||||
msg_t chIQGetTimeout(InputQueue *iqp, systime_t timeout) {
|
msg_t chIQGetTimeout(InputQueue *iqp, systime_t timeout) {
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
@ -161,7 +125,6 @@ msg_t chIQGetTimeout(InputQueue *iqp, systime_t timeout) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Non-blocking read.
|
* @brief Non-blocking read.
|
||||||
|
@ -241,40 +204,6 @@ void chOQResetI(OutputQueue *oqp) {
|
||||||
chSemResetI(&oqp->q_sem, (cnt_t)(oqp->q_top - oqp->q_buffer));
|
chSemResetI(&oqp->q_sem, (cnt_t)(oqp->q_top - oqp->q_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !CH_USE_SEMAPHORES_TIMEOUT || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief Output queue write.
|
|
||||||
* @details This function writes a byte value to an output queue. If the queue
|
|
||||||
* is full then the calling thread is suspended until there is space
|
|
||||||
* in the queue.
|
|
||||||
*
|
|
||||||
* @param[in] oqp pointer to an @p OutputQueue structure
|
|
||||||
* @param[in] b the byte value to be written in the queue
|
|
||||||
* @return The operation status:
|
|
||||||
* @retval Q_OK if the operation succeeded.
|
|
||||||
* @retval Q_RESET if the queue was reset.
|
|
||||||
*/
|
|
||||||
msg_t chOQPut(OutputQueue *oqp, uint8_t b) {
|
|
||||||
msg_t msg;
|
|
||||||
|
|
||||||
chSysLock();
|
|
||||||
if ((msg = chSemWaitS(&oqp->q_sem)) < RDY_OK) {
|
|
||||||
chSysUnlock();
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
*oqp->q_wrptr++ = b;
|
|
||||||
if (oqp->q_wrptr >= oqp->q_top)
|
|
||||||
oqp->q_wrptr = oqp->q_buffer;
|
|
||||||
|
|
||||||
if (oqp->q_notify)
|
|
||||||
oqp->q_notify();
|
|
||||||
|
|
||||||
chSysUnlock();
|
|
||||||
return Q_OK;
|
|
||||||
}
|
|
||||||
#endif /* !CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief Output queue write with timeout.
|
* @brief Output queue write with timeout.
|
||||||
* @details This function writes a byte value to an output queue. If the queue
|
* @details This function writes a byte value to an output queue. If the queue
|
||||||
|
@ -292,9 +221,6 @@ msg_t chOQPut(OutputQueue *oqp, uint8_t b) {
|
||||||
* @retval Q_OK if the operation succeeded.
|
* @retval Q_OK if the operation succeeded.
|
||||||
* @retval Q_TIMEOUT if the specified time expired.
|
* @retval Q_TIMEOUT if the specified time expired.
|
||||||
* @retval Q_RESET if the queue was reset.
|
* @retval Q_RESET if the queue was reset.
|
||||||
*
|
|
||||||
* @note The function is only available when the @p CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
* kernel option is activated,
|
|
||||||
*/
|
*/
|
||||||
msg_t chOQPutTimeout(OutputQueue *oqp, uint8_t b, systime_t timeout) {
|
msg_t chOQPutTimeout(OutputQueue *oqp, uint8_t b, systime_t timeout) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
@ -314,7 +240,6 @@ msg_t chOQPutTimeout(OutputQueue *oqp, uint8_t b, systime_t timeout) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
return Q_OK;
|
return Q_OK;
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Output queue read.
|
* @brief Output queue read.
|
||||||
|
|
|
@ -127,7 +127,6 @@ msg_t chSemWaitS(Semaphore *sp) {
|
||||||
return RDY_OK;
|
return RDY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a wait operation on a semaphore with timeout specification.
|
* @brief Performs a wait operation on a semaphore with timeout specification.
|
||||||
*
|
*
|
||||||
|
@ -141,8 +140,6 @@ msg_t chSemWaitS(Semaphore *sp) {
|
||||||
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the
|
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the
|
||||||
* specified timeout.
|
* specified timeout.
|
||||||
* @note The function is available only if the @p CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
* option is enabled in @p chconf.h.
|
|
||||||
*/
|
*/
|
||||||
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
@ -166,8 +163,6 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
|
||||||
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
|
||||||
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the specified
|
* @retval RDY_TIMEOUT if the semaphore was not signaled or reset within the specified
|
||||||
* timeout.
|
* timeout.
|
||||||
* @note The function is available only if the @p CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
* option is enabled in @p chconf.h.
|
|
||||||
*/
|
*/
|
||||||
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
||||||
|
|
||||||
|
@ -184,7 +179,6 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
|
||||||
}
|
}
|
||||||
return RDY_OK;
|
return RDY_OK;
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a signal operation on a semaphore.
|
* @brief Performs a signal operation on a semaphore.
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#ifndef _MAILBOXES_H_
|
#ifndef _MAILBOXES_H_
|
||||||
#define _MAILBOXES_H_
|
#define _MAILBOXES_H_
|
||||||
|
|
||||||
#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT
|
#if CH_USE_MAILBOXES
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
msg_t *mb_buffer; /**< Pointer to the mailbox buffer.*/
|
msg_t *mb_buffer; /**< Pointer to the mailbox buffer.*/
|
||||||
|
@ -91,7 +91,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define chMBPeek(mbp) (*(mbp)->mb_rdptr)
|
#define chMBPeek(mbp) (*(mbp)->mb_rdptr)
|
||||||
|
|
||||||
#endif /* CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT */
|
#endif /* CH_USE_MAILBOXES */
|
||||||
|
|
||||||
#endif /* _MAILBOXES_H_ */
|
#endif /* _MAILBOXES_H_ */
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,17 @@ typedef GenericQueue InputQueue;
|
||||||
/** Evaluates to @p TRUE if the specified Input Queue is full. */
|
/** Evaluates to @p TRUE if the specified Input Queue is full. */
|
||||||
#define chIQIsFull(q) (chQSpace(q) >= chQSize(q))
|
#define chIQIsFull(q) (chQSpace(q) >= chQSize(q))
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
/**
|
||||||
/*
|
* @brief Input queue read.
|
||||||
* When semaphores timeout is available this API is implemented as a
|
* @details This function reads a byte value from an input queue. If the queue
|
||||||
* special case of the more general chIQGetTimeout().
|
* is empty then the calling thread is suspended until a byte arrives
|
||||||
|
* in the queue.
|
||||||
|
*
|
||||||
|
* @param[in] iqp pointer to an @p InputQueue structure
|
||||||
|
* @return A byte value from the queue or:
|
||||||
|
* @retval Q_RESET if the queue was reset.
|
||||||
*/
|
*/
|
||||||
#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE)
|
#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE)
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Output queue structure.
|
* @brief Output queue structure.
|
||||||
|
@ -116,13 +120,19 @@ typedef GenericQueue OutputQueue;
|
||||||
/** Evaluates to @p TRUE if the specified Output Queue is full. */
|
/** Evaluates to @p TRUE if the specified Output Queue is full. */
|
||||||
#define chOQIsFull(q) (chQSpace(q) <= 0)
|
#define chOQIsFull(q) (chQSpace(q) <= 0)
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
/**
|
||||||
/*
|
* @brief Output queue write.
|
||||||
* When semaphores timeout is available this API is implemented as a
|
* @details This function writes a byte value to an output queue. If the queue
|
||||||
* special case of the more general chOQPutTimeout().
|
* is full then the calling thread is suspended until there is space
|
||||||
|
* in the queue.
|
||||||
|
*
|
||||||
|
* @param[in] oqp pointer to an @p OutputQueue structure
|
||||||
|
* @param[in] b the byte value to be written in the queue
|
||||||
|
* @return The operation status:
|
||||||
|
* @retval Q_OK if the operation succeeded.
|
||||||
|
* @retval Q_RESET if the queue was reset.
|
||||||
*/
|
*/
|
||||||
#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE)
|
#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -130,17 +140,11 @@ extern "C" {
|
||||||
void chIQInit(InputQueue *qp, uint8_t *buffer, size_t size, qnotify_t inotify);
|
void chIQInit(InputQueue *qp, uint8_t *buffer, size_t size, qnotify_t inotify);
|
||||||
void chIQResetI(InputQueue *qp);
|
void chIQResetI(InputQueue *qp);
|
||||||
msg_t chIQPutI(InputQueue *qp, uint8_t b);
|
msg_t chIQPutI(InputQueue *qp, uint8_t b);
|
||||||
#if !CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
msg_t chIQGet(InputQueue *qp);
|
|
||||||
#endif
|
|
||||||
msg_t chIQGetTimeout(InputQueue *qp, systime_t timeout);
|
msg_t chIQGetTimeout(InputQueue *qp, systime_t timeout);
|
||||||
size_t chIQRead(InputQueue *qp, uint8_t *buffer, size_t n);
|
size_t chIQRead(InputQueue *qp, uint8_t *buffer, size_t n);
|
||||||
|
|
||||||
void chOQInit(OutputQueue *queue, uint8_t *buffer, size_t size, qnotify_t onotify);
|
void chOQInit(OutputQueue *queue, uint8_t *buffer, size_t size, qnotify_t onotify);
|
||||||
void chOQResetI(OutputQueue *queue);
|
void chOQResetI(OutputQueue *queue);
|
||||||
#if !CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
msg_t chOQPut(OutputQueue *queue, uint8_t b);
|
|
||||||
#endif
|
|
||||||
msg_t chOQPutTimeout(OutputQueue *queue, uint8_t b, systime_t timeout);
|
msg_t chOQPutTimeout(OutputQueue *queue, uint8_t b, systime_t timeout);
|
||||||
msg_t chOQGetI(OutputQueue *queue);
|
msg_t chOQGetI(OutputQueue *queue);
|
||||||
size_t chOQWrite(OutputQueue *queue, uint8_t *buffer, size_t n);
|
size_t chOQWrite(OutputQueue *queue, uint8_t *buffer, size_t n);
|
||||||
|
|
|
@ -46,10 +46,8 @@ extern "C" {
|
||||||
void chSemResetI(Semaphore *sp, cnt_t n);
|
void chSemResetI(Semaphore *sp, cnt_t n);
|
||||||
msg_t chSemWait(Semaphore *sp);
|
msg_t chSemWait(Semaphore *sp);
|
||||||
msg_t chSemWaitS(Semaphore *sp);
|
msg_t chSemWaitS(Semaphore *sp);
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time);
|
msg_t chSemWaitTimeout(Semaphore *sp, systime_t time);
|
||||||
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time);
|
msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time);
|
||||||
#endif
|
|
||||||
void chSemSignal(Semaphore *sp);
|
void chSemSignal(Semaphore *sp);
|
||||||
void chSemSignalI(Semaphore *sp);
|
void chSemSignalI(Semaphore *sp);
|
||||||
#if CH_USE_SEMSW
|
#if CH_USE_SEMSW
|
||||||
|
|
|
@ -176,12 +176,10 @@ namespace chibios_rt {
|
||||||
return chSemWait(&sem);
|
return chSemWait(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
msg_t Semaphore::WaitTimeout(systime_t time) {
|
msg_t Semaphore::WaitTimeout(systime_t time) {
|
||||||
|
|
||||||
return chSemWaitTimeout(&sem, time);
|
return chSemWaitTimeout(&sem, time);
|
||||||
}
|
}
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
void Semaphore::Signal(void) {
|
void Semaphore::Signal(void) {
|
||||||
|
|
||||||
|
|
|
@ -315,7 +315,6 @@ namespace chibios_rt {
|
||||||
*/
|
*/
|
||||||
msg_t Wait(void);
|
msg_t Wait(void);
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
/**
|
/**
|
||||||
* @brief Wait operation on the semaphore with timeout.
|
* @brief Wait operation on the semaphore with timeout.
|
||||||
*
|
*
|
||||||
|
@ -326,7 +325,6 @@ namespace chibios_rt {
|
||||||
* specified timeout.
|
* specified timeout.
|
||||||
*/
|
*/
|
||||||
msg_t WaitTimeout(systime_t time);
|
msg_t WaitTimeout(systime_t time);
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Signal operation on the semaphore.
|
* @brief Signal operation on the semaphore.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -153,16 +153,6 @@
|
||||||
#define CH_USE_SEMSW TRUE
|
#define CH_USE_SEMSW TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* If specified then the Semaphores with timeout APIs are included in the
|
|
||||||
* kernel.
|
|
||||||
* @note The default is @p TRUE.
|
|
||||||
* @note Requires @p CH_USE_SEMAPHORES.
|
|
||||||
*/
|
|
||||||
#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__)
|
|
||||||
#define CH_USE_SEMAPHORES_TIMEOUT TRUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specified then the Mutexes APIs are included in the kernel.
|
* If specified then the Mutexes APIs are included in the kernel.
|
||||||
* @note The default is @p TRUE.
|
* @note The default is @p TRUE.
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
* <h2>Preconditions</h2>
|
* <h2>Preconditions</h2>
|
||||||
* The module requires the following kernel options:
|
* The module requires the following kernel options:
|
||||||
* - @p CH_USE_MAILBOXES
|
* - @p CH_USE_MAILBOXES
|
||||||
* - @p CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
* .
|
* .
|
||||||
* In case some of the required options are not enabled then some or all tests
|
* In case some of the required options are not enabled then some or all tests
|
||||||
* may be skipped.
|
* may be skipped.
|
||||||
|
@ -51,7 +50,7 @@
|
||||||
* @brief Mailboxes header file
|
* @brief Mailboxes header file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT
|
#if CH_USE_MAILBOXES
|
||||||
|
|
||||||
#define ALLOWED_DELAY MS2ST(5)
|
#define ALLOWED_DELAY MS2ST(5)
|
||||||
#define MB_SIZE 5
|
#define MB_SIZE 5
|
||||||
|
@ -164,13 +163,13 @@ const struct testcase testmbox1 = {
|
||||||
mbox1_execute
|
mbox1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT */
|
#endif /* CH_USE_MAILBOXES */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test sequence for mailboxes pattern.
|
* Test sequence for mailboxes pattern.
|
||||||
*/
|
*/
|
||||||
const struct testcase * const patternmbox[] = {
|
const struct testcase * const patternmbox[] = {
|
||||||
#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT
|
#if CH_USE_MAILBOXES
|
||||||
&testmbox1,
|
&testmbox1,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
|
|
|
@ -108,10 +108,8 @@ static void queues1_execute(void) {
|
||||||
chIQResetI(&iq);
|
chIQResetI(&iq);
|
||||||
test_assert(8, chIQIsEmpty(&iq), "still full");
|
test_assert(8, chIQIsEmpty(&iq), "still full");
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
/* Timeout */
|
/* Timeout */
|
||||||
test_assert(9, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return");
|
test_assert(9, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testqueues1 = {
|
const struct testcase testqueues1 = {
|
||||||
|
@ -165,13 +163,11 @@ static void queues2_execute(void) {
|
||||||
chOQResetI(&oq);
|
chOQResetI(&oq);
|
||||||
test_assert(8, chOQIsEmpty(&oq), "still full");
|
test_assert(8, chOQIsEmpty(&oq), "still full");
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
/* Timeout */
|
/* Timeout */
|
||||||
for (i = 0; i < TEST_QUEUES_SIZE; i++)
|
for (i = 0; i < TEST_QUEUES_SIZE; i++)
|
||||||
chOQPut(&oq, 'A' + i);
|
chOQPut(&oq, 'A' + i);
|
||||||
test_assert(9, chOQIsFull(&oq), "still has space");
|
test_assert(9, chOQIsFull(&oq), "still has space");
|
||||||
test_assert(10, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return");
|
test_assert(10, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct testcase testqueues2 = {
|
const struct testcase testqueues2 = {
|
||||||
|
|
|
@ -71,7 +71,6 @@ const struct testcase testsem1 = {
|
||||||
sem1_execute
|
sem1_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
static char *sem2_gettest(void) {
|
static char *sem2_gettest(void) {
|
||||||
|
|
||||||
return "Semaphores, timeout test";
|
return "Semaphores, timeout test";
|
||||||
|
@ -138,7 +137,6 @@ const struct testcase testsem2 = {
|
||||||
NULL,
|
NULL,
|
||||||
sem2_execute
|
sem2_execute
|
||||||
};
|
};
|
||||||
#endif /* CH_USE_SEMAPHORES_TIMEOUT */
|
|
||||||
|
|
||||||
#if CH_USE_SEMSW
|
#if CH_USE_SEMSW
|
||||||
static char *sem3_gettest(void) {
|
static char *sem3_gettest(void) {
|
||||||
|
@ -185,9 +183,7 @@ const struct testcase testsem3 = {
|
||||||
const struct testcase * const patternsem[] = {
|
const struct testcase * const patternsem[] = {
|
||||||
#if CH_USE_SEMAPHORES
|
#if CH_USE_SEMAPHORES
|
||||||
&testsem1,
|
&testsem1,
|
||||||
#if CH_USE_SEMAPHORES_TIMEOUT
|
|
||||||
&testsem2,
|
&testsem2,
|
||||||
#endif
|
|
||||||
#if CH_USE_SEMSW
|
#if CH_USE_SEMSW
|
||||||
&testsem3,
|
&testsem3,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue