#include <stdio.h>#include <stdlib.h>#include <math.h>#include "pa_ringbuffer.h"#include <string.h>Functions | |
| long | PaUtil_InitializeRingBuffer (PaUtilRingBuffer *rbuf, long numBytes, void *dataPtr) |
| long | PaUtil_GetRingBufferReadAvailable (PaUtilRingBuffer *rbuf) |
| long | PaUtil_GetRingBufferWriteAvailable (PaUtilRingBuffer *rbuf) |
| void | PaUtil_FlushRingBuffer (PaUtilRingBuffer *rbuf) |
| long | PaUtil_GetRingBufferWriteRegions (PaUtilRingBuffer *rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2) |
| long | PaUtil_AdvanceRingBufferWriteIndex (PaUtilRingBuffer *rbuf, long numBytes) |
| long | PaUtil_GetRingBufferReadRegions (PaUtilRingBuffer *rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2) |
| long | PaUtil_AdvanceRingBufferReadIndex (PaUtilRingBuffer *rbuf, long numBytes) |
| long | PaUtil_WriteRingBuffer (PaUtilRingBuffer *rbuf, const void *data, long numBytes) |
| long | PaUtil_ReadRingBuffer (PaUtilRingBuffer *rbuf, void *data, long numBytes) |
| long PaUtil_AdvanceRingBufferReadIndex | ( | PaUtilRingBuffer * | rbuf, | |
| long | numBytes | |||
| ) |
Advance the read index to the next location to be read.
| rbuf | The ring buffer. | |
| numBytes | The number of bytes to advance. |
| long PaUtil_AdvanceRingBufferWriteIndex | ( | PaUtilRingBuffer * | rbuf, | |
| long | numBytes | |||
| ) |
Advance the write index to the next location to be written.
| rbuf | The ring buffer. | |
| numBytes | The number of bytes to advance. |
| void PaUtil_FlushRingBuffer | ( | PaUtilRingBuffer * | rbuf | ) |
Clear buffer. Should only be called when buffer is NOT being read.
| rbuf | The ring buffer. |
| long PaUtil_GetRingBufferReadAvailable | ( | PaUtilRingBuffer * | rbuf | ) |
Retrieve the number of bytes available in the ring buffer for reading.
| rbuf | The ring buffer. |
| long PaUtil_GetRingBufferReadRegions | ( | PaUtilRingBuffer * | rbuf, | |
| long | numBytes, | |||
| void ** | dataPtr1, | |||
| long * | sizePtr1, | |||
| void ** | dataPtr2, | |||
| long * | sizePtr2 | |||
| ) |
Get address of region(s) from which we can write data.
| rbuf | The ring buffer. | |
| numBytes | The number of bytes desired. | |
| dataPtr1 | The address where the first (or only) region pointer will be stored. | |
| sizePtr1 | The address where the first (or only) region length will be stored. | |
| dataPtr2 | The address where the second region pointer will be stored if the first region is too small to satisfy numBytes. | |
| sizePtr2 | The address where the second region length will be stored if the first region is too small to satisfy numBytes. |
| long PaUtil_GetRingBufferWriteAvailable | ( | PaUtilRingBuffer * | rbuf | ) |
Retrieve the number of bytes available in the ring buffer for writing.
| rbuf | The ring buffer. |
| long PaUtil_GetRingBufferWriteRegions | ( | PaUtilRingBuffer * | rbuf, | |
| long | numBytes, | |||
| void ** | dataPtr1, | |||
| long * | sizePtr1, | |||
| void ** | dataPtr2, | |||
| long * | sizePtr2 | |||
| ) |
Get address of region(s) to which we can write data.
| rbuf | The ring buffer. | |
| numBytes | The number of bytes desired. | |
| dataPtr1 | The address where the first (or only) region pointer will be stored. | |
| sizePtr1 | The address where the first (or only) region length will be stored. | |
| dataPtr2 | The address where the second region pointer will be stored if the first region is too small to satisfy numBytes. | |
| sizePtr2 | The address where the second region length will be stored if the first region is too small to satisfy numBytes. |
| long PaUtil_InitializeRingBuffer | ( | PaUtilRingBuffer * | rbuf, | |
| long | numBytes, | |||
| void * | dataPtr | |||
| ) |
Initialize Ring Buffer.
| rbuf | The ring buffer. | |
| numBytes | The number of bytes in the buffer and must be power of 2. | |
| dataPtr | A pointer to a previously allocated area where the data will be maintained. It must be numBytes long. |
| long PaUtil_ReadRingBuffer | ( | PaUtilRingBuffer * | rbuf, | |
| void * | data, | |||
| long | numBytes | |||
| ) |
Read data from the ring buffer.
| rbuf | The ring buffer. | |
| data | The address where the data should be stored. | |
| numBytes | The number of bytes to be read. |
| long PaUtil_WriteRingBuffer | ( | PaUtilRingBuffer * | rbuf, | |
| const void * | data, | |||
| long | numBytes | |||
| ) |
Write data to the ring buffer.
| rbuf | The ring buffer. | |
| data | The address of new data to write to the buffer. | |
| numBytes | The number of bytes to be written. |
1.5.4