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

Implementation of the receive buffer. More...

Go to the source code of this file.

Defines

#define PR   "rxbuf: "

Functions

rx_bufferrxbuf_alloc (unsigned int reader_count, unsigned int frame_count, unsigned int bytes_per_frame)
void rxbuf_free (struct rx_buffer *ring)
ssize_t rxbuf_get (struct rx_buffer *ring, unsigned int reader_index, struct frame_part frame_part, unsigned char *buffer, size_t bytes, struct rtnrt_memcopy_desc *copy)
bool rxbuf_is_empty (struct rx_buffer *ring, int reader_index)
ssize_t rxbuf_put (struct rx_buffer *ring, unsigned char *buffer, size_t bytes)


Detailed Description

Implementation of the receive buffer.

Definition in file most-rxbuf.c.


Define Documentation

#define PR   "rxbuf: "

Prefix for printk() messages in this module.

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


Function Documentation

struct rx_buffer* rxbuf_alloc ( unsigned int  reader_count,
unsigned int  frame_count,
unsigned int  bytes_per_frame 
)

Parameters:
reader_count the number of readers
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-rxbuf.c.

References rx_buffer::buffer, rx_buffer::bytes_per_frame, rx_buffer::frame_count, ker_malloc, PR, pr_rxbuf_debug, rx_buffer::reader_count, rx_buffer::readptr, rtnrt_err, and rx_buffer::writeptr.

void rxbuf_free ( struct rx_buffer ring  ) 

Frees the ring buffer. Don't use ring after calling this function any more.

Parameters:
ring the ring buffer

Definition at line 105 of file most-rxbuf.c.

References rx_buffer::buffer.

ssize_t rxbuf_get ( struct rx_buffer ring,
unsigned int  reader_index,
struct frame_part  frame_part,
unsigned char *  buffer,
size_t  bytes,
struct rtnrt_memcopy_desc copy 
)

Reads bytes bytes from the ring buffer.

Parameters:
ring the ring buffer
reader_index the index of the reader
frame_part the interesting frame part
buffer buffer from which the data is copied
bytes the number of frames that should be copied
copy the copy descriptor, see description of struct rtnrt_memcopy_desc.
Returns:
the number of bytes that have been copied successfully

Definition at line 118 of file most-rxbuf.c.

References rx_buffer::buffer, rx_buffer::bytes_per_frame, frame_part::count, rx_buffer::frame_count, frame_part::offset, PR, pr_rxbuf_debug, rx_buffer::readptr, rtnrt_copy, rtnrt_err, rtnrt_warn, and rx_buffer::writeptr.

Referenced by most_sync_read().

bool rxbuf_is_empty ( struct rx_buffer ring,
int  reader_index 
)

Checks if data is available for reading.

Parameters:
ring the ring buffer
reader_index the reader index

Definition at line 189 of file most-rxbuf.c.

References rx_buffer::readptr, and rx_buffer::writeptr.

Referenced by most_sync_read().

ssize_t rxbuf_put ( struct rx_buffer ring,
unsigned char *  buffer,
size_t  bytes 
)

Puts bytes in the ring.

Parameters:
ring the ring buffer
buffer buffer from which the data is copied
bytes the number of frames that should be copied. This function overwrites old frames (because it is usually called from a interrupt service routine and cannot be blocked)
Returns:
the number of bytes that have been copied successfully

Definition at line 197 of file most-rxbuf.c.

References rx_buffer::buffer, rx_buffer::bytes_per_frame, rx_buffer::frame_count, PR, pr_rxbuf_debug, return_value_if_fails_dbg, rtnrt_err, and rx_buffer::writeptr.

Referenced by measuring_receive_isr_wakeup(), most_sync_int_handler(), and most_sync_rt_interrupt_handler().


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