pipe.h

Go to the documentation of this file.
00001 
00049 #ifndef _RTAI_PIPE_H
00050 #define _RTAI_PIPE_H
00051 
00052 #include <nucleus/pipe.h>
00053 
00054 #ifdef __KERNEL__
00055 
00056 #include <rtai/types.h>
00057 
00058 #define RTAI_PIPE_MAGIC 0x55550202
00059 
00060 typedef xnpipe_mh_t RT_PIPE_MSG;
00061 
00062 #define P_NORMAL  XNPIPE_NORMAL
00063 #define P_URGENT  XNPIPE_URGENT
00064 
00065 #define P_MSGPTR(msg)  xnpipe_m_data(msg)
00066 #define P_MSGSIZE(msg) xnpipe_m_size(msg)
00067 
00068 typedef struct rt_pipe {
00069 
00070     unsigned magic;             /* !< Magic code -- must be first. */
00071 
00072     xnholder_t link;            /* !< Link in flush queue. */
00073 
00074 #define link2rtpipe(laddr) \
00075 ((RT_PIPE *)(((char *)laddr) - (int)(&((RT_PIPE *)0)->link)))
00076 
00077     int minor;                  /* !< Device minor number.  */
00078 
00079     RT_PIPE_MSG *buffer;        /* !< Buffer used in byte stream mode. */
00080 
00081     size_t fillsz;              /* !< Bytes written to the buffer.  */
00082 
00083     u_long flushable;           /* !< Flush request flag. */
00084 
00085 } RT_PIPE;
00086 
00087 #ifdef __cplusplus
00088 extern "C" {
00089 #endif
00090 
00091 int __pipe_pkg_init(void);
00092 
00093 void __pipe_pkg_cleanup(void);
00094 
00095 /* Public interface. */
00096 
00097 int rt_pipe_open(RT_PIPE *pipe,
00098                  int minor);
00099 
00100 int rt_pipe_close(RT_PIPE *pipe);
00101 
00102 ssize_t rt_pipe_read(RT_PIPE *pipe,
00103                      RT_PIPE_MSG **msg,
00104                      RTIME timeout);
00105 
00106 ssize_t rt_pipe_write(RT_PIPE *pipe,
00107                       RT_PIPE_MSG *msg,
00108                       size_t size,
00109                       int mode);
00110 
00111 ssize_t rt_pipe_stream(RT_PIPE *pipe,
00112                        const void *buf,
00113                        size_t size);
00114 
00115 RT_PIPE_MSG *rt_pipe_alloc(size_t size);
00116 
00117 int rt_pipe_free(RT_PIPE_MSG *msg);
00118 
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #else /* !__KERNEL__ */
00124 
00125 #endif /* __KERNEL__ */
00126 
00127 #endif /* !_RTAI_PIPE_H */

Generated on Mon Dec 13 09:49:49 2004 for RTAI API by  doxygen 1.3.9.1