RTEMS CPU Kit with SuperCore  4.10.99.0
rtems/pipe.h
Go to the documentation of this file.
00001 
00010 /*
00011  * Author: Wei Shen <cquark@gmail.com>
00012  *
00013  * The license and distribution terms for this file may be
00014  * found in the file LICENSE in this distribution or at
00015  * http://www.rtems.org/license/LICENSE.
00016  */
00017 
00018 #ifndef _RTEMS_PIPE_H
00019 #define _RTEMS_PIPE_H
00020 
00021 #include <rtems/libio.h>
00022 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 /* Control block to manage each pipe */
00037 typedef struct pipe_control {
00038   char *Buffer;
00039   unsigned int Size;
00040   unsigned int Start;
00041   unsigned int Length;
00042   unsigned int Readers;
00043   unsigned int Writers;
00044   unsigned int waitingReaders;
00045   unsigned int waitingWriters;
00046   unsigned int readerCounter;     /* incremental counters */
00047   unsigned int writerCounter;     /* for differentiation of successive opens */
00048   rtems_id Semaphore;
00049   rtems_id readBarrier;   /* wait queues */
00050   rtems_id writeBarrier;
00051 #if 0
00052   boolean Anonymous;      /* anonymous pipe or FIFO */
00053 #endif
00054 } pipe_control_t;
00055 
00061 extern int pipe_create(
00062   int filsdes[2]
00063 );
00064 
00073 extern void pipe_release(
00074   pipe_control_t **pipep,
00075   rtems_libio_t *iop
00076 );
00077 
00086 extern int fifo_open(
00087   pipe_control_t **pipep,
00088   rtems_libio_t *iop
00089 );
00090 
00096 extern ssize_t pipe_read(
00097   pipe_control_t *pipe,
00098   void           *buffer,
00099   size_t          count,
00100   rtems_libio_t  *iop
00101 );
00102 
00108 extern ssize_t pipe_write(
00109   pipe_control_t *pipe,
00110   const void     *buffer,
00111   size_t          count,
00112   rtems_libio_t  *iop
00113 );
00114 
00120 extern int pipe_ioctl(
00121   pipe_control_t  *pipe,
00122   ioctl_command_t  cmd,
00123   void            *buffer,
00124   rtems_libio_t   *iop
00125 );
00126 
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132 
00133 #endif