|
CAN programming interface environment
Version 3.10
|
A CAN frame FIFO can be assigned to a message buffer by calling CpCoreFifoConfig(). This file defines the structure of a CAN frame FIFO (CpFifo_s) and inline functions to access the FIFO.
#include "canpie.h"Data Structures | |
| struct | CpFifo_s |
Functions | |
| void | CpFifoClear (CpFifo_ts *ptsFifoV) |
| bool_t | CpFifoCopy (CpFifo_ts *ptsDestFifoV, CpFifo_ts *ptsSrcFifoV) |
| CpCanMsg_ts * | CpFifoDataInPtr (CpFifo_ts *ptsFifoV) |
| CpCanMsg_ts * | CpFifoDataOutPtr (CpFifo_ts *ptsFifoV) |
| uint32_t | CpFifoFree (CpFifo_ts *ptsFifoV) |
| void | CpFifoIncIn (CpFifo_ts *ptsFifoV) |
| void | CpFifoIncOut (CpFifo_ts *ptsFifoV) |
| void | CpFifoInit (CpFifo_ts *ptsFifoV, CpCanMsg_ts *ptsCanMsgV, uint32_t ulSizeV) |
| bool_t | CpFifoIsEmpty (CpFifo_ts *ptsFifoV) |
| bool_t | CpFifoIsFull (CpFifo_ts *ptsFifoV) |
| uint32_t | CpFifoPending (CpFifo_ts *ptsFifoV) |
| void CpFifoClear | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
This function clears all entries inside the FIFO.
| [in] | ptsDestFifoV | Pointer to CAN frame FIFO destination |
| [in] | ptsSrcFifoV | Pointer to CAN frame FIFO source |
true if the contents have been copied, otherwise false This function copies the contents from ptsSrcFifoV to ptsDestFifoV. The function checks if the destination FIFO has the same size as the source FIFO. Both FIFOs have to be initialised by CpFifoInit() in advance.
| CpCanMsg_ts * CpFifoDataInPtr | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
This function returns a pointer to the next free CAN frame entry inside the FIFO. Please make sure to call CpFifoIsFull() in advance. After writing to the FIFO, the index has to be adjusted by calling CpFifoIncIn(), as shown in this code example:
| CpCanMsg_ts * CpFifoDataOutPtr | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
This function returns a pointer to the first CAN frame entry inside the FIFO. Please make sure to call CpFifoIsEmpty() in advance. After reading from the FIFO, the index has to be adjusted by calling CpFifoIncOut(), as shown in this code example:
| uint32_t CpFifoFree | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
Returns the number of free elements inside the FIFO given by the pointer ptsFifoV.
| void CpFifoIncIn | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
Increments the CpFifo_ts::ulIndexIn element of the CAN frame FIFO.
| void CpFifoIncOut | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
Increments the CpFifo_ts::ulIndexOut element of the CAN frame FIFO.
| void CpFifoInit | ( | CpFifo_ts * | ptsFifoV, |
| CpCanMsg_ts * | ptsCanMsgV, | ||
| uint32_t | ulSizeV ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
| [in] | ptsCanMsgV | Pointer to array of CAN frames |
| [in] | ulSizeV | Size of CAN frame array |
This function initialises a CAN frame FIFO. The parameter ptsCanMsgV points to an array of CpCanMsg_ts elements. The number of CAN frames that can be stored in the array is determined by the parameter ulSizeV.
Example: initialising a CAN frame FIFO
| bool_t CpFifoIsEmpty | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
true if FIFO is empty, otherwise false Returns true if the FIFO is empty; otherwise returns false.
| bool_t CpFifoIsFull | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
true if FIFO is full, otherwise false Returns true if the FIFO is full; otherwise returns false.
| uint32_t CpFifoPending | ( | CpFifo_ts * | ptsFifoV | ) |
| [in] | ptsFifoV | Pointer to CAN frame FIFO |
Returns the number of pending elements inside the FIFO given by ptsFifoV.