| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
isf_fifo.c File Reference
`#include "isf.h"`
`#include "isf_fifo.h"`
`#include "isf_util.h"`
Include dependency graph for isf_fifo.c:

Go to the source code of this file.

## Macros
#define | ALLOCATED_BUFFER_BIT ((uint8)(1<<0))
#define | FIFO_FULL_BIT ((uint8)(1<<7))
#define | FIFO_FULL_CLR_MASK ((uint8)~FIFO_FULL_BIT)

## Functions
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_alloc (isf_fifo_t *pFifo, uint16 sampleSize, uint16 bufferCapacity)
| Convenience function to initialize a fifo structure and allocate a new fifo 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 change the supported fifo depth. More...
uint16 | isf_fifo_get_buffer_size (isf_fifo_t *pFifo)
| Routine to query the current fifo buffer 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...
isf_fifo_status_t | isf_fifo_el_clear (isf_fifo_t *pFifo)
| Routine to clear the fifo. 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...

## Macro Definition Documentation

#define ALLOCATED_BUFFER_BIT ((uint8)(1<<0))

Definition at line 12 of file isf_fifo.c.

Referenced by isf_fifo_free(), isf_fifo_init(), and isf_fifo_resize().

#define FIFO_FULL_BIT ((uint8)(1<<7))

Definition at line 13 of file isf_fifo.c.

Referenced by isf_fifo_el_increment(), and isf_fifo_el_traverse().

#define FIFO_FULL_CLR_MASK ((uint8)~FIFO_FULL_BIT)

Definition at line 14 of file isf_fifo.c.

Referenced by isf_fifo_el_clear().

## Function Documentation

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

Convenience function to initialize a fifo structure and allocate 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:

void* isf_fifo_el_get_insert_pointer | ( | isf_fifo_t * | pFifo | ) |

Routine returns the insert pointer for direct access.

Definition at line 232 of file isf_fifo.c.

References isf_fifo_t::pInsertPtr.

Referenced by fsl_fusion_virt_3D_orient_PeriodicCallback(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxls8471_i2cspi_3D_accel_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(), fsl_mag3110_i2c_3D_mag_PeriodicCallback(), fsl_mma865x_i2c_3D_accel_PeriodicCallback(), and fsl_mpl3115_i2c_1D_press_PeriodicCallback().

Here is the caller graph for this function:

isf_fifo_status_t isf_fifo_el_increment | ( | isf_fifo_t * | pFifo | ) |

Routine increments the insert pointer after direct access.

Definition at line 240 of file isf_fifo.c.

References FIFO_FULL_BIT, isf_fifo_t::fifoState, ISF_FIFO_FULL, ISF_SUCCESS, isf_fifo_t::pInsertPtr, isf_fifo_t::pLastEntry, and isf_fifo_t::sampleSize.

Referenced by fsl_fusion_virt_3D_orient_PeriodicCallback(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxls8471_i2cspi_3D_accel_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(), fsl_mag3110_i2c_3D_mag_PeriodicCallback(), fsl_mma865x_i2c_3D_accel_PeriodicCallback(), and fsl_mpl3115_i2c_1D_press_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:

isf_fifo_status_t isf_fifo_free | ( | isf_fifo_t * | pFifo | ) |

free a fifo's sample buffer.

Definition at line 77 of file isf_fifo.c.

References ALLOCATED_BUFFER_BIT, isf_fifo_t::bufferLock, isf_fifo_t::fifoState, ISF_FIFO_ERR_NO_INIT, ISF_SUCCESS, isf_fifo_t::pDataBuffer, isf_fifo_t::pInsertPtr, and isf_fifo_t::pLastEntry.

uint16 isf_fifo_get_buffer_size | ( | isf_fifo_t * | pFifo | ) |

Routine to query the current fifo buffer 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
| ) |  |

Initializes a new fifo structure with a provided buffer.

Definition at line 19 of file isf_fifo.c.

References ALLOCATED_BUFFER_BIT, isf_fifo_t::bufferLock, isf_fifo_t::fifoState, ISF_FIFO_ERR_INVALID_PTR, ISF_FIFO_ERR_NO_INIT, ISF_FIFO_ERR_NO_MEM, isf_fifo_t::pDataBuffer, isf_fifo_t::pInsertPtr, isf_fifo_t::pLastEntry, and isf_fifo_t::sampleSize.

Referenced by App1_MainTask(), fsl_fusion_virt_3D_orient_Configure(), and isf_fifo_alloc().

Here is the caller graph for this function:

isf_fifo_status_t isf_fifo_lock | ( | isf_fifo_t * | pFifo | ) |

Lock a sample buffer for exclusive access.

Definition at line 171 of file isf_fifo.c.

References isf_fifo_t::bufferLock, ISF_FIFO_ERR_NO_INIT, and ISF_SUCCESS.

Referenced by App1_MainTask(), fsl_fusion_virt_3D_orient_PeriodicCallback(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxls8471_i2cspi_3D_accel_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(), fsl_mag3110_i2c_3D_mag_PeriodicCallback(), fsl_mma865x_i2c_3D_accel_PeriodicCallback(), and fsl_mpl3115_i2c_1D_press_PeriodicCallback().

Here is the caller graph for this function:

isf_fifo_status_t isf_fifo_resize | ( | isf_fifo_t * | pFifo,
|  | uint16 | newCapacity
| ) |  |

Routine to change the supported fifo depth.

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.

isf_fifo_status_t isf_fifo_unlock | ( | isf_fifo_t * | pFifo | ) |

Release the exclusive access lock on a sample buffer.

Definition at line 202 of file isf_fifo.c.

References isf_fifo_t::bufferLock, ISF_FIFO_ERR_NO_INIT, and ISF_SUCCESS.

Referenced by App1_MainTask(), fsl_fusion_virt_3D_orient_PeriodicCallback(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxls8471_i2cspi_3D_accel_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(), fsl_mag3110_i2c_3D_mag_PeriodicCallback(), fsl_mma865x_i2c_3D_accel_PeriodicCallback(), and fsl_mpl3115_i2c_1D_press_PeriodicCallback().

Here is the caller graph for this function:
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.