CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
fifo_api.h
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
13#ifndef CDI_FIFO_API_H__
14#define CDI_FIFO_API_H__
15
16#include <stdbool.h>
17#include <stdint.h>
18
19#include "cdi_core_api.h"
20#include "cdi_os_api.h"
21
22//*********************************************************************************************************************
23//***************************************** START OF DEFINITIONS AND TYPES ********************************************
24//*********************************************************************************************************************
25
31
42
49typedef void (*CdiFifoFullCallback)(const CdiFifoFullCbData* cb_data_ptr);
50
55typedef struct {
56 bool is_read;
61
69typedef void (*CdiFifoCallback)(const CdiFifoCbData* data_ptr);
70
71//*********************************************************************************************************************
72//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
73//*********************************************************************************************************************
74
88CDI_INTERFACE bool CdiFifoCreate(const char* name_str, int item_count, int item_byte_size,
89 CdiFifoFullCallback full_cb_ptr, CdiUserCbParameter full_user_cb_param,
90 CdiFifoHandle* ret_handle_ptr);
91
103CDI_INTERFACE bool CdiFifoRead(CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal,
104 void* item_dest_ptr);
105
112
123CDI_INTERFACE bool CdiFifoWrite(CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal,
124 const void* item_ptr);
125
131CDI_INTERFACE const char* CdiFifoGetName(CdiFifoHandle handle);
132
133#ifdef DEBUG
141void CdiFifoDebugEnable(CdiFifoHandle handle, CdiFifoCallback cb_ptr);
142
148void CdiFifoDebugDisable(CdiFifoHandle handle);
149#endif //DEBUG
150
157
158#endif // CDI_FIFO_API_H__
159
This file declares the public API data types, structures and functions that comprise the CDI low-leve...
void * CdiUserCbParameter
Type used as user defined data that is passed to the registered user RX/TX callback functions.
Definition cdi_core_api.h:182
This file contains the declarations for OS functions for creating/managing/freeing threads,...
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
#define CDI_INTERFACE
Specify C linkage when compiling as C++ and define API interface export for Windows.
Definition cdi_utility_api.h:34
void(* CdiFifoCallback)(const CdiFifoCbData *data_ptr)
Prototype of FIFO debug callback function.
Definition fifo_api.h:69
CDI_INTERFACE const char * CdiFifoGetName(CdiFifoHandle handle)
Definition fifo.c:274
void(* CdiFifoFullCallback)(const CdiFifoFullCbData *cb_data_ptr)
Prototype of FIFO write callback function. It is invoked whenever CdiFifoWrite() is used to write to ...
Definition fifo_api.h:49
CDI_INTERFACE bool CdiFifoWrite(CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, const void *item_ptr)
Definition fifo.c:192
CDI_INTERFACE void CdiFifoDestroy(CdiFifoHandle handle)
Definition fifo.c:301
CDI_INTERFACE void CdiFifoFlush(CdiFifoHandle handle)
Definition fifo.c:124
CDI_INTERFACE 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)
Definition fifo.c:65
CDI_INTERFACE bool CdiFifoRead(CdiFifoHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, void *item_dest_ptr)
Definition fifo.c:132
struct CdiFifoState * CdiFifoHandle
Type used as the handle (pointer to an opaque structure) for a FIFO. Each handle represents a instanc...
Definition fifo_api.h:30
A structure of this type is passed as the parameter to CdiFifoCallback(). It contains the state of a ...
Definition fifo_api.h:55
bool is_read
True if FIFO read triggered the callback, otherwise a FIFO write triggered it.
Definition fifo_api.h:56
void * item_data_ptr
Pointer to item data.
Definition fifo_api.h:59
int tail_index
Current tail index position in FIFO.
Definition fifo_api.h:58
int head_index
Current head index position in FIFO.
Definition fifo_api.h:57
A structure of this type is passed as the parameter to CdiFifoFullCallback().
Definition fifo_api.h:35
const void * new_item_data_ptr
Pointer to item trying to be written to FIFO.
Definition fifo_api.h:38
void * tail_item_data_ptr
Pointer to current tail data item in FIFO.
Definition fifo_api.h:40
void * head_item_data_ptr
Pointer to current head data item in FIFO.
Definition fifo_api.h:39
CdiFifoHandle fifo_handle
FIFO handle.
Definition fifo_api.h:36
CdiUserCbParameter fifo_user_cb_param
User defined callback parameter.
Definition fifo_api.h:37
Structure used to hold state data for a single FIFO.
Definition fifo.c:32