ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
isf_fifo.h File Reference
#include <mqxlite.h>
#include "isf_types.h"
#include "lwevent.h"
Include dependency graph for isf_fifo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  isf_fifo_t
 

Macros

#define ISF_FIFO_ERR_NO_MEM   (1)
 
#define ISF_FIFO_ERR_USER_BUF   (2)
 
#define ISF_FIFO_ERR_BUSY   (3)
 
#define ISF_FIFO_ERR_INVALID_PTR   (4)
 
#define ISF_FIFO_ERR_NO_INIT   (5)
 
#define ISF_FIFO_FULL   (6)
 
#define ISF_FIFO_NO_MORE_ENTRIES   (7)
 

Typedefs

typedef uint32 isf_fifo_status_t
 

Functions

isf_fifo_status_t isf_fifo_alloc (isf_fifo_t *pFifo, uint16 sampleSize, uint16 bufferCapacity)
 Initializes a fifo structure and allocates a new fifo buffer. More...
 
isf_fifo_status_t isf_fifo_init (isf_fifo_t *pFifo, void *pData, uint16 sampleSize, uint16 bufferCapacity)
 Initializes a new fifo structure with a provided buffer. More...
 
isf_fifo_status_t isf_fifo_free (isf_fifo_t *pFifo)
 free a fifo's sample buffer. More...
 
isf_fifo_status_t isf_fifo_resize (isf_fifo_t *pFifo, uint16 newCapacity)
 Routine to copy the whole sample buffer. More...
 
uint16 isf_fifo_get_buffer_size (isf_fifo_t *pFifo)
 Routine to query the current fifo size (bytes) More...
 
isf_fifo_status_t isf_fifo_data_copy (isf_fifo_t *pFifo, void *samplePtr)
 Routine to copy the whole sample buffer. More...
 
isf_fifo_status_t isf_fifo_lock (isf_fifo_t *pFifo)
 Lock a sample buffer for exclusive access. More...
 
isf_fifo_status_t isf_fifo_try_lock (isf_fifo_t *pFifo)
 Attempt to lock a sample buffer for exclusive access. More...
 
isf_fifo_status_t isf_fifo_unlock (isf_fifo_t *pFifo)
 Release the exclusive access lock on a sample buffer. More...
 
void * isf_fifo_el_get_insert_pointer (isf_fifo_t *pFifo)
 Routine returns the insert pointer for direct access. More...
 
isf_fifo_status_t isf_fifo_el_increment (isf_fifo_t *pFifo)
 Routine increments the insert pointer after direct access. More...
 
isf_fifo_status_t isf_fifo_el_traverse (isf_fifo_t *pFifo, void **pSamplePtr)
 Routine to traverse a fifo To initiate the traversal set pSamplePtr to NULL. The function will set the pointer to the first available sample and returns ISF_SUCCESS. Subsequent calls will increment the pointer to each available sample and return ISF_SUCCESS. When ISF_SUCCESS is returned, pSamplePtr may be dereferenced to obtain a fifo entry. When no more samples are available, the function returns ISF_FIFO_NO_MORE_ENTRIES. More...
 
isf_fifo_status_t isf_fifo_el_clear (isf_fifo_t *pFifo)
 Routine to clear the fifo. More...
 

Macro Definition Documentation

#define ISF_FIFO_ERR_BUSY   (3)

Definition at line 29 of file isf_fifo.h.

Referenced by isf_fifo_try_lock().

#define ISF_FIFO_ERR_INVALID_PTR   (4)

Definition at line 30 of file isf_fifo.h.

Referenced by isf_fifo_init().

#define ISF_FIFO_ERR_NO_INIT   (5)
#define ISF_FIFO_ERR_NO_MEM   (1)

Definition at line 27 of file isf_fifo.h.

Referenced by isf_fifo_init().

#define ISF_FIFO_ERR_USER_BUF   (2)

Definition at line 28 of file isf_fifo.h.

Referenced by isf_fifo_resize().

#define ISF_FIFO_NO_MORE_ENTRIES   (7)

Definition at line 33 of file isf_fifo.h.

Referenced by fsl_fusion_virt_3D_orient_PeriodicCallback(), and isf_fifo_el_traverse().

