22 #ifndef _XENO_BUFFER_H
23 #define _XENO_BUFFER_H
28 #define B_PRIO XNSYNCH_PRIO
29 #define B_FIFO XNSYNCH_FIFO
31 typedef struct rt_buffer_info {
37 char name[XNOBJECT_NAME_LEN];
41 typedef struct rt_buffer_placeholder {
43 } RT_BUFFER_PLACEHOLDER;
45 #if (defined(__KERNEL__) || defined(__XENO_SIM__)) && !defined(DOXYGEN_CPP)
47 #include <nucleus/synch.h>
48 #include <nucleus/heap.h>
51 #define XENO_BUFFER_MAGIC 0x55550c0c
53 typedef struct rt_buffer {
57 xnsynch_t isynch_base;
58 xnsynch_t osynch_base;
60 char name[XNOBJECT_NAME_LEN];
73 #ifdef CONFIG_XENO_OPT_PERVASIVE
77 #define rlink2buffer(ln) container_of(ln, RT_BUFFER, rlink)
86 #ifdef CONFIG_XENO_OPT_NATIVE_BUFFER
88 int __native_buffer_pkg_init(
void);
90 void __native_buffer_pkg_cleanup(
void);
92 static inline void __native_buffer_flush_rq(xnqueue_t *rq)
94 xeno_flush_rq(RT_BUFFER, rq, buffer);
99 ssize_t rt_buffer_read_inner(RT_BUFFER *bf,
struct xnbufd *bufd,
100 xntmode_t timeout_mode, RTIME timeout);
102 ssize_t rt_buffer_write_inner(RT_BUFFER *bf,
struct xnbufd *bufd,
103 xntmode_t timeout_mode, RTIME timeout);
107 #define __native_buffer_pkg_init() ({ 0; })
108 #define __native_buffer_pkg_cleanup() do { } while(0)
109 #define __native_buffer_flush_rq(rq) do { } while(0)
119 typedef RT_BUFFER_PLACEHOLDER RT_BUFFER;
131 bf->opaque = XN_NO_HANDLE;
155 const void *ptr,
size_t size,
159 const void *ptr,
size_t size,
163 void *ptr,
size_t size,
166 ssize_t rt_buffer_read_until(RT_BUFFER *bf,
167 void *ptr,
size_t size,
173 RT_BUFFER_INFO *info);
ssize_t rt_buffer_write_until(RT_BUFFER *bf, const void *ptr, size_t size, RTIME timeout)
Write to a buffer (with absolute timeout date).
Definition: buffer.c:63
int rt_buffer_create(RT_BUFFER *bf, const char *name, size_t bufsz, int mode)
Create a buffer.
Definition: buffer.c:24
int rt_buffer_delete(RT_BUFFER *bf)
Delete a buffer.
Definition: buffer.c:37
This file is part of the Xenomai project.
ssize_t rt_buffer_write(RT_BUFFER *bf, const void *ptr, size_t size, RTIME timeout)
Write to a buffer.
Definition: buffer.c:56
ssize_t rt_buffer_read(RT_BUFFER *bf, void *ptr, size_t size, RTIME timeout)
Read from a buffer.
Definition: buffer.c:42
int rt_buffer_bind(RT_BUFFER *bf, const char *name, RTIME timeout)
Bind to a buffer.
Definition: buffer.c:31
int rt_buffer_clear(RT_BUFFER *bf)
Clear a buffer.
Definition: buffer.c:70
int rt_buffer_inquire(RT_BUFFER *bf, RT_BUFFER_INFO *info)
Inquire about a buffer.
Definition: buffer.c:76
static int rt_buffer_unbind(RT_BUFFER *bf)
Unbind from a buffer.
Definition: buffer.h:129
This file is part of the Xenomai project.