Go to the source code of this file.
Data Structures | |
struct | tx_buffer |
Functions | |
tx_buffer * | txbuf_alloc (unsigned int writer_count, unsigned int frame_count, unsigned int bytes_per_frame) |
void | txbuf_free (struct tx_buffer *ring) |
ssize_t | txbuf_get (struct tx_buffer *ring, unsigned char *buffer, size_t bytes) |
ssize_t | txbuf_put (struct tx_buffer *ring, int writer_index, struct frame_part frame_part, const char *buffer, size_t bytes, struct rtnrt_memcopy_desc *copy) |
bool | txbuf_is_full (struct tx_buffer *ring, int writer_index) |
void | txbuf_print_debug (struct tx_buffer *ring) |
Definition in file most-txbuf.h.
struct tx_buffer* txbuf_alloc | ( | unsigned int | writer_count, | |
unsigned int | frame_count, | |||
unsigned int | bytes_per_frame | |||
) |
writer_count | the number of writers | |
frame_count | the number of frames that are in the ring buffer | |
bytes_per_frame | the number of bytes needed per frame |
Definition at line 54 of file most-txbuf.c.
References tx_buffer::buffer, tx_buffer::bytes_per_frame, tx_buffer::frame_count, tx_buffer::full_count, ker_malloc, tx_buffer::lock, PR, pr_txbuf_debug, tx_buffer::readptr, rtnrt_err, rtnrt_lock_init, tx_buffer::writeptr, and tx_buffer::writer_count.
void txbuf_free | ( | struct tx_buffer * | ring | ) |
Frees the ring buffer. Don't use ring
after calling this function any more.
ring | the ring buffer |
Definition at line 107 of file most-txbuf.c.
References tx_buffer::buffer.
ssize_t txbuf_get | ( | struct tx_buffer * | ring, | |
unsigned char * | buffer, | |||
size_t | bytes | |||
) |
Reads element_count frames from the ring buffer.
ring | the ring buffer | |
buffer | the buffer to copy (usually a DMA buffer) | |
bytes | the number of bytes that should be copied. If there are less than bytes elements in the ring, only the number of elements in the ring are copied |
Definition at line 120 of file most-txbuf.c.
References tx_buffer::buffer, tx_buffer::bytes_per_frame, tx_buffer::frame_count, tx_buffer::full_count, tx_buffer::lock, PR, tx_buffer::readptr, rtnrt_err, rtnrt_lock_get_irqsave, and rtnrt_lock_put_irqrestore.
Referenced by most_sync_int_handler(), and most_sync_rt_interrupt_handler().
ssize_t txbuf_put | ( | struct tx_buffer * | ring, | |
int | writer_index, | |||
struct frame_part | frame_part, | |||
const char * | buffer, | |||
size_t | bytes, | |||
struct rtnrt_memcopy_desc * | copy | |||
) |
Puts bytes
bytes in the ring.
ring | the ring buffer | |
writer_index | the index of the writer that wants to put data in the buffer. The index is not checked! | |
frame_part | the part of the frame the user is interested | |
buffer | userspace buffer from which the data is copied. The function uses the copy function that checks if it is valid memory, no additional checks must be done before | |
bytes | the number of bytes that are in the userspace buffer | |
copy | the copy descriptor, see description of struct rtnrt_memcopy_desc. |
Definition at line 216 of file most-txbuf.c.
References tx_buffer::buffer, tx_buffer::bytes_per_frame, frame_part::count, tx_buffer::frame_count, tx_buffer::lock, frame_part::offset, PR, pr_txbuf_debug, tx_buffer::readptr, rtnrt_copy, rtnrt_err, rtnrt_lock_get_irqsave, rtnrt_lock_put_irqrestore, txbuf_update_full_frame_count(), and tx_buffer::writeptr.
Referenced by most_sync_write().
Checks if the buffer is full for the specified writer.
ring | the ring buffer | |
writer_index | the index of the writer |
Definition at line 200 of file most-txbuf.c.
References tx_buffer::bytes_per_frame, tx_buffer::frame_count, tx_buffer::readptr, and tx_buffer::writeptr.
Referenced by most_sync_write().
void txbuf_print_debug | ( | struct tx_buffer * | ring | ) |
Prints debug information (printk()) of the ring buffer. Don't call this function on large ring buffers because the whole buffer is printed in hex values and large buffers would fill the kernel ring buffer here and slowdown the whole system!
ring | the ring buffer |