iLLD_TC27xD  1.0
IfxPsi5s.h
Go to the documentation of this file.
1 /**
2  * \file IfxPsi5s.h
3  * \brief PSI5S basic functionality
4  * \ingroup IfxLld_Psi5s
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_Psi5s_Std_Enumerations Enumerations
25  * \ingroup IfxLld_Psi5s_Std
26  * \defgroup IfxLld_Psi5s_Std_Channel Channel Operative Functions
27  * \ingroup IfxLld_Psi5s_Std
28  * \defgroup IfxLld_Psi5s_Std_IO IO Pin Configuration Functions
29  * \ingroup IfxLld_Psi5s_Std
30  * \defgroup IfxLld_Psi5s_Std_Interrupt Interrupt configuration functions
31  * \ingroup IfxLld_Psi5s_Std
32  * \defgroup IfxLld_Psi5s_Std_Module Module Functions
33  * \ingroup IfxLld_Psi5s_Std
34  */
35 
36 #ifndef IFXPSI5S_H
37 #define IFXPSI5S_H 1
38 
39 /******************************************************************************/
40 /*----------------------------------Includes----------------------------------*/
41 /******************************************************************************/
42 
43 #include "_Impl/IfxPsi5s_cfg.h"
46 #include "IfxPsi5s_bf.h"
47 #include "IfxPsi5s_reg.h"
48 #include "Src/Std/IfxSrc.h"
49 #include "Scu/Std/IfxScuCcu.h"
50 
51 /******************************************************************************/
52 /*--------------------------------Enumerations--------------------------------*/
53 /******************************************************************************/
54 
55 /** \addtogroup IfxLld_Psi5s_Std_Enumerations
56  * \{ */
57 /** \brief MODULE_PSI5S.IOCR.ALTI:Alternate input
58  */
59 typedef enum
60 {
61  IfxPsi5s_AlternateInput_0 = 0, /**< \brief Alternate Input 0 */
62  IfxPsi5s_AlternateInput_1, /**< \brief Alternate Input 1 */
63  IfxPsi5s_AlternateInput_2, /**< \brief Alternate Input 2 */
64  IfxPsi5s_AlternateInput_3 /**< \brief Alternate Input 3 */
66 
67 /** \brief MODULE_PSI5S.BG.BR_VALUE:Baudrate prescalar select
68  */
69 typedef enum
70 {
71  IfxPsi5s_AscBaudratePrescalar_divideBy2 = 0, /**< \brief Divide by 2 is selected for baudrate timer prescalar */
72  IfxPsi5s_AscBaudratePrescalar_divideBy3 = 1 /**< \brief Divide by 3 is selected for baudrate timer prescalar */
74 
75 /** \brief MODULE_PSI5S.CON.M:ASC mode of operation
76  */
77 typedef enum
78 {
79  IfxPsi5s_AscMode_sync = 0, /**< \brief Synchronous mode */
80  IfxPsi5s_AscMode_async_8bitData = 1, /**< \brief Asynchronous mode with 8 bit data */
81  IfxPsi5s_AscMode_async_7bitDataWithParity = 3, /**< \brief Asynchronous mode with 7 bit data with parity */
82  IfxPsi5s_AscMode_async_9bitData = 4, /**< \brief Asynchronous mode with 9 bit data */
83  IfxPsi5s_AscMode_async_8bitDataWithWakeup = 5, /**< \brief Asynchronous mode with 8 bit data with wakeup */
84  IfxPsi5s_AscMode_async_8bitDataWithParity = 7 /**< \brief Asynchronous mode with 8 bit data with parity */
86 
87 /** \brief MODULE_PSI5S.CON.STP: Number of stop bits
88  */
89 typedef enum
90 {
91  IfxPsi5s_AscStopBits_1 = 0, /**< \brief 1 stop bit */
92  IfxPsi5s_AscStopBits_2 /**< \brief 2 stop bit */
94 
95 /** \brief PSI5S Channel Id defined in MODULE_PSI5S.RDS.B.CID.
96  */
97 typedef enum
98 {
99  IfxPsi5s_ChannelId_0 = 0, /**< \brief Ifx_PSI5S Channel 0 */
100  IfxPsi5s_ChannelId_1, /**< \brief Ifx_PSI5S Channel 1 */
101  IfxPsi5s_ChannelId_2, /**< \brief Ifx_PSI5S Channel 2 */
102  IfxPsi5s_ChannelId_3, /**< \brief Ifx_PSI5S Channel 3 */
103  IfxPsi5s_ChannelId_4, /**< \brief Ifx_PSI5S Channel 4 */
104  IfxPsi5s_ChannelId_5, /**< \brief Ifx_PSI5S Channel 5 */
105  IfxPsi5s_ChannelId_6, /**< \brief Ifx_PSI5S Channel 6 */
106  IfxPsi5s_ChannelId_7, /**< \brief Ifx_PSI5S Channel 7 */
107  IfxPsi5s_ChannelId_none = -1 /**< \brief None of the Ifx_PSI5S Channels */
109 
110 /** \brief Clock Selection
111  */
112 typedef enum
113 {
114  IfxPsi5s_ClockType_fracDiv = 0, /**< \brief Fractional Divide clock */
115  IfxPsi5s_ClockType_timeStamp = 1, /**< \brief Timestamp clock */
116  IfxPsi5s_ClockType_ascFracDiv = 2, /**< \brief Asc Fractional divider clock */
117  IfxPsi5s_ClockType_ascOutput = 3 /**< \brief Asc output clock */
119 
120 /** \brief MODULE_PSI5S.RCRAx.CRCy(x= 0,1,..7:y=0,1,..,5),MODULE_PSI5S.RCRBx.CRCy(x= 0,1,..7:y=0,1,..,5)CRC or parity
121  */
122 typedef enum
123 {
124  IfxPsi5s_CrcOrParity_parity = 0, /**< \brief parity selection */
125  IfxPsi5s_CrcOrParity_crc = 1 /**< \brief CRC selection */
127 
128 /** \brief MODULE_PSI5S.FDR.DM;MODULE_PSI5S.FDRT.B.DM:Divider mode
129  */
130 typedef enum
131 {
132  IfxPsi5s_DividerMode_spb = 0, /**< \brief divider mode is off */
133  IfxPsi5s_DividerMode_normal = 1, /**< \brief divider mode is normal */
134  IfxPsi5s_DividerMode_fractional = 2, /**< \brief divider mode is fractional */
135  IfxPsi5s_DividerMode_off = 3 /**< \brief divider mode is off */
137 
138 /** \brief MODULE_PSI5S.SCRx.EPS(x=0,1,...,7):Enhanced protocol types
139  */
140 typedef enum
141 {
142  IfxPsi5s_EnhancedProtocol_toothGapMethod = 0, /**< \brief toothGapMethod Enhanced protocol type */
143  IfxPsi5s_EnhancedProtocol_pulseWidth_frameFormat_1to3 = 1, /**< \brief pulseWidth_frameFormat_1to3 Enhanced protocol type */
144  IfxPsi5s_EnhancedProtocol_pulseWidth_frameFormat_4 = 3 /**< \brief pulseWidth_frameFormat_4 Enhanced protocol type */
146 
147 /** \brief MODULE_PSI5S.RCRAx.FIDS(x=0,1,....,7):.Frame ID updation
148  */
149 typedef enum
150 {
151  IfxPsi5s_FrameId_frameHeader = 0, /**< \brief Frame ID is updated from packet frame header (Sync mode) */
152  IfxPsi5s_FrameId_rollingNumber = 1 /**< \brief Frame ID is a rolling number 0 .. 5 copied from FCNT */
154 
155 /** \brief MODULE_PSI5S.GCR.IDT:Idle time bit count
156  */
157 typedef enum
158 {
159  IfxPsi5s_IdleTime_1 = 0, /**< \brief 1 bit Idle time */
160  IfxPsi5s_IdleTime_2, /**< \brief 2 bit Idle time */
161  IfxPsi5s_IdleTime_3, /**< \brief 3 bit Idle time */
162  IfxPsi5s_IdleTime_4, /**< \brief 4 bit Idle time */
163  IfxPsi5s_IdleTime_5, /**< \brief 5 bit Idle time */
164  IfxPsi5s_IdleTime_6, /**< \brief 6 bit Idle time */
165  IfxPsi5s_IdleTime_7, /**< \brief 7 bit Idle time */
166  IfxPsi5s_IdleTime_8, /**< \brief 8 bit Idle time */
167  IfxPsi5s_IdleTime_9, /**< \brief 9 bit Idle time */
168  IfxPsi5s_IdleTime_10, /**< \brief 10 bit Idle time */
169  IfxPsi5s_IdleTime_11, /**< \brief 11 bit Idle time */
170  IfxPsi5s_IdleTime_12, /**< \brief 12 bit Idle time */
171  IfxPsi5s_IdleTime_13, /**< \brief 13 bit Idle time */
172  IfxPsi5s_IdleTime_14, /**< \brief 14 bit Idle time */
173  IfxPsi5s_IdleTime_15, /**< \brief 15 bit Idle time */
174  IfxPsi5s_IdleTime_16 /**< \brief 16 bit Idle time */
176 
177 /** \brief Messaging bits presence
178  */
179 typedef enum
180 {
181  IfxPsi5s_MessagingBits_absent = 0, /**< \brief No messaging bits */
182  IfxPsi5s_MessagingBits_present = 1 /**< \brief 2 messaging bits */
184 
185 /** \brief MODULE_PSI5S.NFC.NFx:Expected Psi5s frames
186  */
187 typedef enum
188 {
189  IfxPsi5s_NumberExpectedFrames_1 = 1, /**< \brief 1 psi5s frame expected */
190  IfxPsi5s_NumberExpectedFrames_2, /**< \brief 2 psi5s frame expected */
191  IfxPsi5s_NumberExpectedFrames_3, /**< \brief 3 psi5s frame expected */
192  IfxPsi5s_NumberExpectedFrames_4, /**< \brief 4 psi5s frame expected */
193  IfxPsi5s_NumberExpectedFrames_5, /**< \brief 5 psi5s frame expected */
194  IfxPsi5s_NumberExpectedFrames_6 /**< \brief 6 psi5s frame expected */
196 
197 /** \brief Enable/disable the sensitivity of the module to sleep signal\n
198  * Definition in Ifx_PSI5S.CLC.B.EDIS
199  */
200 typedef enum
201 {
202  IfxPsi5s_SleepMode_enable = 0, /**< \brief enables sleep mode */
203  IfxPsi5s_SleepMode_disable = 1 /**< \brief disables sleep mode */
205 
206 /** \brief MODULE_PSI5S.TSCNTA.B.TBS;MODULE_PSI5S.TSCNTB.B.TBS:Time base
207  */
208 typedef enum
209 {
210  IfxPsi5s_TimeBase_internal = 0, /**< \brief Internal time stamp clock */
211  IfxPsi5s_TimeBase_external = 1 /**< \brief External GTM inputs */
213 
214 /** \brief MODULE_PSI5S.TSCNTx(x= A,B):Timestamp register
215  */
216 typedef enum
217 {
218  IfxPsi5s_TimestampRegister_a = 0, /**< \brief Timestamp register A */
219  IfxPsi5s_TimestampRegister_b = 1 /**< \brief Timestamp register B */
221 
222 /** \brief MODULE_PSI5S.RCRAx.TSTS:Timestamp trigger
223  */
224 typedef enum
225 {
226  IfxPsi5s_TimestampTrigger_syncPulse = 0, /**< \brief Timestamp trigger on sync pulse */
227  IfxPsi5s_TimestampTrigger_frame = 1 /**< \brief Timestamp trigger on any frame */
229 
230 /** \brief MODULE_PSI5S.TSCNTA.B.ETB;MODULE_PSI5S.TSCNTB.B.ETB:Trigger Id
231  */
232 typedef enum
233 {
234  IfxPsi5s_Trigger_0 = 0, /**< \brief Trigger 0 */
235  IfxPsi5s_Trigger_1, /**< \brief Trigger 1 */
236  IfxPsi5s_Trigger_2, /**< \brief Trigger 2 */
237  IfxPsi5s_Trigger_3, /**< \brief Trigger 3 */
238  IfxPsi5s_Trigger_4, /**< \brief Trigger 4 */
239  IfxPsi5s_Trigger_5, /**< \brief Trigger 5 */
240  IfxPsi5s_Trigger_6, /**< \brief Trigger 6 */
241  IfxPsi5s_Trigger_7 /**< \brief Trigger 7 */
243 
244 /** \brief Trigger type defined in
245  */
246 typedef enum
247 {
248  IfxPsi5s_TriggerType_periodic = 0, /**< \brief Periodic trigger */
249  IfxPsi5s_TriggerType_external = 1 /**< \brief External trigger */
251 
252 /** \brief MODULE_PSI5S.RCRAx.UFCY(x=0,1,...7;y=0,1...5):UART frame count
253  */
254 typedef enum
255 {
256  IfxPsi5s_UartFrameCount_3 = 0, /**< \brief 3 UART frames */
257  IfxPsi5s_UartFrameCount_4, /**< \brief 4 UART frames */
258  IfxPsi5s_UartFrameCount_5, /**< \brief 5 UART frames */
259  IfxPsi5s_UartFrameCount_6 /**< \brief 6 UART frames */
261 
262 /** \brief MODULE_PSI5S.RCRAx.WDMS:Watchdog timer mode
263  */
264 typedef enum
265 {
266  IfxPsi5s_WatchdogTimerMode_frame = 0, /**< \brief Watch Dog Timer is restarted on reception of each recoverable frame (async mode) */
267  IfxPsi5s_WatchdogTimerMode_syncPulse = 1 /**< \brief Watch Dog Timer is restarted on Sync Pulse and stopped at reception of the last frame configured in NFC.NFx.(sync mode) */
269 
270 /** \} */
271 
272 /** \addtogroup IfxLld_Psi5s_Std_Channel
273  * \{ */
274 
275 /******************************************************************************/
276 /*-------------------------Global Function Prototypes-------------------------*/
277 /******************************************************************************/
278 
279 /** \brief Enable ASC receiver
280  * \param psi5s pointer to the PSI5S register space
281  * \return None
282  */
283 IFX_EXTERN void IfxPsi5s_enableAscReceiver(Ifx_PSI5S *psi5s);
284 
285 /** \brief Enable/disable any combination of channel trigger counters selected by mask parameter
286  * \param psi5s pointer to the PSI5S register space
287  * \param channels specifies the channel trigger counters which should be enabled/disabled
288  * \param mask specifies the channel trigger counters which should be modified
289  * \return None
290  */
291 IFX_EXTERN void IfxPsi5s_enableDisableChannelTriggerCounters(Ifx_PSI5S *psi5s, uint32 channels, uint32 mask);
292 
293 /** \brief Enable/disable any combination of channels selected by mask parameter
294  * \param psi5s pointer to the PSI5S register space
295  * \param channels specifies the channels which should be enabled/disabled
296  * \param mask specifies the channels which should be modified
297  * \return None
298  */
299 IFX_EXTERN void IfxPsi5s_enableDisableChannels(Ifx_PSI5S *psi5s, uint32 channels, uint32 mask);
300 
301 /** \brief Start ASC transactions
302  * \param psi5s pointer to the PSI5S register space
303  * \return None
304  */
305 IFX_EXTERN void IfxPsi5s_startAscTransactions(Ifx_PSI5S *psi5s);
306 
307 /** \} */
308 
309 /** \addtogroup IfxLld_Psi5s_Std_IO
310  * \{ */
311 
312 /******************************************************************************/
313 /*-------------------------Inline Function Prototypes-------------------------*/
314 /******************************************************************************/
315 
316 /** \brief Initializes a CLK output
317  * \param clk the CLK Pin which should be configured
318  * \param outputMode the pin output mode which should be configured
319  * \param padDriver the pad driver mode which should be configured
320  * \return None
321  */
323 
324 /** \brief Initializes a RX input
325  * \param rx the RX Pin which should be configured
326  * \param inputMode the pin input mode which should be configured
327  * \return None
328  */
330 
331 /** \brief Initializes a TX output
332  * \param tx the TX Pin which should be configured
333  * \param outputMode the pin output mode which should be configured
334  * \param padDriver the pad driver mode which should be configured
335  * \return None
336  */
338 
339 /** \brief Selects the alternate input for Rx signal
340  * \param psi5s pointer to PSI5S registers
341  * \param alti alternate input selection of Rx signal
342  * \return None
343  */
344 IFX_INLINE void IfxPsi5s_setRxInput(Ifx_PSI5S *psi5s, IfxPsi5s_AlternateInput alti);
345 
346 /** \} */
347 
348 /** \addtogroup IfxLld_Psi5s_Std_Module
349  * \{ */
350 
351 /******************************************************************************/
352 /*-------------------------Inline Function Prototypes-------------------------*/
353 /******************************************************************************/
354 
355 /** \brief enable / disable sleep mode
356  * \param psi5s Pointer to PSI5S register
357  * \param mode sleep mode (enable/disable)
358  * \return None
359  */
360 IFX_INLINE void IfxPsi5s_setSleepMode(Ifx_PSI5S *psi5s, IfxPsi5s_SleepMode mode);
361 
362 /******************************************************************************/
363 /*-------------------------Global Function Prototypes-------------------------*/
364 /******************************************************************************/
365 
366 /** \brief resets PSI5S kernel
367  * \param psi5s pointer to PSI5S registers
368  * \return None
369  */
370 IFX_EXTERN void IfxPsi5s_resetModule(Ifx_PSI5S *psi5s);
371 
372 /** \} */
373 
374 /******************************************************************************/
375 /*-------------------------Global Function Prototypes-------------------------*/
376 /******************************************************************************/
377 
378 /** \brief Get the received psi5s frame for the channel
379  * \param psi5s Pointer to PSI5S Module
380  * \param channelId channel ID
381  * \return Frame Status
382  */
383 IFX_EXTERN boolean IfxPsi5s_getReadFrameStatus(Ifx_PSI5S *psi5s, IfxPsi5s_ChannelId channelId);
384 
385 /******************************************************************************/
386 /*---------------------Inline Function Implementations------------------------*/
387 /******************************************************************************/
388 
390 {
391  IfxPort_setPinModeOutput(clk->pin.port, clk->pin.pinIndex, outputMode, clk->select);
392  IfxPort_setPinPadDriver(clk->pin.port, clk->pin.pinIndex, padDriver);
393 }
394 
395 
397 {
398  IfxPort_setPinModeInput(rx->pin.port, rx->pin.pinIndex, inputMode);
400 }
401 
402 
404 {
405  IfxPort_setPinModeOutput(tx->pin.port, tx->pin.pinIndex, outputMode, tx->select);
406  IfxPort_setPinPadDriver(tx->pin.port, tx->pin.pinIndex, padDriver);
407 }
408 
409 
411 {
412  psi5s->IOCR.B.ALTI = alti;
413 }
414 
415 
417 {
420  psi5s->CLC.B.EDIS = mode;
421  IfxScuWdt_setCpuEndinit(passwd);
422 }
423 
424 
425 #endif /* IFXPSI5S_H */