Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
pipe_arch.c File Reference

linux named pipe handling More...

#include "mcu_periph/pipe.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <pthread.h>
#include <sys/select.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "rt_priority.h"
+ Include dependency graph for pipe_arch.c:

Go to the source code of this file.

Macros

#define PIPE_THREAD_PRIO   10
 

Functions

static void * pipe_thread (void *data)
 check for new pipe packets to receive. More...
 
void pipe_arch_init (void)
 
void pipe_arch_periph_init (struct pipe_periph *p, char *read_name, char *write_name)
 Initialize the PIPE peripheral. More...
 
int pipe_char_available (struct pipe_periph *p)
 Get number of bytes available in receive buffer. More...
 
uint8_t pipe_getch (struct pipe_periph *p)
 Get the last character from the receive buffer. More...
 
void pipe_receive (struct pipe_periph *p)
 Read bytes from PIPE. More...
 
void pipe_send_message (struct pipe_periph *p, long fd)
 Send a message. More...
 
void pipe_send_raw (struct pipe_periph *p, long fd, uint8_t *buffer, uint16_t size)
 Send a packet from another buffer. More...
 

Variables

static pthread_mutex_t pipe_mutex = PTHREAD_MUTEX_INITIALIZER
 

Detailed Description

linux named pipe handling

Definition in file pipe_arch.c.

Macro Definition Documentation

◆ PIPE_THREAD_PRIO

#define PIPE_THREAD_PRIO   10

Definition at line 42 of file pipe_arch.c.

Function Documentation

◆ pipe_arch_init()

void pipe_arch_init ( void  )

Definition at line 48 of file pipe_arch.c.

References pipe_mutex, and pipe_thread().

+ Here is the call graph for this function:

◆ pipe_arch_periph_init()

void pipe_arch_periph_init ( struct pipe_periph p,
char *  read_name,
char *  write_name 
)

Initialize the PIPE peripheral.

Allocate UdpSocket struct and create and bind the PIPE socket.

Definition at line 76 of file pipe_arch.c.

References p.

Referenced by pipe_periph_init().

+ Here is the caller graph for this function:

◆ pipe_char_available()

int pipe_char_available ( struct pipe_periph p)

Get number of bytes available in receive buffer.

Parameters
ppointer to PIPE peripheral
Returns
number of bytes available in receive buffer

Definition at line 104 of file pipe_arch.c.

References p, pipe_mutex, and PIPE_RX_BUFFER_SIZE.

Referenced by pipe_periph_init(), and pipe_receive().

+ Here is the caller graph for this function:

◆ pipe_getch()

uint8_t pipe_getch ( struct pipe_periph p)

Get the last character from the receive buffer.

Parameters
ppointer to PIPE peripheral
Returns
last byte

Definition at line 120 of file pipe_arch.c.

References p, pipe_mutex, and PIPE_RX_BUFFER_SIZE.

Referenced by pipe_periph_init().

+ Here is the caller graph for this function:

◆ pipe_receive()

void pipe_receive ( struct pipe_periph p)

Read bytes from PIPE.

Definition at line 132 of file pipe_arch.c.

References p, pipe_char_available(), pipe_mutex, and PIPE_RX_BUFFER_SIZE.

Referenced by pipe_thread().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pipe_send_message()

void pipe_send_message ( struct pipe_periph p,
long  fd 
)

Send a message.

Definition at line 160 of file pipe_arch.c.

References p.

Referenced by pipe_periph_init().

+ Here is the caller graph for this function:

◆ pipe_send_raw()

void pipe_send_raw ( struct pipe_periph p,
long  fd,
uint8_t buffer,
uint16_t  size 
)

Send a packet from another buffer.

Definition at line 182 of file pipe_arch.c.

References p.

◆ pipe_thread()

static void * pipe_thread ( void *  data)
static

check for new pipe packets to receive.

Definition at line 193 of file pipe_arch.c.

References fd, get_rt_prio(), pipe_receive(), and PIPE_THREAD_PRIO.

Referenced by pipe_arch_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ pipe_mutex

pthread_mutex_t pipe_mutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 46 of file pipe_arch.c.

Referenced by pipe_arch_init(), pipe_char_available(), pipe_getch(), and pipe_receive().