/home/hillier_g/checkout/most4linux/most-kernel/most-txbuf.c File Reference

Implementation of the transmit buffer. More...

Go to the source code of this file.

Defines

#define PR   "txbuf: "

Functions

tx_buffertxbuf_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)
static void txbuf_update_full_frame_count (struct tx_buffer *ring)
bool txbuf_is_full (struct tx_buffer *ring, int writer_index)
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)


Detailed Description

Implementation of the transmit buffer.

Definition in file most-txbuf.c.


Define Documentation

#define PR   "txbuf: "

Prefix for printk() messages from this module.

Definition at line 48 of file most-txbuf.c.


Function Documentation

struct tx_buffer* txbuf_alloc ( unsigned int  writer_count,
unsigned int  frame_count,
unsigned int  bytes_per_frame 
)

Parameters:
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
Returns:
the allocated ring buffer or NULL if the ring buffer could not be allocated (an error message will be printed)

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.

Parameters:
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.

Parameters:
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
Returns:
the number of elements 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().

static void txbuf_update_full_frame_count ( struct tx_buffer ring  )  [static]

Updates the full frame count

Parameters:
ring the ring buffer

Definition at line 181 of file most-txbuf.c.

References tx_buffer::bytes_per_frame, tx_buffer::frame_count, tx_buffer::full_count, tx_buffer::readptr, tx_buffer::writeptr, and tx_buffer::writer_count.

Referenced by txbuf_put().

bool txbuf_is_full ( struct tx_buffer ring,
int  writer_index 
)

Checks if the buffer is full for the specified writer.

Parameters:
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().

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.

Parameters:
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.
Returns:
the number of bytes that have been copied successfully

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().


Generated on Fri Mar 9 14:48:58 2007 for MOST Linux Drivers (Linux and RTAI) by  doxygen 1.5.0