iLLD_TC27xC  1.0
IfxMtu.h
Go to the documentation of this file.
1 /**
2  * \file IfxMtu.h
3  * \brief MTU basic functionality
4  * \ingroup IfxLld_Mtu
5  *
6  * \version iLLD_0_1_0_10
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  *
25  *
26  *
27  * \defgroup IfxLld_Mtu MTU
28  * \ingroup IfxLld
29  * \defgroup IfxLld_Mtu_Std Standard Driver
30  * \ingroup IfxLld_Mtu
31  * \defgroup IfxLld_Mtu_Std_Utility Utility Functions
32  * \ingroup IfxLld_Mtu_Std
33  * \defgroup IfxLld_Mtu_Std_Operative MBIST Operations
34  * \ingroup IfxLld_Mtu_Std
35  * \defgroup IfxLld_Mtu_Std_ErrorTracking MBIST Error Tracking
36  * \ingroup IfxLld_Mtu_Std
37  */
38 
39 #ifndef IFXMTU_H
40 #define IFXMTU_H 1
41 
42 /******************************************************************************/
43 /*----------------------------------Includes----------------------------------*/
44 /******************************************************************************/
45 
46 #include "_Impl/IfxMtu_cfg.h"
47 /** \addtogroup IfxLld_Mtu_Std_Utility
48  * \{ */
49 
50 /******************************************************************************/
51 /*-------------------------Inline Function Prototypes-------------------------*/
52 /******************************************************************************/
53 
54 /** \brief Enables the MTU module
55  * \return None
56  */
58 
59 /** \brief Returns the status of whether the module is enabled or not
60  * \return
61  */
63 
64 /******************************************************************************/
65 /*-------------------------Global Function Prototypes-------------------------*/
66 /******************************************************************************/
67 
68 /** \brief Enables the MBIST Shell of the given SRAM
69  * \param mbistSel Memory Selection
70  * \return None
71  */
73 
74 /** \brief Enables the MBIST Shell of the given SRAM
75  * \param mbistSel Memory Selection
76  * \return None
77  */
79 
80 /** \brief Returns TRUE if Auto-Initialisation is running for the given SRAM.
81  *
82  * Should be polled after MBIST enableMbistShell to ensure that an auto-init operation is finished before starting a new operation.
83  * \param mbistSel Memory Selection
84  * \return TRUE if auto-initialisation running.
85  */
87 
88 /** \} */
89 
90 /** \addtogroup IfxLld_Mtu_Std_Operative
91  * \{ */
92 
93 /******************************************************************************/
94 /*-------------------------Global Function Prototypes-------------------------*/
95 /******************************************************************************/
96 
97 /**
98  * \param mbistSel Memory Selection
99  * \return None
100  *
101  * Usage Example for clearing all ERAY and GTM SRAMs:
102  * \code
103  * // Enable MTU clock
104  * {
105  * uint16 password = IfxScuWdt_getCpuWatchdogPassword();
106  * IfxScuWdt_clearCpuEndinit(password);
107  * IfxMtu_enableModule();
108  * IfxScuWdt_setCpuEndinit(password);
109  * }
110  *
111  * // Note: clearSram functions will trap with bus error if wrong ECC is initialized
112  * {
113  * uint16 password = IfxScuWdt_getSafetyWatchdogPassword();
114  * IfxScuWdt_clearSafetyEndinit(password);
115  *
116  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmFifo);
117  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmMcs0);
118  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmMcs1);
119  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmDpll1a);
120  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmDpll1b);
121  * IfxMtu_clearSram(IfxMtu_MbistSel_gtmDpll2);
122  *
123  * IfxMtu_clearSram(IfxMtu_MbistSel_erayObf);
124  * IfxMtu_clearSram(IfxMtu_MbistSel_erayIbfTbf);
125  * IfxMtu_clearSram(IfxMtu_MbistSel_erayMbf);
126  *
127  * IfxScuWdt_setSafetyEndinit(password);
128  * }
129  * \endcode
130  *
131  */
133 
134 /**
135  * \param mbistSel Memory Selection
136  * \param sramAddress SRAM address which should be read
137  * \return None
138  */
139 IFX_EXTERN void IfxMtu_readSramAddress(IfxMtu_MbistSel mbistSel, uint16 sramAddress);
140 
141 /**
142  * \param mbistSel Memory Selection
143  * \param sramAddress SRAM address which should be written
144  * \return None
145  */
146 IFX_EXTERN void IfxMtu_writeSramAddress(IfxMtu_MbistSel mbistSel, uint16 sramAddress);
147 
148 /** \} */
149 
150 /** \addtogroup IfxLld_Mtu_Std_ErrorTracking
151  * \{ */
152 
153 /******************************************************************************/
154 /*-------------------------Global Function Prototypes-------------------------*/
155 /******************************************************************************/
156 
157 /** \brief Clears the error tracking registers (ETRR), valid and overflow bits.
158  * \param mbistSel Memory Selection
159  * \return None
160  */
162 
163 /** \brief Enables the tracking of SRAM errors.
164  * \param mbistSel Memory Selection
165  * \param enable TRUE to enable error tracking, FALSE to disable error tracking.
166  * \return None
167  */
169 
170 /** \brief Returns the descrambled system address based on a tracked SRAM error which consists of ADDR and MBI (SRAM address and block)
171  *
172  * Please note that not all memories of the system are supported by this function.
173  * Additional memories will be considered on request.
174  * \param mbistSel Memory Selection
175  * \param trackedSramAddress tracked SRAM address which consists of an ADDR and MBI field (SRAM address and block)
176  * \return descrambled system address if supported by this function, otherwise 0
177  *
178  * Example usage: see \ref IfxMtu_getTrackedSramAddresses
179  *
180  */
181 IFX_EXTERN uint32 IfxMtu_getSystemAddress(IfxMtu_MbistSel mbistSel, Ifx_MC_ETRR trackedSramAddress);
182 
183 /** \brief Returns the tracked SRAM error addresses and memory blocks which are stored in the MBIST ETRR registers.
184  * \param mbistSel Memory Selection
185  * \param trackedSramAddresses will contain the tracked error addresses in trackedSramAdresses[x].B.ADDR and affected blocks in sramAddresses[x].B.MBI
186  *
187  * The array size shall be IFXMTU_MAX_TRACKED_ADDRESSES
188  * \return number of tracked errors (0..IFXMTU_MAX_TRACKED_ADDRESSES)
189  *
190  * Example usage to print out tracked errors of a given memory:
191  *
192  * We assume that the MTU clock has already been enabled, and that the MBIST instance has been selected; e.g. for LMU:
193  * \code
194  * uint16 password = IfxScuWdt_getCpuWatchdogPassword();
195  * IfxScuWdt_clearCpuEndinit(password);
196  *
197  * IfxMtu_enableModule();
198  *
199  * IfxMtu_MbistSel mbistSel = IfxMtu_MbistSel_lmu;
200  *
201  * IfxMtu_enableMbistShell(mbistSel);
202  *
203  * // for auto-init memories: wait for the end of the clear operation
204  * while (IfxMtu_isAutoInitRunning(mbistSel))
205  * {}
206  * \endcode
207  *
208  * Now the tracking information can be retrieved with:
209  *
210  * \code
211  * {
212  * Ifx_MC_ETRR trackedSramAddresses[IFXMTU_MAX_TRACKED_ADDRESSES];
213  * uint8 numTrackedAddresses = IfxMtu_getTrackedSramAddresses(mbistSel, trackedSramAddresses);
214  *
215  * clib_ver_printf("Tracked addresses: %d (Overflow: %d)\n",
216  * numTrackedAddresses,
217  * IfxMtu_isErrorTrackingOverflow(mbistSel) ? 1 : 0);
218  *
219  * for(int i=0; i<numTrackedAddresses; ++i) {
220  * clib_ver_printf("%d: A:0x%04x MBI:%d -> SystemAddress: 0x%08x\n",
221  * i,
222  * trackedSramAddresses[i].B.ADDR,
223  * trackedSramAddresses[i].B.MBI,
224  * IfxMtu_getSystemAddress(mbistSel, trackedSramAddresses[i]));
225  * }
226  * }
227  * \endcode
228  *
229  */
230 IFX_EXTERN uint8 IfxMtu_getTrackedSramAddresses(IfxMtu_MbistSel mbistSel, Ifx_MC_ETRR *trackedSramAddresses);
231 
232 /** \brief Returns the status of the error tracking
233  * \param mbistSel Memory Selection
234  * \return TRUE if error tracking enabled.
235  */
237 
238 /** \brief Returns the error tracking overflow status.
239  * \param mbistSel Memory Selection
240  * \return TRUE if more errors were detected since last clear than error tracking registers are available, or if more than one memory block was in error at the same time.
241  */
243 
244 /** \} */
245 
246 /******************************************************************************/
247 /*---------------------Inline Function Implementations------------------------*/
248 /******************************************************************************/
249 
251 {
252  // MTU clock enable
253  MTU_CLC.U = 0x0;
254 }
255 
256 
258 {
259  return MTU_CLC.B.DISS == 0;
260 }
261 
262 
263 #endif /* IFXMTU_H */