Typedef Documentation

Definition at line 15 of file isf_fifo.h.

Function Documentation

isf_fifo_status_t isf_fifo_alloc ( isf_fifo_t pFifo,
uint16  sampleSize,
uint16  bufferCapacity 
)

Initializes a fifo structure and allocates a new fifo buffer.

Initializes a fifo structure and allocates a new fifo buffer.

Definition at line 69 of file isf_fifo.c.

References isf_fifo_init().

Here is the call graph for this function:

isf_fifo_status_t isf_fifo_data_copy ( isf_fifo_t pFifo,
void *  samplePtr 
)

Routine to copy the whole sample buffer.

Definition at line 155 of file isf_fifo.c.

References isf_fifo_t::bufferLock, ISF_FIFO_ERR_NO_INIT, isf_mem_copy(), ISF_SUCCESS, isf_fifo_t::pDataBuffer, and isf_fifo_t::pLastEntry.

Here is the call graph for this function:

isf_fifo_status_t isf_fifo_el_clear ( isf_fifo_t pFifo)

Routine to clear the fifo.

Definition at line 220 of file isf_fifo.c.

References FIFO_FULL_CLR_MASK, isf_fifo_t::fifoState, ISF_SUCCESS, isf_fifo_t::pDataBuffer, and isf_fifo_t::pInsertPtr.

Referenced by App1_MainTask(), and fsl_fusion_virt_3D_orient_PeriodicCallback().

Here is the caller graph for this function:

isf_fifo_status_t isf_fifo_el_traverse ( isf_fifo_t pFifo,
void **  pSamplePtr 
)

Routine to traverse a fifo To initiate the traversal set pSamplePtr to NULL. The function will set the pointer to the first available sample and returns ISF_SUCCESS. Subsequent calls will increment the pointer to each available sample and return ISF_SUCCESS. When ISF_SUCCESS is returned, pSamplePtr may be dereferenced to obtain a fifo entry. When no more samples are available, the function returns ISF_FIFO_NO_MORE_ENTRIES.

Definition at line 262 of file isf_fifo.c.

References FIFO_FULL_BIT, isf_fifo_t::fifoState, ISF_FIFO_NO_MORE_ENTRIES, ISF_SUCCESS, isf_fifo_t::pDataBuffer, isf_fifo_t::pInsertPtr, and isf_fifo_t::sampleSize.

Referenced by fsl_fusion_virt_3D_orient_PeriodicCallback().

Here is the caller graph for this function:

uint16 isf_fifo_get_buffer_size ( isf_fifo_t pFifo)

Routine to query the current fifo size (bytes)

Routine to query the current fifo size (bytes)

Definition at line 134 of file isf_fifo.c.

References isf_fifo_t::pDataBuffer, isf_fifo_t::pLastEntry, and isf_fifo_t::sampleSize.

Referenced by isf_fifo_resize().

Here is the caller graph for this function:

isf_fifo_status_t isf_fifo_init ( isf_fifo_t pFifo,
void *  pData,
uint16  sampleSize,
uint16  bufferCapacity 
)
isf_fifo_status_t isf_fifo_resize ( isf_fifo_t pFifo,
uint16  newCapacity 
)

Routine to copy the whole sample buffer.

Routine to copy the whole sample buffer.

Warning: When the fifo is resized all sample data in the buffer is lost. It is suggested to resize only when empty

Definition at line 101 of file isf_fifo.c.

References ALLOCATED_BUFFER_BIT, isf_fifo_t::bufferLock, isf_fifo_t::fifoState, ISF_FIFO_ERR_NO_INIT, ISF_FIFO_ERR_USER_BUF, isf_fifo_get_buffer_size(), ISF_SUCCESS, isf_fifo_t::pDataBuffer, and isf_fifo_t::sampleSize.

Here is the call graph for this function:

isf_fifo_status_t isf_fifo_try_lock ( isf_fifo_t pFifo)

Attempt to lock a sample buffer for exclusive access.

Definition at line 184 of file isf_fifo.c.

References isf_fifo_t::bufferLock, ISF_FIFO_ERR_BUSY, ISF_SUCCESS, and TRUE.