AM273x MCU+ SDK  08.06.00
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 2022-2023
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 <sdl/ecc/sdl_ip_ecc.h>
55 #if defined(SOC_AM263X)
56 #include <sdl/esm/v0/sdl_esm.h>
57 #endif
58 #if defined(SOC_AM273X) || defined(SOC_AWR294X)
59 #include <sdl/esm/v1/sdl_esm.h>
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
70 typedef enum {
76 
77 
83 typedef enum {
103 
104 
109 typedef enum {
115 
121 typedef uint32_t SDL_ECC_MemType;
122 
123 #if defined(SOC_AM263X)
124 
125 #define SDL_SOC_ECC_AGGR (0U)
126 #define SDL_R5FSS0_CORE0_ECC_AGGR (1U)
127 #define SDL_R5FSS0_CORE1_ECC_AGGR (2U)
128 #define SDL_R5FSS1_CORE0_ECC_AGGR (3U)
129 #define SDL_R5FSS1_CORE1_ECC_AGGR (4U)
130 #define SDL_HSM_ECC_AGGR (5U)
131 #define SDL_ICSSM_ICSS_G_CORE_BORG_ECC_AGGR (6U)
132 #define SDL_MCAN0_MCANSS_MSGMEM_WRAP_ECC_AGGR (7U)
133 #define SDL_MCAN1_MCANSS_MSGMEM_WRAP_ECC_AGGR (8U)
134 #define SDL_MCAN2_MCANSS_MSGMEM_WRAP_ECC_AGGR (9U)
135 #define SDL_MCAN3_MCANSS_MSGMEM_WRAP_ECC_AGGR (10U)
136 #define SDL_CPSW3GCSS_ECC_AGGR (11U)
137 #define SDL_ECC_MEMTYPE_MAX (SDL_CPSW3GCSS_ECC_AGGR + 1U)
138 
139 /* Parity */
140 #define SDL_R5SS0_CPU0_TCM (0U)
141 #define SDL_R5SS1_CPU0_TCM (1U)
142 /* SDL_R5SS0_CPU0_TCM */
143 #define SDL_R5FSS0_CORE0_ATCM0 (1U)
144 #define SDL_R5FSS0_CORE0_B0TCM0 (3U)
145 #define SDL_R5FSS0_CORE0_B1TCM0 (5U)
146 /* SDL_R5SS0_CPU10_TCM */
147 #define SDL_R5FSS0_CORE1_ATCM1 (2U)
148 #define SDL_R5FSS0_CORE1_B0TCM1 (4U)
149 #define SDL_R5FSS0_CORE1_B1TCM1 (6U)
150 /* SDL_R5SS1_CPU0_TCM */
151 #define SDL_R5FSS1_CORE0_ATCM0 (7U)
152 #define SDL_R5FSS1_CORE0_B0TCM0 (9U)
153 #define SDL_R5FSS1_CORE0_B1TCM0 (11U)
154 /* SDL_R5SS1_CPU1_TCM */
155 #define SDL_R5FSS1_CORE1_ATCM1 (8U)
156 #define SDL_R5FSS1_CORE1_B0TCM1 (10U)
157 #define SDL_R5FSS1_CORE1_B1TCM1 (12U)
158 /* TPCC */
159 #define SDL_TPCC0 (2)
160 #endif
161 
162 #if defined(SOC_AM273X) || defined(SOC_AWR294X)
163 #define SDL_R5FSS0_CORE0_ECC_AGGR (0U)
164 #define SDL_R5FSS0_CORE1_ECC_AGGR (1U)
165 #define SDL_MSS_ECC_AGG_MSS (2U)
166 #define SDL_DSS_ECC_AGG (3U)
167 #define SDL_MSS_MCANA_ECC (4U)
168 #define SDL_MSS_MCANB_ECC (5U)
169 #define SDL_CPSW3GCSS_ECC_AGGR (6U)
170 #define SDL_ECC_MEMTYPE_MAX (SDL_CPSW3GCSS_ECC_AGGR + 1U)
171 /* TCM PARITY */
172 #define SDL_TCM_PARITY_ATCM0 (1U)
173 #define SDL_TCM_PARITY_ATCM1 (2U)
174 #define SDL_TCM_PARITY_B0TCM0 (3U)
175 #define SDL_TCM_PARITY_B0TCM1 (4U)
176 #define SDL_TCM_PARITY_B1TCM0 (5U)
177 #define SDL_TCM_PARITY_B1TCM1 (6U)
178 
179 /* TPCC */
180 #define SDL_TPCC0A (2U)
181 #define SDL_TPCC0B (3U)
182 #define SDL_DSS_TPCCA (4U)
183 #define SDL_DSS_TPCCB (5U)
184 #define SDL_DSS_TPCCC (6U)
185 #endif
186 /* The following are the memory sub type for Memory type
187  SDL_ECC_MEMTYPE_MCU_R5F0_CORE & SDL_ECC_MEMTYPE_MCU_R5F1_CORE */
188 /* Keeping for backward-compatibility. Recommend to use RAM_ID directly from sdlr_soc_ecc_aggr.h file */
189 
191 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK0_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_ATCM0_BANK0_RAM_ID)
192 
193 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK1_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_ATCM0_BANK1_RAM_ID)
194 
195 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK0_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_B0TCM0_BANK0_RAM_ID)
196 
197 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK1_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_B0TCM0_BANK1_RAM_ID)
198 
199 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK0_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_B1TCM0_BANK0_RAM_ID)
200 
201 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK1_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_PULSAR_SL_B1TCM0_BANK1_RAM_ID)
202 
203 #define SDL_ECC_R5F_MEM_SUBTYPE_KS_VIM_RAM_VECTOR_ID (SDL_R5FSS0_CORE0_ECC_AGGR_CPU0_KS_VIM_RAMECC_RAM_ID)
204 
205 
211 typedef uint32_t SDL_ECC_MemSubType;
212 
214 typedef void (*SDL_ECC_ErrorCallback_t) (uint32_t errorSrc, uint32_t address);
215 
217 typedef void (*SDL_ECC_VIMDEDVector_t) (void);
218 
219 
224 typedef struct SDL_ECC_InitConfig_s
225 {
226  uint32_t numRams;
232 
237 typedef struct SDL_ECC_InjectErrorConfig_s
238 {
239  uint32_t *pErrMem;
241  uint32_t flipBitMask;
243  uint32_t chkGrp;
246 
251 typedef struct SDL_ECC_ErrorInfo_s
252 {
259  uint32_t bitErrCnt;
261  uint32_t injectBitErrCnt;
263  uint32_t bitErrorGroup;
265  uint64_t bitErrorOffset;
268 
277 int32_t SDL_ECC_initEsm (const SDL_ESM_Inst esmInstType);
278 
288 int32_t SDL_ECC_init (SDL_ECC_MemType eccMemType,
289  const SDL_ECC_InitConfig_t *pECCInitConfig);
290 
302  SDL_ECC_MemSubType memSubType);
303 
318  SDL_ECC_MemSubType memSubType,
319  SDL_ECC_InjectErrorType errorType,
320  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig,
321  uint32_t selfTestTimeOut);
322 
336  SDL_ECC_MemSubType memSubType,
337  SDL_ECC_InjectErrorType errorType,
338  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig);
339 
350  SDL_ECC_staticRegs *pStaticRegs);
351 
364  SDL_Ecc_AggrIntrSrc intrSrc,
365  SDL_ECC_ErrorInfo_t *pErrorInfo);
366 
376 int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType,
377  SDL_Ecc_AggrIntrSrc intrSrc);
378 
392 int32_t SDL_ECC_getESMErrorInfo(SDL_ESM_Inst instance, uint32_t intSrc,
393  SDL_ECC_MemType *eccMemType, SDL_Ecc_AggrIntrSrc *intrSrcType);
394 
409  SDL_Ecc_AggrIntrSrc intrSrc,
410  SDL_Ecc_AggrEDCErrorSubType subType, uint32_t numEvents);
411 
429  uint32_t errorSrc,
430  uint32_t address,
431  uint32_t ramId,
432  uint64_t bitErrorOffset,
433  uint32_t bitErrorGroup);
434 #if defined(SOC_AM263X)
435 
445 int32_t SDL_ECC_tcmParity(SDL_ECC_MemType eccMemType,
446  SDL_ECC_MemSubType memSubType,
447  uint32_t bitValue);
455 int32_t SDL_cleartcmStatusRegs(uint32_t clearVal);
456 #endif
457 #if defined(SOC_AM273X)|| defined(SOC_AWR294X)
458 
467 int32_t SDL_ECC_tcmParity(SDL_ECC_MemSubType memSubType,
468  uint32_t bitValue);
469 #endif
470 
471 
483  uint32_t bitValue,
484  uint32_t paramregvalue,
485  uint32_t regval);
486 
487 #ifdef __cplusplus
488 }
489 #endif /* extern "C" */
490 
491 #endif
SDL_ECC_getErrorInfo
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_ErrorCallback_t
void(* SDL_ECC_ErrorCallback_t)(uint32_t errorSrc, uint32_t address)
Definition: sdl_ecc.h:214
SDL_ECC_AggregatorType
SDL_ECC_AggregatorType
Definition: sdl_ecc.h:70
SDL_ECC_InitConfig_t
Definition: sdl_ecc.h:225
SDL_ECC_ErrorInfo_t::memSubType
SDL_ECC_MemSubType memSubType
Definition: sdl_ecc.h:255
SDL_ECC_InitConfig_t::numRams
uint32_t numRams
Definition: sdl_ecc.h:226
SDL_ECC_InjectErrorConfig_t::chkGrp
uint32_t chkGrp
Definition: sdl_ecc.h:243
sdl_esm.h
Header file contains enumerations, structure definitions and function declarations for SDL Error Sign...
SDL_ECC_MemType
uint32_t SDL_ECC_MemType
This enumerator indicate ECC memory type.
Definition: sdl_ecc.h:121
SDL_ECC_initMemory
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.
SDL_INJECT_ECC_ERROR_FORCING_1BIT_N_ROW_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_1BIT_N_ROW_REPEAT
Definition: sdl_ecc.h:99
SDL_ECC_injectError
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.
SDL_Ecc_AggrEDCErrorSubType
uint32_t SDL_Ecc_AggrEDCErrorSubType
This enumerator defines the types of possible EDC errors.
Definition: V1/sdl_ip_ecc.h:187
SDL_ECC_MemSubType
uint32_t SDL_ECC_MemSubType
This enumerator indicate ECC memory Sub Type.
Definition: sdl_ecc.h:211
SDL_ECC_getESMErrorInfo
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 ...
SDL_ECC_RamIdType
SDL_ECC_RamIdType
Definition: sdl_ecc.h:109
SDL_INJECT_ECC_ERROR_FORCING_1BIT_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_1BIT_REPEAT
Definition: sdl_ecc.h:95
SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_REPEAT
Definition: sdl_ecc.h:101
SDL_ECC_RAM_ID_TYPE_INTERCONNECT
@ SDL_ECC_RAM_ID_TYPE_INTERCONNECT
Definition: sdl_ecc.h:112
SDL_INJECT_ECC_NO_ERROR
@ SDL_INJECT_ECC_NO_ERROR
Definition: sdl_ecc.h:85
SDL_ECC_ErrorInfo_t::bitErrorGroup
uint32_t bitErrorGroup
Definition: sdl_ecc.h:263
SDL_ECC_ErrorInfo_t::intrSrc
SDL_Ecc_AggrIntrSrc intrSrc
Definition: sdl_ecc.h:257
sdl_common.h
Header file contains enumerations, structure definitions and function declarations for SDL COMMON int...
SDL_ECC_getStaticRegisters
int32_t SDL_ECC_getStaticRegisters(SDL_ECC_MemType eccMemType, SDL_ECC_staticRegs *pStaticRegs)
Gets the static registers for the specified ECC instance.
SDL_ECC_InjectErrorConfig_t
Definition: sdl_ecc.h:238
sdl_ip_ecc.h
SDL_ECC_InjectErrorConfig_t::pErrMem
uint32_t * pErrMem
Definition: sdl_ecc.h:239
SDL_ECC_staticRegs
This structure contains the static register group for Ecc aggregator used by the SDL_ecc_aggrReadStat...
Definition: V1/sdl_ip_ecc.h:296
SDL_ECC_tpccParity
int32_t SDL_ECC_tpccParity(SDL_ECC_MemType eccMemType, uint32_t bitValue, uint32_t paramregvalue, uint32_t regval)
Injects TPCC Parity error.
SDL_ECC_VIMDEDVector_t
void(* SDL_ECC_VIMDEDVector_t)(void)
Definition: sdl_ecc.h:217
SDL_ECC_ErrorInfo_t::bitErrorOffset
uint64_t bitErrorOffset
Definition: sdl_ecc.h:265
SDL_ECC_InjectErrorConfig_t::flipBitMask
uint32_t flipBitMask
Definition: sdl_ecc.h:241
SDL_ECC_InjectErrorType
SDL_ECC_InjectErrorType
ECC Inject error types.
Definition: sdl_ecc.h:83
SDL_ECC_initEsm
int32_t SDL_ECC_initEsm(const SDL_ESM_Inst esmInstType)
Initializes an module for usage with ECC module.
SDL_INJECT_ECC_ERROR_FORCING_2BIT_ONCE
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_ONCE
Definition: sdl_ecc.h:89
SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_ONCE
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_ONCE
Definition: sdl_ecc.h:93
SDL_Ecc_AggrIntrSrc
uint32_t SDL_Ecc_AggrIntrSrc
This enumerator defines the types of possible ECC errors.
Definition: V1/sdl_ip_ecc.h:106
SDL_ECC_ErrorInfo_t
Definition: sdl_ecc.h:252
SDL_ECC_AGGR_TYPE_FULL_FUNCTION
@ SDL_ECC_AGGR_TYPE_FULL_FUNCTION
Definition: sdl_ecc.h:73
SDL_ECC_InitConfig_t::pMemSubTypeList
SDL_ECC_MemSubType * pMemSubTypeList
Definition: sdl_ecc.h:229
SDL_ECC_AGGR_TYPE_INJECT_ONLY
@ SDL_ECC_AGGR_TYPE_INJECT_ONLY
Definition: sdl_ecc.h:71
SDL_ECC_init
int32_t SDL_ECC_init(SDL_ECC_MemType eccMemType, const SDL_ECC_InitConfig_t *pECCInitConfig)
Initializes ECC module for ECC detection.
SDL_ECC_RAM_ID_TYPE_WRAPPER
@ SDL_ECC_RAM_ID_TYPE_WRAPPER
Definition: sdl_ecc.h:110
SDL_ECC_ErrorInfo_t::injectBitErrCnt
uint32_t injectBitErrCnt
Definition: sdl_ecc.h:261
SDL_ECC_applicationCallbackFunction
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...
SDL_INJECT_ECC_ERROR_FORCING_1BIT_ONCE
@ SDL_INJECT_ECC_ERROR_FORCING_1BIT_ONCE
Definition: sdl_ecc.h:87
SDL_ECC_clearNIntrPending
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.
SDL_INJECT_ECC_ERROR_FORCING_2BIT_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_REPEAT
Definition: sdl_ecc.h:97
SDL_ECC_ErrorInfo_t::bitErrCnt
uint32_t bitErrCnt
Definition: sdl_ecc.h:259
SDL_ECC_ErrorInfo_t::eccMemType
SDL_ECC_MemType eccMemType
Definition: sdl_ecc.h:253
SDL_ECC_selfTest
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.
SDL_INJECT_ECC_ERROR_FORCING_1BIT_N_ROW_ONCE
@ SDL_INJECT_ECC_ERROR_FORCING_1BIT_N_ROW_ONCE
Definition: sdl_ecc.h:91
SDL_ECC_ackIntr
int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType, SDL_Ecc_AggrIntrSrc intrSrc)
Acknowledge the ECC interrupt.