SDL API Guide for J721E
sdl_ecc.h
Go to the documentation of this file.
1 /*
2  * SDL ECC
3  *
4  * Software Diagnostics Library module for ECC
5  *
6  * Copyright (c) Texas Instruments Incorporated 2018-2021
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the
18  * distribution.
19  *
20  * Neither the name of Texas Instruments Incorporated nor the names of
21  * its contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
47 #ifndef INCLUDE_SDL_ECC_H_
48 #define INCLUDE_SDL_ECC_H_
49 
50 #include <stdint.h>
51 #include <stdbool.h>
52 
53 #include "sdl_common.h"
54 #include <src/ip/sdl_ip_ecc.h>
55 #include <src/ip/sdl_esm.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
96 typedef enum {
102 
103 
109 typedef enum {
129 
130 
135 typedef enum {
141 
142 /* @} */
143 
154 typedef uint32_t SDL_ECC_MemType;
155 
156 
158 #define SDL_ECC_MEMTYPE_MCU_R5F0_CORE (0u)
159 
160 #define SDL_ECC_MEMTYPE_MCU_R5F1_CORE (1u)
161 
162 #define SDL_ECC_MEMTYPE_MCU_ADC0 (2u)
163 
164 #define SDL_ECC_MEMTYPE_MCU_ADC1 (3u)
165 
166 #define SDL_ECC_MEMTYPE_MCU_CPSW0 (4u)
167 
168 #define SDL_ECC_MEMTYPE_MCU_FSS0_HPB0 (5u)
169 
170 #define SDL_ECC_MEMTYPE_MCU_FSS0_OSPI0 (6u)
171 
172 #define SDL_ECC_MEMTYPE_MCU_FSS0_OSPI1 (7u)
173 
174 #define SDL_ECC_MEMTYPE_MCU_MCAN0 (8u)
175 
176 #define SDL_ECC_MEMTYPE_MCU_MCAN1 (9u)
177 
178 #define SDL_ECC_MEMTYPE_MCU_MSRAM0 (10u)
179 
180 #define SDL_ECC_MEMTYPE_MCU_NAVSS0 (11u)
181 
182 #define SDL_ECC_MEMTYPE_MCU_PDMA0 (12u)
183 
184 #define SDL_ECC_MEMTYPE_MCU_PDMA1 (13u)
185 
186 #define SDL_ECC_MEMTYPE_MCU_PSRAM0 (14u)
187 
188 #define SDL_ECC_MEMTYPE_MCU_CBASS_ECC_AGGR0 (15u)
189 
190 
191 /* These aggregators require using RAT to map into memory space */
192 
194 #define SDL_ECC_MEMTYPE_MAIN_MSMC_AGGR0 (16u)
195 
196 #define SDL_ECC_MEMTYPE_MAIN_MSMC_AGGR1 (17u)
197 
198 #define SDL_ECC_MEMTYPE_MAIN_MSMC_AGGR2 (18u)
199 
201 #define SDL_ECC_MEMTYPE_MAIN_A72_AGGR0 (19u)
202 
203 #define SDL_ECC_MEMTYPE_MAX (SDL_ECC_MEMTYPE_MAIN_A72_AGGR0 + 1U)
204 
210 typedef uint32_t SDL_ECC_MemSubType;
211 
212 /* The following are the memory sub type for Memory type
213  SDL_ECC_MEMTYPE_MCU_R5F0_CORE & SDL_ECC_MEMTYPE_MCU_R5F1_CORE */
214 
216 #define SDL_ECC_R5F_MEM_SUBTYPE_ITAG_RAM0_VECTOR_ID (0U)
217 
218 #define SDL_ECC_R5F_MEM_SUBTYPE_ITAG_RAM1_VECTOR_ID (1U)
219 
220 #define SDL_ECC_R5F_MEM_SUBTYPE_ITAG_RAM2_VECTOR_ID (2U)
221 
222 #define SDL_ECC_R5F_MEM_SUBTYPE_ITAG_RAM3_VECTOR_ID (3U)
223 
224 #define SDL_ECC_R5F_MEM_SUBTYPE_IDATA_BANK0_VECTOR_ID (4U)
225 
226 #define SDL_ECC_R5F_MEM_SUBTYPE_IDATA_BANK1_VECTOR_ID (5U)
227 
228 #define SDL_ECC_R5F_MEM_SUBTYPE_IDATA_BANK2_VECTOR_ID (6U)
229 
230 #define SDL_ECC_R5F_MEM_SUBTYPE_IDATA_BANK3_VECTOR_ID (7U)
231 
232 #define SDL_ECC_R5F_MEM_SUBTYPE_DTAG_RAM0_VECTOR_ID (8U)
233 
234 #define SDL_ECC_R5F_MEM_SUBTYPE_DTAG_RAM1_VECTOR_ID (9U)
235 
236 #define SDL_ECC_R5F_MEM_SUBTYPE_DTAG_RAM2_VECTOR_ID (10U)
237 
238 #define SDL_ECC_R5F_MEM_SUBTYPE_DTAG_RAM3_VECTOR_ID (11U)
239 
240 #define SDL_ECC_R5F_MEM_SUBTYPE_DDIRTY_RAM_VECTOR_ID (12U)
241 
242 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM0_VECTOR_ID (13U)
243 
244 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM1_VECTOR_ID (14U)
245 
246 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM2_VECTOR_ID (15U)
247 
248 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM3_VECTOR_ID (16U)
249 
250 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM4_VECTOR_ID (17U)
251 
252 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM5_VECTOR_ID (18U)
253 
254 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM6_VECTOR_ID (19U)
255 
256 #define SDL_ECC_R5F_MEM_SUBTYPE_DDATA_RAM7_VECTOR_ID (20U)
257 
258 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK0_VECTOR_ID (21U)
259 
260 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK1_VECTOR_ID (22U)
261 
262 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK0_VECTOR_ID (23U)
263 
264 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK1_VECTOR_ID (24U)
265 
266 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK0_VECTOR_ID (25U)
267 
268 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK1_VECTOR_ID (26U)
269 
270 #define SDL_ECC_R5F_MEM_SUBTYPE_KS_VIM_RAM_VECTOR_ID (27U)
271 
272 #define SDL_ECC_R5F_MEM_SUBTYPE_VBUSM2AXI_EDC_VECTOR_ID (28U)
273 
274 #define SDL_ECC_R5F_MEM_SUBTYPE_AXI2VBUSM_MEM_MST_WRITE_EDC_VECTOR_ID (29U)
275 
276 #define SDL_ECC_R5F_MEM_SUBTYPE_AXI2VBUSM_MEM_MST_READ_EDC_VECTOR_ID (30U)
277 
278 #define SDL_ECC_R5F_MEM_SUBTYPE_AXI2VBUSM_PERIPH_MST_WRITE_EDC_VECTOR_ID (31U)
279 
280 #define SDL_ECC_R5F_MEM_SUBTYPE_AXI2VBUSM_PERIPH_MST_READ_EDC_VECTOR_ID (32U)
281 
282 #define SDL_ECC_R5F_MEM_SUBTYPE_AHB2VBUSP_EDC_VECTOR_ID (33U)
283 
284 #define SDL_ECC_R5F_MEM_SUBTYPE_SCRP_EDC_VECTOR_ID (34U)
285 
286 #define SDL_ECC_R5F_MEM_SUBTYPE_ECC_AGGR_EDC_ID (35U)
287 
289 #define SDL_ECC_MAIN_MSMC_MEM_INTERCONN_SUBTYPE (20) /* SDL_COMPUTE_CLUSTER0_MSMC_ECC_AGGR0_MSMC_MMR_BUSECC_RAM_ID */
290 
291 #define SDL_ECC_MAIN_MSMC_CACHE_TAG_MEM_INTERCONN_SUBTYPE (85) /*SDL_COMPUTE_CLUSTER0_MSMC_ECC_AGGR0_RMW2_CACHE_TAG_PIPE_BUSECC_RAM_ID */
292 
293 #define SDL_ECC_MAIN_MSMC_MEM_WRAPPER_SUBTYPE (100) /* SDL_COMPUTE_CLUSTER0_MSMC_ECC_AGGR0_CLEC_SRAM_RAMECC_RAM_ID */
294 
295 #define SDL_ECC_MAIN_MSMC_MEM_CLEC_EDC_CTRL_BUSECC_SUBTYPE (107)/* SDL_COMPUTE_CLUSTER0_MSMC_ECC_AGGR0_CLEC_J7ES_CLEC_EDC_CTRL_BUSECC_RAM_ID */
296 
297 /* The following are the memory sub type for Memory type
298  SDL_ECC_MEMTYPE_MCU_CBASS */
299 
301 #define SDL_ECC_MCU_CBASS_MEM_SUBTYPE_WR_RAMECC_ID (0U)
302 
303 #define SDL_ECC_MCU_CBASS_MEM_SUBTYPE_RD_RAMECC_ID (1U)
304 
305 #define SDL_ECC_MCU_CBASS_MEM_SUBTYPE_EDC_CTRL_ID (2U)
306 
308 typedef void (*SDL_ECC_ErrorCallback_t) (uint32_t errorSrc, uint32_t address);
309 
311 typedef void (*SDL_ECC_VIMDEDVector_t) (void);
312 
313 /* @} */
314 
324 typedef struct SDL_ECC_InitConfig_s
325 {
326  uint32_t numRams;
332 
337 typedef struct SDL_ECC_InjectErrorConfig_s
338 {
339  uint32_t *pErrMem;
341  uint32_t flipBitMask;
343  uint32_t chkGrp;
346 
351 typedef struct SDL_ECC_ErrorInfo_s
352 {
359  uint32_t bitErrCnt;
361  uint32_t injectBitErrCnt;
363  uint64_t bitErrorOffset;
365  uint32_t bitErrorGroup;
368 
369 /* @} */
370 
384 int32_t SDL_ECC_initEsm (const SDL_ESM_Inst esmInstType);
385 
395 int32_t SDL_ECC_init (SDL_ECC_MemType eccMemType,
396  const SDL_ECC_InitConfig_t *pECCInitConfig);
397 
408 int32_t SDL_ECC_initMemory (SDL_ECC_MemType eccMemType,
409  SDL_ECC_MemSubType memSubType);
410 
424 int32_t SDL_ECC_selfTest(SDL_ECC_MemType eccMemType,
425  SDL_ECC_MemSubType memSubType,
426  SDL_ECC_InjectErrorType errorType,
427  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig,
428  uint32_t selfTestTimeOut);
429 
442 int32_t SDL_ECC_injectError(SDL_ECC_MemType eccMemType,
443  SDL_ECC_MemSubType memSubType,
444  SDL_ECC_InjectErrorType errorType,
445  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig);
446 
457  SDL_ECC_staticRegs *pStaticRegs);
458 
470 int32_t SDL_ECC_getErrorInfo(SDL_ECC_MemType eccMemType,
471  SDL_Ecc_AggrIntrSrc intrSrc,
472  SDL_ECC_ErrorInfo_t *pErrorInfo);
473 
483 int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType,
484  SDL_Ecc_AggrIntrSrc intrSrc);
485 
499 int32_t SDL_ECC_getESMErrorInfo(SDL_ESM_Inst instance, uint32_t intSrc,
500  SDL_ECC_MemType *eccMemType, SDL_Ecc_AggrIntrSrc *intrSrcType);
501 
515 int32_t SDL_ECC_clearNIntrPending(SDL_ECC_MemType eccMemType, SDL_ECC_MemSubType memSubType,
516  SDL_Ecc_AggrIntrSrc intrSrc,
517  SDL_Ecc_AggrEDCErrorSubType subType, uint32_t numEvents);
518 
531 
551  uint32_t errorSrc,
552  uint32_t address,
553  uint32_t ramId,
554  uint64_t bitErrorOffset,
555  uint32_t bitErrorGroup);
556 
557 /* @} */
558 
559 #ifdef __cplusplus
560 }
561 #endif /* extern "C" */
562 
563 #endif /* INCLUDE_SDL_ECC_H_ */
SDL_ECC_AggregatorType
This enumerator defines the different ECC aggregator types
Definition: sdl_ecc.h:96
int32_t SDL_ECC_init(SDL_ECC_MemType eccMemType, const SDL_ECC_InitConfig_t *pECCInitConfig)
Initializes ECC module for ECC detection.
SDL_ESM_Inst
Defines the different ESM instance types
Definition: ip/sdl_esm.h:165
int32_t SDL_ECC_initMemory(SDL_ECC_MemType eccMemType, SDL_ECC_MemSubType memSubType)
Initializes Memory to be ready for ECC error detection. Assumes ECC is already enabled.
uint32_t SDL_Ecc_AggrEDCErrorSubType
This enumerator defines the types of possible EDC errors.
Definition: sdl_ip_ecc.h:187
int32_t SDL_ECC_getESMErrorInfo(SDL_ESM_Inst instance, uint32_t intSrc, SDL_ECC_MemType *eccMemType, SDL_Ecc_AggrIntrSrc *intrSrcType)
Retrieves the ECC error information for the specified ESM error. If it isn't an ECC error or the ECC ...
uint32_t bitErrorGroup
Definition: sdl_ecc.h:365
SDL_ECC_MemSubType memSubType
Definition: sdl_ecc.h:355
void SDL_ECC_applicationCallbackFunction(SDL_ECC_MemType eccMemType, uint32_t errorSrc, uint32_t address, uint32_t ramId, uint64_t bitErrorOffset, uint32_t bitErrorGroup)
Application provided external callback function for ECC handling Called inside the reference function...
uint32_t chkGrp
Definition: sdl_ecc.h:343
This structure defines the inject error configuration
Definition: sdl_ecc.h:337
int32_t SDL_ECC_initEsm(const SDL_ESM_Inst esmInstType)
Initializes an module for usage with ECC module.
SDL_Ecc_AggrIntrSrc intrSrc
Definition: sdl_ecc.h:357
int32_t SDL_ECC_injectError(SDL_ECC_MemType eccMemType, SDL_ECC_MemSubType memSubType, SDL_ECC_InjectErrorType errorType, const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig)
Injects ECC error at specified location Assumes ECC is already enabled.
Definition: sdl_ecc.h:99
This structure contains the static register group for Ecc aggregator used by the SDL_ecc_aggrReadStat...
Definition: sdl_ip_ecc.h:348
uint32_t numRams
Definition: sdl_ecc.h:326
This structure defines the error status information
Definition: sdl_ecc.h:351
SDL_ECC_RamIdType
This enumerator defines the different ECC RAM ID types
Definition: sdl_ecc.h:135
uint32_t SDL_ECC_MemType
This enumerator indicate ECC memory type.
Definition: sdl_ecc.h:154
int32_t SDL_ECC_getErrorInfo(SDL_ECC_MemType eccMemType, SDL_Ecc_AggrIntrSrc intrSrc, SDL_ECC_ErrorInfo_t *pErrorInfo)
Retrieves the ECC error information for the specified memtype and interrupt source.
SDL_ECC_MemSubType * pMemSubTypeList
Definition: sdl_ecc.h:329
uint64_t bitErrorOffset
Definition: sdl_ecc.h:363
void SDL_ECC_registerVIMDEDHandler(SDL_ECC_VIMDEDVector_t VIMDEDHandler)
Register Handler for VIM DED ECC error.
This structure defines the elements of ECC Init configuration
Definition: sdl_ecc.h:324
int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType, SDL_Ecc_AggrIntrSrc intrSrc)
Acknowledge the ECC interrupt.
Definition: sdl_ecc.h:136
uint32_t flipBitMask
Definition: sdl_ecc.h:341
int32_t SDL_ECC_selfTest(SDL_ECC_MemType eccMemType, SDL_ECC_MemSubType memSubType, SDL_ECC_InjectErrorType errorType, const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig, uint32_t selfTestTimeOut)
Runs self test by injecting and error and monitor response Assumes ECC is already enabled.
void(* SDL_ECC_VIMDEDVector_t)(void)
Definition: sdl_ecc.h:311
Header file contains enumerations, structure definitions and function declarations for SDL Error Sign...
uint32_t * pErrMem
Definition: sdl_ecc.h:339
uint32_t SDL_ECC_MemSubType
This enumerator indicate ECC memory Sub Type.
Definition: sdl_ecc.h:210
SDL_ECC_MemType eccMemType
Definition: sdl_ecc.h:353
int32_t SDL_ECC_clearNIntrPending(SDL_ECC_MemType eccMemType, SDL_ECC_MemSubType memSubType, SDL_Ecc_AggrIntrSrc intrSrc, SDL_Ecc_AggrEDCErrorSubType subType, uint32_t numEvents)
Clears N pending interrupts for the specified memtype, subtype and interrupt source.
Definition: sdl_ecc.h:97
Definition: sdl_ecc.h:111
uint32_t SDL_Ecc_AggrIntrSrc
This enumerator defines the types of possible ECC errors.
Definition: sdl_ip_ecc.h:106
int32_t SDL_ECC_getStaticRegisters(SDL_ECC_MemType eccMemType, SDL_ECC_staticRegs *pStaticRegs)
Gets the static registers for the specified ECC instance.
uint32_t bitErrCnt
Definition: sdl_ecc.h:359
Definition: sdl_ecc.h:138
void(* SDL_ECC_ErrorCallback_t)(uint32_t errorSrc, uint32_t address)
Definition: sdl_ecc.h:308
SDL_ECC_InjectErrorType
ECC Inject error types.
Definition: sdl_ecc.h:109
uint32_t injectBitErrCnt
Definition: sdl_ecc.h:361