Data Structures | Typedefs | Functions
RingBuf.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for RingBuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RingBuf_Object
 

Typedefs

typedef struct RingBuf_Object RingBuf_Object
 
typedef struct RingBuf_ObjectRingBuf_Handle
 

Functions

void RingBuf_construct (RingBuf_Handle object, unsigned char *bufPtr, size_t bufSize)
 Initialize circular buffer. More...
 
int RingBuf_get (RingBuf_Handle object, unsigned char *data)
 Get an unsigned char from the end of the circular buffer and remove it. More...
 
int RingBuf_getCount (RingBuf_Handle object)
 Get the number of unsigned chars currently stored on the circular buffer. More...
 
bool RingBuf_isFull (RingBuf_Handle object)
 Function to determine if the circular buffer is full or not. More...
 
int RingBuf_getMaxCount (RingBuf_Handle object)
 A high-water mark indicating the largest number of unsigned chars stored on the circular buffer since it was constructed. More...
 
int RingBuf_peek (RingBuf_Handle object, unsigned char *data)
 Get an unsigned char from the end of the circular buffer without removing it. More...
 
int RingBuf_put (RingBuf_Handle object, unsigned char data)
 Put an unsigned char into the end of the circular buffer. More...
 

Typedef Documentation

§ RingBuf_Object

§ RingBuf_Handle

typedef struct RingBuf_Object * RingBuf_Handle

Function Documentation

§ RingBuf_construct()

void RingBuf_construct ( RingBuf_Handle  object,
unsigned char *  bufPtr,
size_t  bufSize 
)

Initialize circular buffer.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
bufPtrPointer to data buffer to be used for the circular buffer. The buffer is NOT stored in RingBuf_Object.
bufSizeThe size of bufPtr in number of unsigned chars.

§ RingBuf_get()

int RingBuf_get ( RingBuf_Handle  object,
unsigned char *  data 
)

Get an unsigned char from the end of the circular buffer and remove it.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
dataPointer to an unsigned char to be filled with the data from the front of the circular buffer.
Returns
Number of unsigned chars on the buffer after taking it out of the circular buffer. If it returns -1, the circular buffer was already empty and data is invalid.

§ RingBuf_getCount()

int RingBuf_getCount ( RingBuf_Handle  object)

Get the number of unsigned chars currently stored on the circular buffer.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
Returns
Number of unsigned chars on the circular buffer.

§ RingBuf_isFull()

bool RingBuf_isFull ( RingBuf_Handle  object)

Function to determine if the circular buffer is full or not.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
Returns
true if circular buffer is full, else false.

§ RingBuf_getMaxCount()

int RingBuf_getMaxCount ( RingBuf_Handle  object)

A high-water mark indicating the largest number of unsigned chars stored on the circular buffer since it was constructed.

Returns
Get the largest number of unsigned chars that were at one point in the circular buffer.

§ RingBuf_peek()

int RingBuf_peek ( RingBuf_Handle  object,
unsigned char *  data 
)

Get an unsigned char from the end of the circular buffer without removing it.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
dataPointer to an unsigned char to be filled with the data from the front of the circular buffer. This function does not remove the data from the circular buffer. Do not evaluate data if the count returned is equal to 0.
Returns
Number of unsigned chars on the circular buffer. If the number != 0, then data will contain the unsigned char at the end of the circular buffer.

§ RingBuf_put()

int RingBuf_put ( RingBuf_Handle  object,
unsigned char  data 
)

Put an unsigned char into the end of the circular buffer.

Parameters
objectPointer to a RingBuf Object that contains the member variables to operate a circular buffer.
dataunsigned char to be placed at the end of the circular buffer.
Returns
Number of unsigned chars on the buffer after it was added, or -1 if it's already full.
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale