00001
00049
#ifndef _RTAI_PIPE_H
00050
#define _RTAI_PIPE_H
00051
00052
#include <nucleus/dbridge.h>
00053
00054
#ifdef __KERNEL__
00055
00056
#include <rtai/types.h>
00057
00058
#define RTAI_PIPE_MAGIC 0x55550202
00059
00060
typedef xnbridge_mh_t RT_PIPE_MSG;
00061
00062
#define RT_PIPE_NORMAL XNBRIDGE_NORMAL
00063
#define RT_PIPE_URGENT XNBRIDGE_URGENT
00064
00065
#define RT_PIPE_MSGPTR(msg) xnbridge_m_data(msg)
00066
#define RT_PIPE_MSGSIZE(msg) xnbridge_m_size(msg)
00067
00068
typedef struct rt_pipe {
00069
00070
unsigned magic;
00071
00072 xnholder_t link;
00073
00074
#define link2pipe(laddr) \
00075
((RT_PIPE *)(((char *)laddr) - (int)(&((RT_PIPE *)0)->link)))
00076
00077
int minor;
00078
00079 RT_PIPE_MSG *buffer;
00080
00081 size_t fillsz;
00082
00083 u_long flushable;
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
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 flags);
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
00124
00125
#endif
00126
00127
#endif