iLLD_TC29x
1.0
iLLD_TC29x
IFX Low Level Drivers
Modules
Data Structures
Files
File List
Assert.c
Assert.h
Bsp.c
Bsp.h
CompilerDcc.c
CompilerDcc.h
CompilerGnuc.c
CompilerGnuc.h
Compilers.h
CompilerTasking.c
CompilerTasking.h
Icu.h
Ifx_Assert.h
Ifx_CircularBuffer.asm.c
Ifx_CircularBuffer.c
Ifx_CircularBuffer.h
Ifx_Console.c
Ifx_Console.h
Ifx_DateTime.c
Ifx_DateTime.h
Ifx_Fifo.c
Ifx_Fifo.h
Ifx_GlobalResources.c
Ifx_GlobalResources.h
Ifx_InternalMux.c
Ifx_InternalMux.h
Ifx_LowPassPt1.c
Ifx_LowPassPt1.h
Ifx_Shell.c
Ifx_Shell.h
Ifx_Types.h
Ifx_TypesDcc.h
Ifx_TypesGnuc.h
Ifx_TypesTasking.h
IfxAsclin.c
IfxAsclin.h
IfxAsclin_Asc.c
IfxAsclin_Asc.h
IfxAsclin_cfg.h
IfxAsclin_Lin.c
IfxAsclin_Lin.h
IfxAsclin_PinMap.c
IfxAsclin_PinMap.h
IfxAsclin_Spi.c
IfxAsclin_Spi.h
IfxCcu6.c
IfxCcu6.h
IfxCcu6_cfg.c
IfxCcu6_cfg.h
IfxCcu6_Icu.c
IfxCcu6_Icu.h
IfxCcu6_PinMap.c
IfxCcu6_PinMap.h
IfxCcu6_PwmBc.c
IfxCcu6_PwmBc.h
IfxCcu6_PwmHl.c
IfxCcu6_PwmHl.h
IfxCcu6_Timer.c
IfxCcu6_Timer.h
IfxCcu6_TimerWithTrigger.c
IfxCcu6_TimerWithTrigger.h
IfxCcu6_TPwm.c
IfxCcu6_TPwm.h
IfxCif.c
IfxCif.h
IfxCif_Cam.c
IfxCif_Cam.h
IfxCif_cfg.c
IfxCif_cfg.h
IfxCif_PinMap.c
IfxCif_PinMap.h
IfxCpu.c
IfxCpu.h
IfxCpu_cfg.c
IfxCpu_cfg.h
IfxCpu_CStart.h
IfxCpu_CStart0.c
IfxCpu_CStart1.c
IfxCpu_CStart2.c
IfxCpu_Intrinsics.h
IfxCpu_IntrinsicsDcc.h
IfxCpu_IntrinsicsGnuc.h
IfxCpu_IntrinsicsTasking.h
IfxCpu_Irq.c
IfxCpu_Irq.h
IfxCpu_Trap.c
IfxCpu_Trap.h
IfxDma.c
IfxDma.h
IfxDma_cfg.c
IfxDma_cfg.h
IfxDma_Dma.c
IfxDma_Dma.h
IfxDsadc.c
IfxDsadc.h
IfxDsadc_cfg.h
IfxDsadc_Dsadc.c
IfxDsadc_Dsadc.h
IfxDsadc_PinMap.c
IfxDsadc_PinMap.h
IfxDts.c
IfxDts.h
IfxDts_cfg.h
IfxDts_Dts.c
IfxDts_Dts.h
IfxEbu.c
IfxEbu.h
IfxEbu_BFlashSpansion.c
IfxEbu_BFlashSpansion.h
IfxEbu_BFlashSt.c
IfxEbu_BFlashSt.h
IfxEbu_cfg.h
IfxEbu_Dram.c
IfxEbu_Dram.h
IfxEbu_Sram.c
IfxEbu_Sram.h
IfxEmem.c
IfxEmem.h
IfxEmem_cfg.h
IfxEray.c
IfxEray.h
IfxEray_cfg.h
IfxEray_Eray.c
IfxEray_Eray.h
IfxEray_PinMap.c
IfxEray_PinMap.h
IfxEth.c
IfxEth.h
IfxEth_cfg.h
IfxEth_Phy_Pef7071.c
IfxEth_Phy_Pef7071.h
IfxEth_PinMap.c
IfxEth_PinMap.h
IfxFce.c
IfxFce.h
IfxFce_cfg.h
IfxFce_Crc.c
IfxFce_Crc.h
IfxFft.c
IfxFft.h
IfxFft_cfg.h
IfxFft_Fft.c
IfxFft_Fft.h
IfxFlash.c
IfxFlash.h
IfxFlash_cfg.c
IfxFlash_cfg.h
IfxGlobal_cfg.h
IfxGpt12.c
IfxGpt12.h
IfxGpt12_cfg.h
IfxGpt12_IncrEnc.c
IfxGpt12_IncrEnc.h
IfxGpt12_PinMap.c
IfxGpt12_PinMap.h
IfxGtm.c
IfxGtm.h
IfxGtm_Atom.c
IfxGtm_Atom.h
IfxGtm_Atom_Pwm.c
IfxGtm_Atom_Pwm.h
IfxGtm_Atom_PwmHl.c
IfxGtm_Atom_PwmHl.h
IfxGtm_Atom_Timer.c
IfxGtm_Atom_Timer.h
IfxGtm_cfg.h
IfxGtm_Cmu.c
IfxGtm_Cmu.h
IfxGtm_Dpll.c
IfxGtm_Dpll.h
IfxGtm_PinMap.c
IfxGtm_PinMap.h
IfxGtm_Tbu.c
IfxGtm_Tbu.h
IfxGtm_Tim.c
IfxGtm_Tim.h
IfxGtm_Tom.c
IfxGtm_Tom.h
IfxGtm_Tom_Pwm.c
IfxGtm_Tom_Pwm.h
IfxGtm_Tom_PwmHl.c
IfxGtm_Tom_PwmHl.h
IfxGtm_Tom_Timer.c
IfxGtm_Tom_Timer.h
IfxGtm_Trig.c
IfxGtm_Trig.h
IfxHssl.c
IfxHssl.h
IfxHssl_cfg.h
IfxHssl_Hssl.c
IfxHssl_Hssl.h
IfxI2c.c
IfxI2c.h
IfxI2c_cfg.h
IfxI2c_I2c.c
IfxI2c_I2c.h
IfxI2c_PinMap.c
IfxI2c_PinMap.h
IfxIom.c
IfxIom.h
IfxIom_cfg.h
IfxIom_Iom.c
IfxIom_Iom.h
IfxLldVersion.h
IfxMsc.c
IfxMsc.h
IfxMsc_cfg.c
IfxMsc_cfg.h
IfxMsc_Msc.c
IfxMsc_Msc.h
IfxMsc_PinMap.c
IfxMsc_PinMap.h
IfxMtu.c
IfxMtu.h
IfxMtu_cfg.c
IfxMtu_cfg.h
IfxMultican.c
IfxMultican.h
IfxMultican_Can.c
IfxMultican_Can.h
IfxMultican_cfg.c
IfxMultican_cfg.h
IfxMultican_PinMap.c
IfxMultican_PinMap.h
IfxPort.c
IfxPort.h
IfxPort_cfg.c
IfxPort_cfg.h
IfxPort_Io.c
IfxPort_Io.h
IfxPort_PinMap.c
IfxPort_PinMap.h
IfxPsi5.c
IfxPsi5.h
IfxPsi5_cfg.c
IfxPsi5_cfg.h
IfxPsi5_PinMap.c
IfxPsi5_PinMap.h
IfxPsi5_Psi5.c
IfxPsi5_Psi5.h
IfxPsi5s.c
IfxPsi5s.h
IfxPsi5s_cfg.h
IfxPsi5s_PinMap.c
IfxPsi5s_PinMap.h
IfxPsi5s_Psi5s.c
IfxPsi5s_Psi5s.h
IfxQspi.c
IfxQspi.h
IfxQspi_cfg.h
IfxQspi_PinMap.c
IfxQspi_PinMap.h
IfxQspi_SpiMaster.c
IfxQspi_SpiMaster.h
IfxQspi_SpiSlave.c
IfxQspi_SpiSlave.h
IfxScu_cfg.c
IfxScu_cfg.h
IfxScu_PinMap.c
IfxScu_PinMap.h
IfxScuCcu.c
IfxScuCcu.h
IfxScuEru.c
IfxScuEru.h
IfxScuWdt.asm.h
IfxScuWdt.c
IfxScuWdt.h
IfxSent.c
IfxSent.h
IfxSent_cfg.c
IfxSent_cfg.h
IfxSent_PinMap.c
IfxSent_PinMap.h
IfxSent_Sent.c
IfxSent_Sent.h
IfxSmu_PinMap.c
IfxSmu_PinMap.h
IfxSrc.c
IfxSrc.h
IfxSrc_cfg.c
IfxSrc_cfg.h
IfxStdIf.h
IfxStdIf_DPipe.c
IfxStdIf_DPipe.h
IfxStdIf_Pos.c
IfxStdIf_Pos.h
IfxStdIf_PwmHl.c
IfxStdIf_PwmHl.h
IfxStdIf_Timer.c
IfxStdIf_Timer.h
IfxStm.c
IfxStm.h
IfxStm_cfg.c
IfxStm_cfg.h
IfxVadc.c
IfxVadc.h
IfxVadc_Adc.c
IfxVadc_Adc.h
IfxVadc_cfg.c
IfxVadc_cfg.h
IfxVadc_PinMap.c
IfxVadc_PinMap.h
lld_api.c
lld_codingRules.c
lld_codingRules_codeFormating.c
lld_codingRules_commonApis.c
lld_codingRules_if.c
lld_conventions.c
lld_conventionsDoxygen.c
lld_dosanddont.c
lld_dosanddont_enumUsage.c
lld_dosanddont_namingConvention.c
lld_dosanddont_optimisation.c
lld_filesAndConfig.c
lld_structure.c
lld_versioning.c
mainpage.c
Platform_Types.h
PwmHl.h
SpiIf.c
SpiIf.h
Timer.h
TPwm.h
Globals
Ifx_Fifo.h
Go to the documentation of this file.
1
/**
2
* \file Ifx_Fifo.h
3
* \brief FIFO buffer functions
4
* \ingroup IfxLld_lib_datahandling_fifo
5
*
6
* \version iLLD_1_0_0_11_0
7
* \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8
*
9
*
10
* IMPORTANT NOTICE
11
*
12
*
13
* Infineon Technologies AG (Infineon) is supplying this file for use
14
* exclusively with Infineon's microcontroller products. This file can be freely
15
* distributed within development tools that are supporting such microcontroller
16
* products.
17
*
18
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
*
24
* \defgroup IfxLld_lib_datahandling_fifo FIFO
25
* This module implements the FIFO buffer functionality.
26
* \ingroup IfxLld_lib_datahandling
27
*
28
*/
29
30
#ifndef IFX_FIFO_H
31
#define IFX_FIFO_H 1
32
//------------------------------------------------------------------------------
33
#include "Ifx_Cfg.h"
34
#include "
Cpu/Std/IfxCpu_Intrinsics.h
"
35
//------------------------------------------------------------------------------
36
37
/** Shared data of the FIFO
38
*
39
*/
40
typedef
struct
41
{
42
Ifx_SizeT
count
;
/**< \brief number of bytes contained in the buffer */
43
sint32
readerWaitx
;
/**< \brief Number of bytes that the reader is waiting for. When the writer modify it to 0 the reader get signaled */
44
sint32
writerWaitx
;
/**< \brief Number of byte that the writer expect to be free. When the reader modify it to 0 the reader get signaled */
45
Ifx_SizeT
maxcount
;
/**< \brief Highest value seen in the count */
46
}
Ifx_Fifo_Shared
;
47
48
/** \addtogroup IfxLld_lib_datahandling_fifo
49
* \{ */
50
/** Fifo object
51
*
52
*/
53
typedef
struct
_Fifo
54
{
55
void
*
buffer
;
/**< \brief aligned on 64 bit boundary */
56
Ifx_Fifo_Shared
shared
;
/**< \brief data shared between reader / writer */
57
Ifx_SizeT
startIndex
;
/**< \brief buffer valid data start index */
58
Ifx_SizeT
endIndex
;
/**< \brief buffer valid data end index */
59
Ifx_SizeT
size
;
/**< \brief multiple of 8 bit, max 0xFFF8 */
60
Ifx_SizeT
elementSize
;
/**< \brief minimum number of bytes (block) added / removed to / from the buffer */
61
volatile
boolean
eventReader
;
/**< \brief event set by the writer to signal the reader that the required data are available in the buffer */
62
volatile
boolean
eventWriter
;
/**< \brief event set by the reader to signal the writer that the required free space are available in the buffer */
63
}
Ifx_Fifo
;
64
65
/** \brief Indicates if the required number of bytes are available in the buffer
66
*
67
* Should not be called from an interrupt as this function may wait forever
68
* \param fifo Pointer on the Fifo object
69
* \param count in bytes
70
* \param timeout in system timer ticks
71
*
72
* \return TRUE if at least count bytes can be read from the buffer, else
73
* the Event is armed to be set when the buffer count is bigger or equal to the requested count
74
*/
75
IFX_EXTERN
boolean
Ifx_Fifo_canReadCount
(
Ifx_Fifo
*fifo,
Ifx_SizeT
count,
Ifx_TickTime
timeout);
76
/** \brief Indicates if there is enough free space to write the data in the buffer
77
*
78
* Should not be called from an interrupt as this function may wait forever
79
*
80
* \param fifo Pointer on the Fifo object
81
* \param count in bytes
82
* \param timeout in system timer ticks
83
*
84
* \return TRUE if at least count bytes can be written to the buffer,
85
* if not the Event is armed to be set when the buffer free count is bigger or equal to the requested count
86
*/
87
IFX_EXTERN
boolean
Ifx_Fifo_canWriteCount
(
Ifx_Fifo
*fifo,
Ifx_SizeT
count,
Ifx_TickTime
timeout);
88
89
/** \brief Clear fifo contents.
90
*
91
* \param fifo Pointer on the Fifo object
92
*
93
* \return void
94
*/
95
IFX_EXTERN
void
Ifx_Fifo_clear
(
Ifx_Fifo
*fifo);
96
97
/** \brief Create a Fifo object
98
*
99
* The memory required for the object is allocated dynamically.
100
*
101
* \param size Specifies the FIFO buffer size in bytes
102
* \param elementSize Specifies data element size in bytes. size must be bigger or equal to elemenntSize.
103
*
104
* \return returns a pointer to the FIFO object
105
*
106
* \see Ifx_Fifo_destroy()
107
*/
108
IFX_EXTERN
Ifx_Fifo
*
Ifx_Fifo_create
(
Ifx_SizeT
size,
Ifx_SizeT
elementSize);
109
110
/** \brief Destroy the FIFO object
111
*
112
* This function must be called to destroy the fifo object when created with \ref Ifx_Fifo_create()
113
*
114
* \param fifo Pointer on the Fifo object
115
* \return void
116
*
117
* \see Ifx_Fifo_create()
118
*/
119
IFX_EXTERN
void
Ifx_Fifo_destroy
(
Ifx_Fifo
*fifo);
120
121
/** \brief Initialize the FIFO buffer object
122
*
123
* \param buffer Specifies the FIFO object address.
124
* \param size Specifies the FIFO buffer size in bytes
125
* \param elementSize Specifies data element size in bytes. size must be bigger or equal to elemenntSize.
126
*
127
* \return Returns a pointer on the FIFO object
128
*
129
* \note: The buffer parameter must point on a free memory location where the
130
* buffer object will be initialised. The size of this area must be at least
131
* equals to "size + sizeof(Ifx_Fifo) + 8". Not taking this in account may result
132
* in unpredictable behavior.
133
*/
134
IFX_EXTERN
Ifx_Fifo
*
Ifx_Fifo_init
(
void
*buffer,
Ifx_SizeT
size,
Ifx_SizeT
elementSize);
135
136
/** \brief Read data from a fifo and remove them from the buffer.
137
*
138
* Only complete elements are returned, if count is not a multiple of
139
* elementSize then the incomplete element is not read/removed from the buffer.
140
*
141
* \param fifo Pointer on the Fifo object
142
* \param data Pointer to the data buffer for storing values
143
* \param count in bytes
144
* \param timeout in system timer ticks
145
*
146
* \return return the number of byte that could not be read
147
*/
148
IFX_EXTERN
Ifx_SizeT
Ifx_Fifo_read
(
Ifx_Fifo
*fifo,
void
*data,
Ifx_SizeT
count,
Ifx_TickTime
timeout);
149
150
/** \brief Write data into a fifo.
151
*
152
* Only complete elements are written to the buffer, if count is not a multiple of
153
* elementSize then the incomplete element are not written to the buffer.
154
*
155
* \param fifo Pointer on the Fifo object
156
* \param data Pointer to the data buffer to write into the Fifo
157
* \param count in bytes
158
* \param timeout in system timer ticks
159
*/
160
IFX_EXTERN
Ifx_SizeT
Ifx_Fifo_write
(
Ifx_Fifo
*fifo,
const
void
*data,
Ifx_SizeT
count,
Ifx_TickTime
timeout);
161
162
/** \brief Empty the fifo
163
*
164
* \param fifo Pointer on the Fifo object
165
* \param timeout in system timer ticks
166
*
167
* \return TRUE if the buffer is emptied.
168
*/
169
IFX_INLINE
boolean
Ifx_Fifo_flush
(
Ifx_Fifo
*fifo,
Ifx_TickTime
timeout)
170
{
171
return
Ifx_Fifo_canWriteCount
(fifo, fifo->
size
, timeout);
172
}
173
174
175
/**
176
* \brief Returns the size of the data in the buffer in bytes
177
*
178
* \param fifo Pointer on the Fifo object
179
*
180
* Note as the Ifx_Fifo_write / Ifx_Fifo_read function does only write blocks which are
181
* a multiple of fifo->elementSize, the Ifx_Fifo_readCount / Ifx_Fifo_writeCount return
182
* a multiple of fifo->elementSize
183
*
184
* \return Returns the size of the data in the buffer in bytes
185
*/
186
IFX_INLINE
Ifx_SizeT
Ifx_Fifo_readCount
(
Ifx_Fifo
*fifo)
187
{
188
return
fifo->
shared
.
count
;
189
}
190
191
192
/** \brief Returns the free size in bytes
193
*
194
* \param fifo Pointer on the Fifo object
195
*
196
* Note as the Ifx_Fifo_write / Ifx_Fifo_read function does only write blocks which are
197
* a multiple of fifo->elementSize, the Ifx_Fifo_readCount / Ifx_Fifo_writeCount return
198
* a multiple of fifo->elementSize
199
*
200
* \return Returns the free size in bytes
201
*/
202
IFX_INLINE
Ifx_SizeT
Ifx_Fifo_writeCount
(
Ifx_Fifo
*fifo)
203
{
204
return
(
Ifx_SizeT
)(fifo->
size
-
Ifx_Fifo_readCount
(fifo));
205
}
206
207
208
/** \brief Indicates if the fifo is empty
209
*
210
* \param fifo Pointer on the Ifx_Fifo object
211
*
212
* \retval TRUE is the buffer is empty
213
* \retval FALSE is the buffer is not empty
214
*/
215
IFX_INLINE
boolean
Ifx_Fifo_isEmpty
(
Ifx_Fifo
*fifo)
216
{
217
return
(
Ifx_Fifo_readCount
(fifo) !=
FALSE
) ?
FALSE
:
TRUE
;
218
}
219
220
221
/**\}*/
222
//------------------------------------------------------------------------------
223
#endif
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC29x
_Lib
DataHandling
Ifx_Fifo.h
Generated by
1.8.4