git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7733 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
Giovanni Di Sirio 2015-03-07 19:29:14 +00:00
parent a56487ecb9
commit 61d31e7dc4
2 changed files with 19 additions and 19 deletions

View File

@ -129,7 +129,7 @@ typedef io_queue_t output_queue_t;
*/ */
#define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \ #define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \
_THREADS_QUEUE_DATA(name), \ _THREADS_QUEUE_DATA(name), \
0, \ 0U, \
(uint8_t *)(buffer), \ (uint8_t *)(buffer), \
(uint8_t *)(buffer) + (size), \ (uint8_t *)(buffer) + (size), \
(uint8_t *)(buffer), \ (uint8_t *)(buffer), \
@ -239,17 +239,17 @@ extern "C" {
qnotify_t infy, void *link); qnotify_t infy, void *link);
void chIQResetI(input_queue_t *iqp); void chIQResetI(input_queue_t *iqp);
msg_t chIQPutI(input_queue_t *iqp, uint8_t b); msg_t chIQPutI(input_queue_t *iqp, uint8_t b);
msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time); msg_t chIQGetTimeout(input_queue_t *iqp, systime_t timeout);
size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp, size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, systime_t time); size_t n, systime_t timeout);
void chOQObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size, void chOQObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
qnotify_t onfy, void *link); qnotify_t onfy, void *link);
void chOQResetI(output_queue_t *oqp); void chOQResetI(output_queue_t *oqp);
msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time); msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout);
msg_t chOQGetI(output_queue_t *oqp); msg_t chOQGetI(output_queue_t *oqp);
size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp, size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, systime_t time); size_t n, systime_t timeout);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -162,7 +162,7 @@ msg_t chIQPutI(input_queue_t *iqp, uint8_t b) {
* buffer or before entering the state @p CH_STATE_WTQUEUE. * buffer or before entering the state @p CH_STATE_WTQUEUE.
* *
* @param[in] iqp pointer to an @p input_queue_t structure * @param[in] iqp pointer to an @p input_queue_t structure
* @param[in] time the number of ticks before the operation timeouts, * @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout. * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout. * - @a TIME_INFINITE no timeout.
@ -173,7 +173,7 @@ msg_t chIQPutI(input_queue_t *iqp, uint8_t b) {
* *
* @api * @api
*/ */
msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time) { msg_t chIQGetTimeout(input_queue_t *iqp, systime_t timeout) {
uint8_t b; uint8_t b;
chSysLock(); chSysLock();
@ -182,7 +182,7 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time) {
} }
while (chIQIsEmptyI(iqp)) { while (chIQIsEmptyI(iqp)) {
msg_t msg = chThdEnqueueTimeoutS(&iqp->q_waiting, time); msg_t msg = chThdEnqueueTimeoutS(&iqp->q_waiting, timeout);
if (msg < Q_OK) { if (msg < Q_OK) {
chSysUnlock(); chSysUnlock();
return msg; return msg;
@ -217,7 +217,7 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time) {
* @param[out] bp pointer to the data buffer * @param[out] bp pointer to the data buffer
* @param[in] n the maximum amount of data to be transferred, the * @param[in] n the maximum amount of data to be transferred, the
* value 0 is reserved * value 0 is reserved
* @param[in] time the number of ticks before the operation timeouts, * @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout. * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout. * - @a TIME_INFINITE no timeout.
@ -227,7 +227,7 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time) {
* @api * @api
*/ */
size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp, size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, systime_t time) { size_t n, systime_t timeout) {
qnotify_t nfy = iqp->q_notify; qnotify_t nfy = iqp->q_notify;
size_t r = 0; size_t r = 0;
@ -240,7 +240,7 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
} }
while (chIQIsEmptyI(iqp)) { while (chIQIsEmptyI(iqp)) {
if (chThdEnqueueTimeoutS(&iqp->q_waiting, time) != Q_OK) { if (chThdEnqueueTimeoutS(&iqp->q_waiting, timeout) != Q_OK) {
chSysUnlock(); chSysUnlock();
return r; return r;
} }
@ -255,8 +255,8 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
/*lint -restore*/ /*lint -restore*/
iqp->q_rdptr = iqp->q_buffer; iqp->q_rdptr = iqp->q_buffer;
} }
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/ chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
r++; r++;
n--; n--;
if (n == 0U) { if (n == 0U) {
@ -327,7 +327,7 @@ void chOQResetI(output_queue_t *oqp) {
* *
* @param[in] oqp pointer to an @p output_queue_t structure * @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] b the byte value to be written in the queue * @param[in] b the byte value to be written in the queue
* @param[in] time the number of ticks before the operation timeouts, * @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout. * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout. * - @a TIME_INFINITE no timeout.
@ -339,11 +339,11 @@ void chOQResetI(output_queue_t *oqp) {
* *
* @api * @api
*/ */
msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time) { msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout) {
chSysLock(); chSysLock();
while (chOQIsFullI(oqp)) { while (chOQIsFullI(oqp)) {
msg_t msg = chThdEnqueueTimeoutS(&oqp->q_waiting, time); msg_t msg = chThdEnqueueTimeoutS(&oqp->q_waiting, timeout);
if (msg < Q_OK) { if (msg < Q_OK) {
chSysUnlock(); chSysUnlock();
return msg; return msg;
@ -415,7 +415,7 @@ msg_t chOQGetI(output_queue_t *oqp) {
* @param[out] bp pointer to the data buffer * @param[out] bp pointer to the data buffer
* @param[in] n the maximum amount of data to be transferred, the * @param[in] n the maximum amount of data to be transferred, the
* value 0 is reserved * value 0 is reserved
* @param[in] time the number of ticks before the operation timeouts, * @param[in] timeout the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout. * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout. * - @a TIME_INFINITE no timeout.
@ -425,7 +425,7 @@ msg_t chOQGetI(output_queue_t *oqp) {
* @api * @api
*/ */
size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp, size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, systime_t time) { size_t n, systime_t timeout) {
qnotify_t nfy = oqp->q_notify; qnotify_t nfy = oqp->q_notify;
size_t w = 0; size_t w = 0;
@ -434,7 +434,7 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
chSysLock(); chSysLock();
while (true) { while (true) {
while (chOQIsFullI(oqp)) { while (chOQIsFullI(oqp)) {
if (chThdEnqueueTimeoutS(&oqp->q_waiting, time) != Q_OK) { if (chThdEnqueueTimeoutS(&oqp->q_waiting, timeout) != Q_OK) {
chSysUnlock(); chSysUnlock();
return w; return w;
} }
@ -452,8 +452,8 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
if (nfy != NULL) { if (nfy != NULL) {
nfy(oqp); nfy(oqp);
} }
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/ chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
w++; w++;
n--; n--;
if (n == 0U) { if (n == 0U) {