16#include <l4/sys/thread.h>
51#define L4SHMC_RINGBUF_POISONING 1
62#if L4SHMC_RINGBUF_POISONING
67#if L4SHMC_RINGBUF_POISONING
72#if L4SHMC_RINGBUF_POISONING
104#define L4SHMC_RINGBUF_HEAD(ringbuf) ((l4shmc_ringbuf_head_t*)((ringbuf)->_addr))
113#define L4SHMC_RINGBUF_DATA(ringbuf) (L4SHMC_RINGBUF_HEAD(ringbuf)->data)
122#define L4SHMC_RINGBUF_DATA_SIZE(ringbuf) ((ringbuf)->_size - sizeof(l4shmc_ringbuf_head_t))
134 ASSERT_NOT_NULL(head);
135 ASSERT_ASSERT(head->lock > lock_cont_min);
136 ASSERT_ASSERT(head->lock < lock_cont_max);
145 ASSERT_NOT_NULL(head);
146 ASSERT_ASSERT(head->lock > lock_cont_min);
147 ASSERT_ASSERT(head->lock < lock_cont_max);
149 head->lock = unlocked;
173 char const *chunk_name,
174 char const *signal_name,
unsigned size);
236 char *data,
unsigned dsize);
254 unsigned size,
int block_if_necessary);
286 char const *chunk_name,
287 char const *signal_name);
unsigned int l4_uint32_t
Unsigned 32bit value.
unsigned long l4_cap_idx_t
Capability selector type.
l4_msgtag_t l4_thread_yield(void) L4_NOTHROW
Yield current time slice.
#define __END_DECLS
End section with C types and functions.
#define L4_CV
Define calling convention.
#define __BEGIN_DECLS
Start section with C types and functions.
int l4util_cmpxchg32(volatile l4_uint32_t *dest, l4_uint32_t cmp_val, l4_uint32_t new_val)
Atomic compare and exchange (32 bit version)
void l4shmc_rb_sender_commit_packet(l4shmc_ringbuf_t *buf)
Tell the consumer that new data is available.
char * l4shmc_rb_sender_alloc_packet(l4shmc_ringbuf_head_t *head, unsigned psize)
Allocate a packet of a given size within the ring buffer.
int l4shmc_rb_attach_sender(l4shmc_ringbuf_t *buf, char const *signal_name, l4_cap_idx_t owner)
Attach to sender signal of a ring buffer.
void l4shmc_rb_attach_receiver(l4shmc_ringbuf_t *buf, l4_cap_idx_t owner)
Attach to receiver signal of a ring buffer.
int l4shmc_rb_receiver_copy_out(l4shmc_ringbuf_head_t *head, char *target, unsigned *tsize)
Copy data out of the buffer.
void l4shmc_rb_deinit_buffer(l4shmc_ringbuf_t *buf)
De-init a ring buffer.
int l4shmc_rb_init_receiver(l4shmc_ringbuf_t *buf, l4shmc_area_t *area, char const *chunk_name, char const *signal_name)
Initialize receive buffer.
int l4shmc_rb_receiver_wait_for_data(l4shmc_ringbuf_t *buf, int blocking)
Check if (and optionally block until) new data is ready.
int l4shmc_rb_init_buffer(l4shmc_ringbuf_t *buf, l4shmc_area_t *area, char const *chunk_name, char const *signal_name, unsigned size)
Initialize a ring buffer by creating an SHMC chunk and the corresponding signals.
int l4shmc_rb_receiver_read_next_size(l4shmc_ringbuf_head_t *head)
Have a look at the ring buffer and see which size the next packet to be read has.
int l4shmc_rb_sender_next_copy_in(l4shmc_ringbuf_t *buf, char *data, unsigned size, int block_if_necessary)
Copy in packet from an external data source.
void l4shmc_rb_receiver_notify_done(l4shmc_ringbuf_t *buf)
Notify producer that space is available.
void l4shmc_rb_sender_put_data(l4shmc_ringbuf_t *buf, char *addr, char *data, unsigned dsize)
Copy data into a previously allocated packet.
Shared memory library header file.
Head field of a ring buffer.
unsigned sender_waits
sender waiting?
unsigned next_read
offset to next read packet
unsigned next_write
offset to next write packet
unsigned bytes_filled
bytes filled in buffer
char * _signame
base name of the ring buffer signals
l4shmc_area_t * _area
L4SHM area this buffer is located in.
l4shmc_chunk_t _chunk
chunk descriptor
l4shmc_signal_t _signal_full
"full" signal - triggered when data is produced
l4shmc_ringbuf_head_t * _addr
pointer to ring buffer head
l4_cap_idx_t _owner
owner (attached to send/recv signal)
unsigned _size
chunk size // XXX do we need this?
char * _chunkname
name of the ring buffer chunk
l4shmc_signal_t _signal_empty
"empty" signal - triggered when data is consumed
Some useful assert-style macros.