RTEMS  5.0.0
pipe.h
Go to the documentation of this file.
1 
10 /*
11  * Author: Wei Shen <cquark@gmail.com>
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifndef _RTEMS_PIPE_H
19 #define _RTEMS_PIPE_H
20 
21 #include <rtems/libio.h>
22 #include <rtems/thread.h>
23 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* Control block to manage each pipe */
38 typedef struct pipe_control {
39  char *Buffer;
40  unsigned int Size;
41  unsigned int Start;
42  unsigned int Length;
43  unsigned int Readers;
44  unsigned int Writers;
45  unsigned int waitingReaders;
46  unsigned int waitingWriters;
47  unsigned int readerCounter; /* incremental counters */
48  unsigned int writerCounter; /* for differentiation of successive opens */
49  rtems_mutex Mutex;
50  rtems_id readBarrier; /* wait queues */
51  rtems_id writeBarrier;
52 #if 0
53  boolean Anonymous; /* anonymous pipe or FIFO */
54 #endif
56 
65 extern void pipe_release(
66  pipe_control_t **pipep,
67  rtems_libio_t *iop
68 );
69 
78 extern int fifo_open(
79  pipe_control_t **pipep,
80  rtems_libio_t *iop
81 );
82 
88 extern ssize_t pipe_read(
89  pipe_control_t *pipe,
90  void *buffer,
91  size_t count,
92  rtems_libio_t *iop
93 );
94 
100 extern ssize_t pipe_write(
101  pipe_control_t *pipe,
102  const void *buffer,
103  size_t count,
104  rtems_libio_t *iop
105 );
106 
112 extern int pipe_ioctl(
113  pipe_control_t *pipe,
114  ioctl_command_t cmd,
115  void *buffer,
116  rtems_libio_t *iop
117 );
118 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
Basic IO API.
int pipe_ioctl(pipe_control_t *pipe, ioctl_command_t cmd, void *buffer, rtems_libio_t *iop)
File system Input/Output control.
Definition: fifo.c:432
int fifo_open(pipe_control_t **pipep, rtems_libio_t *iop)
File system open. Interface to file system open.
Definition: fifo.c:215
ssize_t pipe_write(pipe_control_t *pipe, const void *buffer, size_t count, rtems_libio_t *iop)
File system write.
Definition: fifo.c:355
void pipe_release(pipe_control_t **pipep, rtems_libio_t *iop)
Release a pipe.
Definition: fifo.c:165
Definition: pipe.h:38
An open file data structure.
Definition: libio.h:1320
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
ssize_t pipe_read(pipe_control_t *pipe, void *buffer, size_t count, rtems_libio_t *iop)
File system read.
Definition: fifo.c:294