31#include <sys/select.h>
41#ifndef PIPE_THREAD_PRIO
42#define PIPE_THREAD_PRIO 10
52#if defined(USE_PIPE0_WRITER) || defined(USE_PIPE0_READER)
55#if defined(USE_PIPE1_WRITER) || defined(USE_PIPE1_READER)
58#if defined(USE_PIPE2_WRITER) || defined(USE_PIPE2_READER)
64 fprintf(
stderr,
"pipe_arch_init: Could not create PIPE reading thread.\n");
107 int available =
p->rx_insert_idx -
p->rx_extract_idx;
134 if (
p ==
NULL) {
return; }
135 if (
p->fd_read < 0) {
return; }
141 if (available <= 0) {
150 p->rx_buf[
p->rx_insert_idx] = buf[i];
162 if (
p ==
NULL) {
return; }
163 if (
p->fd_write < 0) {
return; }
165 if (
p->tx_insert_idx > 0) {
171 fprintf(
stderr,
"pipe_send_message: only sent %d bytes instead of %d\n",
175 p->tx_insert_idx = 0;
184 if (
p ==
NULL) {
return; }
185 if (
p->fd_write < 0) {
return; }
206#ifdef USE_PIPE0_READER
207 if (
pipe0.fd_read >= 0){
214#ifdef USE_PIPE1_READER
215 if(
pipe1.fd_read >= 0){
222#ifdef USE_PIPE2_READER
223 if(
pipe2.fd_read >= 0){
241#ifdef USE_PIPE0_READER
246#ifdef USE_PIPE1_READER
251#ifdef USE_PIPE2_READER
void pipe_receive(struct pipe_periph *p)
Read bytes from PIPE.
static void * pipe_thread(void *data)
check for new pipe packets to receive.
void pipe_arch_init(void)
int pipe_char_available(struct pipe_periph *p)
Get number of bytes available in receive buffer.
uint8_t pipe_getch(struct pipe_periph *p)
Get the last character from the receive buffer.
void pipe_arch_periph_init(struct pipe_periph *p, char *read_name, char *write_name)
Initialize the PIPE peripheral.
static pthread_mutex_t pipe_mutex
void pipe_send_message(struct pipe_periph *p, long fd)
Send a message.
void pipe_send_raw(struct pipe_periph *p, long fd, uint8_t *buffer, uint16_t size)
Send a packet from another buffer.
#define PIPE_RX_BUFFER_SIZE
arch independent PIPE API
Functions to obtain rt priority or set the nice level.
static int get_rt_prio(int prio)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.