iLLD_TC27xD
1.0
|
Files | |
file | Ifx_Fifo.h |
FIFO buffer functions. | |
Data Structures | |
struct | _Fifo |
Typedefs | |
typedef struct _Fifo | Ifx_Fifo |
Functions | |
IFX_EXTERN boolean | Ifx_Fifo_canReadCount (Ifx_Fifo *fifo, Ifx_SizeT count, Ifx_TickTime timeout) |
Indicates if the required number of bytes are available in the buffer. More... | |
IFX_EXTERN boolean | Ifx_Fifo_canWriteCount (Ifx_Fifo *fifo, Ifx_SizeT count, Ifx_TickTime timeout) |
Indicates if there is enough free space to write the data in the buffer. More... | |
IFX_EXTERN void | Ifx_Fifo_clear (Ifx_Fifo *fifo) |
Clear fifo contents. More... | |
IFX_EXTERN Ifx_Fifo * | Ifx_Fifo_create (Ifx_SizeT size, Ifx_SizeT elementSize) |
Create a Fifo object. More... | |
IFX_EXTERN void | Ifx_Fifo_destroy (Ifx_Fifo *fifo) |
Destroy the FIFO object. More... | |
IFX_EXTERN Ifx_Fifo * | Ifx_Fifo_init (void *buffer, Ifx_SizeT size, Ifx_SizeT elementSize) |
Initialize the FIFO buffer object. More... | |
IFX_EXTERN Ifx_SizeT | Ifx_Fifo_read (Ifx_Fifo *fifo, void *data, Ifx_SizeT count, Ifx_TickTime timeout) |
Read data from a fifo and remove them from the buffer. More... | |
IFX_EXTERN Ifx_SizeT | Ifx_Fifo_write (Ifx_Fifo *fifo, const void *data, Ifx_SizeT count, Ifx_TickTime timeout) |
Write data into a fifo. More... | |
IFX_INLINE boolean | Ifx_Fifo_flush (Ifx_Fifo *fifo, Ifx_TickTime timeout) |
Empty the fifo. More... | |
IFX_INLINE Ifx_SizeT | Ifx_Fifo_readCount (Ifx_Fifo *fifo) |
Returns the size of the data in the buffer in bytes. More... | |
IFX_INLINE Ifx_SizeT | Ifx_Fifo_writeCount (Ifx_Fifo *fifo) |
Returns the free size in bytes. More... | |
IFX_INLINE boolean | Ifx_Fifo_isEmpty (Ifx_Fifo *fifo) |
Indicates if the fifo is empty. More... | |
This module implements the FIFO buffer functionality.
struct _Fifo |
Fifo object
Definition at line 53 of file Ifx_Fifo.h.
Data Fields | ||
---|---|---|
void * | buffer | aligned on 64 bit boundary |
Ifx_SizeT | elementSize | minimum number of bytes (block) added / removed to / from the buffer |
Ifx_SizeT | endIndex | buffer valid data end index |
volatile boolean | eventReader | event set by the writer to signal the reader that the required data are available in the buffer |
volatile boolean | eventWriter | event set by the reader to signal the writer that the required free space are available in the buffer |
Ifx_Fifo_Shared | shared | data shared between reader / writer |
Ifx_SizeT | size | multiple of 8 bit, max 0xFFF8 |
Ifx_SizeT | startIndex | buffer valid data start index |
IFX_EXTERN boolean Ifx_Fifo_canReadCount | ( | Ifx_Fifo * | fifo, |
Ifx_SizeT | count, | ||
Ifx_TickTime | timeout | ||
) |
Indicates if the required number of bytes are available in the buffer.
Should not be called from an interrupt as this function may wait forever
fifo | Pointer on the Fifo object |
count | in bytes |
timeout | in system timer ticks |
Definition at line 119 of file Ifx_Fifo.c.
Referenced by IfxAsclin_Asc_canReadCount().
IFX_EXTERN boolean Ifx_Fifo_canWriteCount | ( | Ifx_Fifo * | fifo, |
Ifx_SizeT | count, | ||
Ifx_TickTime | timeout | ||
) |
Indicates if there is enough free space to write the data in the buffer.
Should not be called from an interrupt as this function may wait forever
fifo | Pointer on the Fifo object |
count | in bytes |
timeout | in system timer ticks |
Definition at line 277 of file Ifx_Fifo.c.
Referenced by Ifx_Fifo_flush(), and IfxAsclin_Asc_canWriteCount().
IFX_EXTERN void Ifx_Fifo_clear | ( | Ifx_Fifo * | fifo) |
Clear fifo contents.
fifo | Pointer on the Fifo object |
Definition at line 240 of file Ifx_Fifo.c.
Referenced by IfxAsclin_Asc_clearRx(), and IfxAsclin_Asc_clearTx().
IFX_EXTERN Ifx_Fifo* Ifx_Fifo_create | ( | Ifx_SizeT | size, |
Ifx_SizeT | elementSize | ||
) |
Create a Fifo object.
The memory required for the object is allocated dynamically.
size | Specifies the FIFO buffer size in bytes |
elementSize | Specifies data element size in bytes. size must be bigger or equal to elemenntSize. |
Definition at line 51 of file Ifx_Fifo.c.
Referenced by IfxAsclin_Asc_initModule().
IFX_EXTERN void Ifx_Fifo_destroy | ( | Ifx_Fifo * | fifo) |
Destroy the FIFO object.
This function must be called to destroy the fifo object when created with Ifx_Fifo_create()
fifo | Pointer on the Fifo object |
Definition at line 68 of file Ifx_Fifo.c.
IFX_INLINE boolean Ifx_Fifo_flush | ( | Ifx_Fifo * | fifo, |
Ifx_TickTime | timeout | ||
) |
Empty the fifo.
fifo | Pointer on the Fifo object |
timeout | in system timer ticks |
Definition at line 169 of file Ifx_Fifo.h.
Referenced by IfxAsclin_Asc_flushTx().
IFX_EXTERN Ifx_Fifo* Ifx_Fifo_init | ( | void * | buffer, |
Ifx_SizeT | size, | ||
Ifx_SizeT | elementSize | ||
) |
Initialize the FIFO buffer object.
buffer | Specifies the FIFO object address. |
size | Specifies the FIFO buffer size in bytes |
elementSize | Specifies data element size in bytes. size must be bigger or equal to elemenntSize. |
Definition at line 74 of file Ifx_Fifo.c.
Referenced by Ifx_Fifo_create(), and IfxAsclin_Asc_initModule().
IFX_INLINE boolean Ifx_Fifo_isEmpty | ( | Ifx_Fifo * | fifo) |
Indicates if the fifo is empty.
fifo | Pointer on the Ifx_Fifo object |
TRUE | is the buffer is empty |
FALSE | is the buffer is not empty |
Definition at line 215 of file Ifx_Fifo.h.
Referenced by IfxAsclin_Asc_initiateTransmission().
IFX_EXTERN Ifx_SizeT Ifx_Fifo_read | ( | Ifx_Fifo * | fifo, |
void * | data, | ||
Ifx_SizeT | count, | ||
Ifx_TickTime | timeout | ||
) |
Read data from a fifo and remove them from the buffer.
Only complete elements are returned, if count is not a multiple of elementSize then the incomplete element is not read/removed from the buffer.
fifo | Pointer on the Fifo object |
data | Pointer to the data buffer for storing values |
count | in bytes |
timeout | in system timer ticks |
Definition at line 191 of file Ifx_Fifo.c.
Referenced by IfxAsclin_Asc_initiateTransmission(), IfxAsclin_Asc_isrTransmit(), and IfxAsclin_Asc_read().
IFX_INLINE Ifx_SizeT Ifx_Fifo_readCount | ( | Ifx_Fifo * | fifo) |
Returns the size of the data in the buffer in bytes.
fifo | Pointer on the Fifo object |
Note as the Ifx_Fifo_write / Ifx_Fifo_read function does only write blocks which are a multiple of fifo->elementSize, the Ifx_Fifo_readCount / Ifx_Fifo_writeCount return a multiple of fifo->elementSize
Definition at line 186 of file Ifx_Fifo.h.
Referenced by Ifx_Fifo_canReadCount(), Ifx_Fifo_canWriteCount(), Ifx_Fifo_isEmpty(), Ifx_Fifo_writeCount(), and IfxAsclin_Asc_getReadCount().
IFX_EXTERN Ifx_SizeT Ifx_Fifo_write | ( | Ifx_Fifo * | fifo, |
const void * | data, | ||
Ifx_SizeT | count, | ||
Ifx_TickTime | timeout | ||
) |
Write data into a fifo.
Only complete elements are written to the buffer, if count is not a multiple of elementSize then the incomplete element are not written to the buffer.
fifo | Pointer on the Fifo object |
data | Pointer to the data buffer to write into the Fifo |
count | in bytes |
timeout | in system timer ticks |
Definition at line 345 of file Ifx_Fifo.c.
Referenced by IfxAsclin_Asc_isrReceive(), and IfxAsclin_Asc_write().
IFX_INLINE Ifx_SizeT Ifx_Fifo_writeCount | ( | Ifx_Fifo * | fifo) |
Returns the free size in bytes.
fifo | Pointer on the Fifo object |
Note as the Ifx_Fifo_write / Ifx_Fifo_read function does only write blocks which are a multiple of fifo->elementSize, the Ifx_Fifo_readCount / Ifx_Fifo_writeCount return a multiple of fifo->elementSize
Definition at line 202 of file Ifx_Fifo.h.
Referenced by IfxAsclin_Asc_getWriteCount().