Go to the documentation of this file.
44 #if (CH_CFG_USE_PIPES == TRUE) || defined(__DOXYGEN__)
53 #if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
54 #define PC_INIT(p) chMtxObjectInit(&(p)->cmtx)
55 #define PC_LOCK(p) chMtxLock(&(p)->cmtx)
56 #define PC_UNLOCK(p) chMtxUnlock(&(p)->cmtx)
57 #define PW_INIT(p) chMtxObjectInit(&(p)->wmtx)
58 #define PW_LOCK(p) chMtxLock(&(p)->wmtx)
59 #define PW_UNLOCK(p) chMtxUnlock(&(p)->wmtx)
60 #define PR_INIT(p) chMtxObjectInit(&(p)->rmtx)
61 #define PR_LOCK(p) chMtxLock(&(p)->rmtx)
62 #define PR_UNLOCK(p) chMtxUnlock(&(p)->rmtx)
64 #define PC_INIT(p) chSemObjectInit(&(p)->csem, (cnt_t)1)
65 #define PC_LOCK(p) (void) chSemWait(&(p)->csem)
66 #define PC_UNLOCK(p) chSemSignal(&(p)->csem)
67 #define PW_INIT(p) chSemObjectInit(&(p)->wsem, (cnt_t)1)
68 #define PW_LOCK(p) (void) chSemWait(&(p)->wsem)
69 #define PW_UNLOCK(p) chSemSignal(&(p)->wsem)
70 #define PR_INIT(p) chSemObjectInit(&(p)->rsem, (cnt_t)1)
71 #define PR_LOCK(p) (void) chSemWait(&(p)->rsem)
72 #define PR_UNLOCK(p) chSemSignal(&(p)->rsem)
122 memcpy((
void *)pp->
wrptr, (
const void *)bp, n);
126 memcpy((
void *)pp->
wrptr, (
const void *)bp, s1);
129 memcpy((
void *)pp->
buffer, (
const void *)bp, s2);
133 memcpy((
void *)pp->
wrptr, (
const void *)bp, n);
173 memcpy((
void *)bp, (
void *)pp->
rdptr, n);
177 memcpy((
void *)bp, (
void *)pp->
rdptr, s1);
180 memcpy((
void *)bp, (
void *)pp->
buffer, s2);
184 memcpy((
void *)bp, (
void *)pp->
rdptr, n);
209 chDbgCheck((pp != NULL) && (buf != NULL) && (n > (
size_t)0));
295 if (done == (
size_t)0) {
360 if (done == (
size_t)0) {
msg_t chThdSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
Sends the current thread sleeping and sets a reference variable.
#define MSG_RESET
Wakeup caused by a reset condition.
thread_reference_t wtr
Waiting writer.
size_t cnt
Bytes in the pipe.
uint8_t * wrptr
Write pointer.
#define chDbgCheck(c)
Function parameters check.
void chPipeReset(pipe_t *pp)
Resets a pipe_t object.
size_t chPipeWriteTimeout(pipe_t *pp, const uint8_t *bp, size_t n, sysinterval_t timeout)
Pipe write with timeout.
void chThdResumeI(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
static size_t pipe_write(pipe_t *pp, const uint8_t *bp, size_t n)
Non-blocking pipe write.
static size_t pipe_read(pipe_t *pp, uint8_t *bp, size_t n)
Non-blocking pipe read.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
Structure representing a pipe object.
#define MSG_OK
Normal wakeup message.
uint64_t sysinterval_t
Type of time interval.
static size_t chPipeGetUsedCount(const pipe_t *pp)
Returns the number of used byte slots into a pipe.
uint8_t * top
Pointer to the location after the buffer.
bool reset
True if in reset state.
uint8_t * rdptr
Read pointer.
void chPipeObjectInit(pipe_t *pp, uint8_t *buf, size_t n)
Initializes a mailbox_t object.
static size_t chPipeGetFreeCount(const pipe_t *pp)
Returns the number of free byte slots into a pipe.
void chThdResume(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
size_t chPipeReadTimeout(pipe_t *pp, uint8_t *bp, size_t n, sysinterval_t timeout)
Pipe read with timeout.
thread_reference_t rtr
Waiting reader.
#define chSysUnlock()
Leaves the kernel lock state.
uint8_t * buffer
Pointer to the pipe buffer.
#define chSysLock()
Enters the kernel lock state.