• Home • Files • Structures         • Download

cp_fifo.h File Reference

CANpie FIFO functions. More...

Include dependency graph for cp_fifo.h:


Functions

_TvCpStatus CpFifoInit (_TsCpFifo *ptsFifoV, _U32 ulSizeV)
_TvCpStatus CpFifoRelease (_TsCpFifo *ptsFifoV)
void CpFifoClear (_TsCpFifo *ptsFifoV)
_U32 CpFifoMsgCount (_TsCpFifo *ptsFifoV)
_TvCpStatus CpFifoPush (_TsCpFifo *ptsFifoV, _TsCpCanMsg *ptsCanMsgV)
_TvCpStatus CpFifoPop (_TsCpFifo *ptsFifoV, _TsCpCanMsg *ptsCanMsgV)

Detailed Description

The FIFO functions care for the handling of messages between the user interface (user functions) and the specific hardware implementation. The are currently two implementations for the FIFO: one with dynamic memory allocation (using malloc() and free() functions) and a second with static memory size. The latter is typically used for microcontroller implementations with low memory resources.

Function Documentation

void CpFifoClear ( _TsCpFifo *  ptsFifoV  ) 

Clear FIFO contents.

Parameters:
ptsFifoV pointer to FIFO
This function clears the specified FIFO buffer. All messages inside the FIFO are erased.

_TvCpStatus CpFifoInit ( _TsCpFifo *  ptsFifoV,
_U32  ulSizeV 
)

Setup FIFO.

Parameters:
ptsFifoV pointer to FIFO
Returns:
Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.
This function reserves memory for the specified FIFO buffer. If a static FIFO is used (CP_FIFO_TYPE == 1) the parameter 'ulSizeV' is not evaluated.

_U32 CpFifoMsgCount ( _TsCpFifo *  ptsFifoV  ) 

Check if FIFO is empty.

Parameters:
ptsFifoV pointer to FIFO
Returns:
number of messages stored in FIFO

_TvCpStatus CpFifoPop ( _TsCpFifo *  ptsFifoV,
_TsCpCanMsg ptsCanMsgV 
)

Pop message from FIFO.

Parameters:
ptsFifoV pointer to FIFO
ptsCanMsgV pointer to CAN message
Returns:
Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.
Pop a message from the FIFO buffer, given by the parameter 'ptsFifoV'. If the buffer is empty, the function will return 'CpErr_FIFO_EMPTY'.

_TvCpStatus CpFifoPush ( _TsCpFifo *  ptsFifoV,
_TsCpCanMsg ptsCanMsgV 
)

Push message into FIFO.

Parameters:
ptsFifoV pointer to FIFO
ptsCanMsgV pointer to CAN message
Returns:
Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.
Push a message into the FIFO buffer, given by the parameter 'ptsFifoV'. If the buffer is full, the function will return 'CpErr_FIFO_FULL'.

_TvCpStatus CpFifoRelease ( _TsCpFifo *  ptsFifoV  ) 

Remove FIFO.

Parameters:
ptsFifoV pointer to FIFO
Returns:
Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.
This function frees the reserved memory for the specified FIFO buffer. If a static FIFO is used (CP_FIFO_TYPE == 1) this function simply returns CpErr_OK.


 

© MicroControl GmbH & Co. KG

CANpie - V2.00