git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6474 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
ca00f534f7
commit
1b6619e5cc
|
@ -178,7 +178,7 @@ static void usb_packet_read_to_queue(stm32_usb_descriptor_t *udp,
|
|||
osalSysLockFromISR();
|
||||
|
||||
iqp->q_counter += n;
|
||||
osalQueueWakeupAllI(&iqp->q_waiting, Q_OK);
|
||||
osalThreadDequeueAllI(&iqp->q_waiting, Q_OK);
|
||||
|
||||
osalSysUnlockFromISR();
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ static void usb_packet_write_from_queue(stm32_usb_descriptor_t *udp,
|
|||
sts = osalSysGetStatusAndLockX();
|
||||
|
||||
oqp->q_counter += n;
|
||||
osalQueueWakeupAllI(&oqp->q_waiting, Q_OK);
|
||||
osalThreadDequeueAllI(&oqp->q_waiting, Q_OK);
|
||||
|
||||
osalSysRestoreStatusX(sts);
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ static void can_lld_tx_handler(CANDriver *canp) {
|
|||
/* No more events until a message is transmitted.*/
|
||||
canp->can->TSR = CAN_TSR_RQCP0 | CAN_TSR_RQCP1 | CAN_TSR_RQCP2;
|
||||
osalSysLockFromISR();
|
||||
osalQueueWakeupAllI(&canp->txqueue, MSG_OK);
|
||||
osalThreadDequeueAllI(&canp->txqueue, MSG_OK);
|
||||
osalEventBroadcastFlagsI(&canp->txempty_event, CAN_MAILBOX_TO_MASK(1));
|
||||
osalSysUnlockFromISR();
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ static void can_lld_rx0_handler(CANDriver *canp) {
|
|||
/* No more receive events until the queue 0 has been emptied.*/
|
||||
canp->can->IER &= ~CAN_IER_FMPIE0;
|
||||
osalSysLockFromISR();
|
||||
osalQueueWakeupAllI(&canp->rxqueue, MSG_OK);
|
||||
osalThreadDequeueAllI(&canp->rxqueue, MSG_OK);
|
||||
osalEventBroadcastFlagsI(&canp->rxfull_event, CAN_MAILBOX_TO_MASK(1));
|
||||
osalSysUnlockFromISR();
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ static void can_lld_rx1_handler(CANDriver *canp) {
|
|||
/* No more receive events until the queue 0 has been emptied.*/
|
||||
canp->can->IER &= ~CAN_IER_FMPIE1;
|
||||
osalSysLockFromISR();
|
||||
osalQueueWakeupAllI(&canp->rxqueue, MSG_OK);
|
||||
osalThreadDequeueAllI(&canp->rxqueue, MSG_OK);
|
||||
osalEventBroadcastFlagsI(&canp->rxfull_event, CAN_MAILBOX_TO_MASK(2));
|
||||
osalSysUnlockFromISR();
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ void canObjectInit(CANDriver *canp) {
|
|||
|
||||
canp->state = CAN_STOP;
|
||||
canp->config = NULL;
|
||||
osalQueueObjectInit(&canp->txqueue);
|
||||
osalQueueObjectInit(&canp->rxqueue);
|
||||
osalThreadQueueObjectInit(&canp->txqueue);
|
||||
osalThreadQueueObjectInit(&canp->rxqueue);
|
||||
osalEventObjectInit(&canp->rxfull_event);
|
||||
osalEventObjectInit(&canp->txempty_event);
|
||||
osalEventObjectInit(&canp->error_event);
|
||||
|
@ -131,8 +131,8 @@ void canStop(CANDriver *canp) {
|
|||
"invalid state");
|
||||
can_lld_stop(canp);
|
||||
canp->state = CAN_STOP;
|
||||
osalQueueWakeupAllI(&canp->rxqueue, MSG_RESET);
|
||||
osalQueueWakeupAllI(&canp->txqueue, MSG_RESET);
|
||||
osalThreadDequeueAllI(&canp->rxqueue, MSG_RESET);
|
||||
osalThreadDequeueAllI(&canp->txqueue, MSG_RESET);
|
||||
osalOsRescheduleS();
|
||||
osalSysUnlock();
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ msg_t canTransmit(CANDriver *canp,
|
|||
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
|
||||
"invalid state");
|
||||
while ((canp->state == CAN_SLEEP) || !can_lld_is_tx_empty(canp, mailbox)) {
|
||||
msg_t msg = osalQueueGoSleepTimeoutS(&canp->txqueue, timeout);
|
||||
msg_t msg = osalThreadEnqueueTimeoutS(&canp->txqueue, timeout);
|
||||
if (msg != MSG_OK) {
|
||||
osalSysUnlock();
|
||||
return msg;
|
||||
|
@ -215,7 +215,7 @@ msg_t canReceive(CANDriver *canp,
|
|||
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
|
||||
"invalid state");
|
||||
while ((canp->state == CAN_SLEEP) || !can_lld_is_rx_nonempty(canp, mailbox)) {
|
||||
msg_t msg = osalQueueGoSleepTimeoutS(&canp->rxqueue, timeout);
|
||||
msg_t msg = osalThreadEnqueueTimeoutS(&canp->rxqueue, timeout);
|
||||
if (msg != MSG_OK) {
|
||||
osalSysUnlock();
|
||||
return msg;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
void iqObjectInit(input_queue_t *iqp, uint8_t *bp, size_t size,
|
||||
qnotify_t infy, void *link) {
|
||||
|
||||
osalQueueObjectInit(&iqp->q_waiting);
|
||||
osalThreadQueueObjectInit(&iqp->q_waiting);
|
||||
iqp->q_counter = 0;
|
||||
iqp->q_buffer = iqp->q_rdptr = iqp->q_wrptr = bp;
|
||||
iqp->q_top = bp + size;
|
||||
|
@ -87,7 +87,7 @@ void iqResetI(input_queue_t *iqp) {
|
|||
|
||||
iqp->q_rdptr = iqp->q_wrptr = iqp->q_buffer;
|
||||
iqp->q_counter = 0;
|
||||
osalQueueWakeupAllI(&iqp->q_waiting, Q_RESET);
|
||||
osalThreadDequeueAllI(&iqp->q_waiting, Q_RESET);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,7 @@ msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
|
|||
if (iqp->q_wrptr >= iqp->q_top)
|
||||
iqp->q_wrptr = iqp->q_buffer;
|
||||
|
||||
osalQueueWakeupOneI(&iqp->q_waiting, Q_OK);
|
||||
osalThreadDequeueNextI(&iqp->q_waiting, Q_OK);
|
||||
|
||||
return Q_OK;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ msg_t iqGetTimeout(input_queue_t *iqp, systime_t time) {
|
|||
|
||||
while (iqIsEmptyI(iqp)) {
|
||||
msg_t msg;
|
||||
if ((msg = osalQueueGoSleepTimeoutS(&iqp->q_waiting, time)) < Q_OK) {
|
||||
if ((msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, time)) < Q_OK) {
|
||||
osalSysUnlock();
|
||||
return msg;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
|
|||
nfy(iqp);
|
||||
|
||||
while (iqIsEmptyI(iqp)) {
|
||||
if (osalQueueGoSleepTimeoutS(&iqp->q_waiting, time) != Q_OK) {
|
||||
if (osalThreadEnqueueTimeoutS(&iqp->q_waiting, time) != Q_OK) {
|
||||
osalSysUnlock();
|
||||
return r;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
|
|||
void oqObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
|
||||
qnotify_t onfy, void *link) {
|
||||
|
||||
osalQueueObjectInit(&oqp->q_waiting);
|
||||
osalThreadQueueObjectInit(&oqp->q_waiting);
|
||||
oqp->q_counter = size;
|
||||
oqp->q_buffer = oqp->q_rdptr = oqp->q_wrptr = bp;
|
||||
oqp->q_top = bp + size;
|
||||
|
@ -265,7 +265,7 @@ void oqResetI(output_queue_t *oqp) {
|
|||
|
||||
oqp->q_rdptr = oqp->q_wrptr = oqp->q_buffer;
|
||||
oqp->q_counter = qSizeI(oqp);
|
||||
osalQueueWakeupAllI(&oqp->q_waiting, Q_RESET);
|
||||
osalThreadDequeueAllI(&oqp->q_waiting, Q_RESET);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,7 +296,7 @@ msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time) {
|
|||
while (oqIsFullI(oqp)) {
|
||||
msg_t msg;
|
||||
|
||||
if ((msg = osalQueueGoSleepTimeoutS(&oqp->q_waiting, time)) < Q_OK) {
|
||||
if ((msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, time)) < Q_OK) {
|
||||
osalSysUnlock();
|
||||
return msg;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ msg_t oqGetI(output_queue_t *oqp) {
|
|||
if (oqp->q_rdptr >= oqp->q_top)
|
||||
oqp->q_rdptr = oqp->q_buffer;
|
||||
|
||||
osalQueueWakeupOneI(&oqp->q_waiting, Q_OK);
|
||||
osalThreadDequeueNextI(&oqp->q_waiting, Q_OK);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
|
|||
osalSysLock();
|
||||
while (TRUE) {
|
||||
while (oqIsFullI(oqp)) {
|
||||
if (osalQueueGoSleepTimeoutS(&oqp->q_waiting, time) != Q_OK) {
|
||||
if (osalThreadEnqueueTimeoutS(&oqp->q_waiting, time) != Q_OK) {
|
||||
osalSysUnlock();
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
*
|
||||
* @iclass
|
||||
*/
|
||||
void osalQueueWakeupOneI(threads_queue_t *tqp, msg_t msg) {
|
||||
void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg) {
|
||||
semaphore_t *sp = &tqp->sem;
|
||||
|
||||
if (chSemGetCounterI(&tqp->sem) < 0) {
|
||||
|
@ -90,7 +90,7 @@ void osalQueueWakeupOneI(threads_queue_t *tqp, msg_t msg) {
|
|||
*
|
||||
* @iclass
|
||||
*/
|
||||
void osalQueueWakeupAllI(threads_queue_t *tqp, msg_t msg) {
|
||||
void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg) {
|
||||
semaphore_t *sp = &tqp->sem;
|
||||
thread_reference_t tr;
|
||||
cnt_t cnt;
|
||||
|
|
|
@ -347,8 +347,8 @@ typedef struct {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void osalQueueWakeupOneI(threads_queue_t *tqp, msg_t msg);
|
||||
void osalQueueWakeupAllI(threads_queue_t *tqp, msg_t msg);
|
||||
void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg);
|
||||
void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -647,7 +647,7 @@ static inline void osalThreadResumeS(thread_reference_t *trp, msg_t msg) {
|
|||
*
|
||||
* @init
|
||||
*/
|
||||
static inline void osalQueueObjectInit(threads_queue_t *tqp) {
|
||||
static inline void osalThreadQueueObjectInit(threads_queue_t *tqp) {
|
||||
|
||||
chSemObjectInit(&tqp->sem, 0);
|
||||
}
|
||||
|
@ -675,8 +675,8 @@ static inline void osalQueueObjectInit(threads_queue_t *tqp) {
|
|||
*
|
||||
* @sclass
|
||||
*/
|
||||
static inline msg_t osalQueueGoSleepTimeoutS(threads_queue_t *tqp,
|
||||
systime_t time) {
|
||||
static inline msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp,
|
||||
systime_t time) {
|
||||
|
||||
return chSemWaitTimeout(&tqp->sem, time);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
typedef struct thread thread_t;
|
||||
typedef struct virtual_timer virtual_timer_t;
|
||||
|
||||
/* Inclusion of all the kernel sub-headers.*/
|
||||
/* Core headers.*/
|
||||
#include "chtypes.h"
|
||||
#include "chconf.h"
|
||||
#include "chcore.h"
|
||||
|
@ -77,6 +77,8 @@ typedef struct virtual_timer virtual_timer_t;
|
|||
#include "chsys.h"
|
||||
#include "chvt.h"
|
||||
#include "chthreads.h"
|
||||
|
||||
/* Optional subsystems headers.*/
|
||||
#include "chregistry.h"
|
||||
#include "chsem.h"
|
||||
#include "chbsem.h"
|
||||
|
|
|
@ -664,7 +664,7 @@ static inline void osalThreadQueueObjectInit(threads_queue_t *tqp) {
|
|||
* @sclass
|
||||
*/
|
||||
static inline msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp,
|
||||
systime_t time) {
|
||||
systime_t time) {
|
||||
|
||||
return chThdEnqueueTimeoutS(tqp, time);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue