CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains definitions and implementation for a simple FIFO. More...
#include "fifo_api.h"
#include <stddef.h>
#include <assert.h>
#include "configuration.h"
#include "cdi_os_api.h"
Data Structures | |
struct | CdiFifoState |
Structure used to hold state data for a single FIFO. More... | |
Functions | |
bool | CdiFifoCreate (const char *name_str, int item_count, int item_byte_size, CdiFifoFullCallback full_cb_ptr, CdiUserCbParameter full_user_cb_param, CdiFifoHandle *ret_handle_ptr) |
void | CdiFifoFlush (CdiFifoHandle handle) |
bool | CdiFifoRead (CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, void *item_dest_ptr) |
bool | CdiFifoWrite (CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, const void *data_ptr) |
const char * | CdiFifoGetName (CdiFifoHandle handle) |
void | CdiFifoDestroy (CdiFifoHandle handle) |
This file contains definitions and implementation for a simple FIFO.
bool CdiFifoCreate | ( | const char * | name_str, |
int | item_count, | ||
int | item_byte_size, | ||
CdiFifoFullCallback | full_cb_ptr, | ||
CdiUserCbParameter | full_user_cb_param, | ||
CdiFifoHandle * | ret_handle_ptr ) |
Create a FIFO.
name_str | Pointer to name of FIFO to copy to the new FIFO instance. |
item_count | Number of items in the FIFO (FIFO depth). |
item_byte_size | Size of each item in bytes. |
full_cb_ptr | Address of callback function invoked when the FIFO is full and CdiFifoWrite() is used. Specify NULL if not used. |
full_user_cb_param | User defined parameter used in structure passed to full_cb_ptr. |
ret_handle_ptr | Pointer to returned handle of the new FIFO. |
void CdiFifoDestroy | ( | CdiFifoHandle | handle | ) |
Destroy a FIFO.
handle | FIFO handle. |
void CdiFifoFlush | ( | CdiFifoHandle | handle | ) |
Flush all entries from the FIFO.
handle | FIFO handle. |
const char * CdiFifoGetName | ( | CdiFifoHandle | handle | ) |
Get name of FIFO that was defined when FIFO was created.
handle | FIFO handle. |
bool CdiFifoRead | ( | CdiFifoHandle | handle, |
int | timeout_ms, | ||
CdiSignalType | abort_wait_signal, | ||
void * | item_dest_ptr ) |
Read an item from the FIFO buffer and copy to item_dest_ptr.
handle | FIFO handle. |
timeout_ms | If FIFO is empty, this is the number of milliseconds to wait for data before returning. |
abort_wait_signal | Optional signal used to abort the read if the FIFO is empty. Use NULL to specific no signal. |
item_dest_ptr | Pointer to buffer where to copy the item to. Size of buffer must be large enough to hold the data. Data size was set when the FIFO was created (see item_byte_size). |
bool CdiFifoWrite | ( | CdiFifoHandle | handle, |
int | timeout_ms, | ||
CdiSignalType | abort_wait_signal, | ||
const void * | item_ptr ) |
Write an item to the FIFO.
handle | FIFO handle. |
timeout_ms | If FIFO is full, this is the number of milliseconds to wait for an open entry before returning. |
abort_wait_signal | Optional signal used to abort the write if the FIFO is full. Use NULL to specific no signal. |
item_ptr | Pointer where to copy the item from. |