Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pipe_arch.c File Reference
#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...
 
uint16_t 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
 

Macro Definition Documentation

#define PIPE_THREAD_PRIO   10

Definition at line 42 of file pipe_arch.c.

Referenced by pipe_thread().

Function Documentation

void pipe_arch_init ( void  )

Definition at line 48 of file pipe_arch.c.

References pipe_thread().

+ Here is the call graph for this function:

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 pipe_periph::fd_read, and pipe_periph::fd_write.

uint16_t 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 PIPE_RX_BUFFER_SIZE, pipe_periph::rx_extract_idx, and pipe_periph::rx_insert_idx.

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 PIPE_RX_BUFFER_SIZE, pipe_periph::rx_buf, and pipe_periph::rx_extract_idx.

void pipe_receive ( struct pipe_periph p)

Read bytes from PIPE.

Definition at line 132 of file pipe_arch.c.

References pipe_periph::fd_read, pipe_char_available(), PIPE_RX_BUFFER_SIZE, pipe_periph::rx_buf, and pipe_periph::rx_insert_idx.

+ Here is the call graph for this function:

void pipe_send_message ( struct pipe_periph p,
long  fd 
)

Send a message.

Definition at line 160 of file pipe_arch.c.

References pipe_periph::fd_write, pipe_periph::tx_buf, and pipe_periph::tx_insert_idx.

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 pipe_periph::fd_write.

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

pthread_mutex_t pipe_mutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 46 of file pipe_arch.c.