Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
dvb_ringbuffer.h File Reference
#include <linux/spinlock.h>
#include <linux/wait.h>

Go to the source code of this file.

Data Structures

struct  dvb_ringbuffer
 

Macros

#define DVB_RINGBUFFER_PKTHDRSIZE   3
 
#define DVB_RINGBUFFER_PEEK(rbuf, offs)   (rbuf)->data[((rbuf)->pread+(offs))%(rbuf)->size]
 
#define DVB_RINGBUFFER_SKIP(rbuf, num)   (rbuf)->pread=((rbuf)->pread+(num))%(rbuf)->size
 
#define DVB_RINGBUFFER_WRITE_BYTE(rbuf, byte)
 

Functions

void dvb_ringbuffer_init (struct dvb_ringbuffer *rbuf, void *data, size_t len)
 
int dvb_ringbuffer_empty (struct dvb_ringbuffer *rbuf)
 
ssize_t dvb_ringbuffer_free (struct dvb_ringbuffer *rbuf)
 
ssize_t dvb_ringbuffer_avail (struct dvb_ringbuffer *rbuf)
 
void dvb_ringbuffer_reset (struct dvb_ringbuffer *rbuf)
 
void dvb_ringbuffer_flush (struct dvb_ringbuffer *rbuf)
 
void dvb_ringbuffer_flush_spinlock_wakeup (struct dvb_ringbuffer *rbuf)
 
ssize_t dvb_ringbuffer_read_user (struct dvb_ringbuffer *rbuf, u8 __user *buf, size_t len)
 
void dvb_ringbuffer_read (struct dvb_ringbuffer *rbuf, u8 *buf, size_t len)
 
ssize_t dvb_ringbuffer_write (struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len)
 
ssize_t dvb_ringbuffer_pkt_write (struct dvb_ringbuffer *rbuf, u8 *buf, size_t len)
 
ssize_t dvb_ringbuffer_pkt_read_user (struct dvb_ringbuffer *rbuf, size_t idx, int offset, u8 __user *buf, size_t len)
 
ssize_t dvb_ringbuffer_pkt_read (struct dvb_ringbuffer *rbuf, size_t idx, int offset, u8 *buf, size_t len)
 
void dvb_ringbuffer_pkt_dispose (struct dvb_ringbuffer *rbuf, size_t idx)
 
ssize_t dvb_ringbuffer_pkt_next (struct dvb_ringbuffer *rbuf, size_t idx, size_t *pktlen)
 

Macro Definition Documentation

#define DVB_RINGBUFFER_PEEK (   rbuf,
  offs 
)    (rbuf)->data[((rbuf)->pread+(offs))%(rbuf)->size]

Definition at line 105 of file dvb_ringbuffer.h.

#define DVB_RINGBUFFER_PKTHDRSIZE   3

Definition at line 44 of file dvb_ringbuffer.h.

#define DVB_RINGBUFFER_SKIP (   rbuf,
  num 
)    (rbuf)->pread=((rbuf)->pread+(num))%(rbuf)->size

Definition at line 109 of file dvb_ringbuffer.h.

#define DVB_RINGBUFFER_WRITE_BYTE (   rbuf,
  byte 
)
Value:
{ (rbuf)->data[(rbuf)->pwrite]=(byte); \
(rbuf)->pwrite=((rbuf)->pwrite+1)%(rbuf)->size; }

Definition at line 126 of file dvb_ringbuffer.h.

Function Documentation

ssize_t dvb_ringbuffer_avail ( struct dvb_ringbuffer rbuf)

Definition at line 75 of file dvb_ringbuffer.c.

int dvb_ringbuffer_empty ( struct dvb_ringbuffer rbuf)

Definition at line 56 of file dvb_ringbuffer.c.

void dvb_ringbuffer_flush ( struct dvb_ringbuffer rbuf)

Definition at line 87 of file dvb_ringbuffer.c.

void dvb_ringbuffer_flush_spinlock_wakeup ( struct dvb_ringbuffer rbuf)

Definition at line 100 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_free ( struct dvb_ringbuffer rbuf)

Definition at line 63 of file dvb_ringbuffer.c.

void dvb_ringbuffer_init ( struct dvb_ringbuffer rbuf,
void data,
size_t  len 
)

Definition at line 42 of file dvb_ringbuffer.c.

void dvb_ringbuffer_pkt_dispose ( struct dvb_ringbuffer rbuf,
size_t  idx 
)

Dispose of a packet in the ring buffer.

<rbuf> Ring buffer concerned. <idx> Packet index as returned by dvb_ringbuffer_pkt_next().

Definition at line 236 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_pkt_next ( struct dvb_ringbuffer rbuf,
size_t  idx,
size_t pktlen 
)

Get the index of the next packet in a ringbuffer.

<rbuf> Ringbuffer concerned. <idx> Previous packet index, or -1 to return the first packet index. <pktlen> On success, will be updated to contain the length of the packet in bytes. returns Packet index (if >=0), or -1 if no packets available.

Definition at line 255 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_pkt_read ( struct dvb_ringbuffer rbuf,
size_t  idx,
int  offset,
u8 buf,
size_t  len 
)

Definition at line 211 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_pkt_read_user ( struct dvb_ringbuffer rbuf,
size_t  idx,
int  offset,
u8 __user buf,
size_t  len 
)

Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this does NOT update the read pointer in the ringbuffer. You must use dvb_ringbuffer_pkt_dispose() to mark a packet as no longer required.

<rbuf> Ringbuffer concerned. <idx> Packet index as returned by dvb_ringbuffer_pkt_next(). <offset> Offset into packet to read from. <buf> Destination buffer for data. <len> Size of destination buffer. <usermem> Set to 1 if <buf> is in userspace. returns Number of bytes read, or -EFAULT.

Definition at line 183 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_pkt_write ( struct dvb_ringbuffer rbuf,
u8 buf,
size_t  len 
)

Write a packet into the ringbuffer.

<rbuf> Ringbuffer to write to. <buf> Buffer to write. <len> Length of buffer (currently limited to 65535 bytes max). returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL.

Definition at line 169 of file dvb_ringbuffer.c.

void dvb_ringbuffer_read ( struct dvb_ringbuffer rbuf,
u8 buf,
size_t  len 
)

Definition at line 132 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_read_user ( struct dvb_ringbuffer rbuf,
u8 __user buf,
size_t  len 
)

Definition at line 111 of file dvb_ringbuffer.c.

void dvb_ringbuffer_reset ( struct dvb_ringbuffer rbuf)

Definition at line 94 of file dvb_ringbuffer.c.

ssize_t dvb_ringbuffer_write ( struct dvb_ringbuffer rbuf,
const u8 buf,
size_t  len 
)

Definition at line 150 of file dvb_ringbuffer.c.