AM62x 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 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/sdl_esm.h>
57 #endif
58 
59 #if defined(SOC_AM273X) || defined(SOC_AWR294X)
60 #include <sdl/esm/v1/sdl_esm.h>
61 #endif
62 
63 #if defined(SOC_AM64X) || defined(SOC_AM243X)
64 #include <sdl/esm/sdl_esm.h>
65 #include <sdl/include/am64x_am243x/sdlr_soc_baseaddress.h>
66 #include <sdl/include/am64x_am243x/sdlr_soc_ecc_aggr.h>
67 #endif
68 
69 #if defined(SOC_AM62X)
70 #include <sdl/esm/sdl_esm.h>
71 #include <sdl/include/am62x/soc_config.h>
72 #include <sdl/include/am62x/sdlr_soc_baseaddress.h>
73 #include <sdl/include/am62x/sdlr_soc_ecc_aggr.h>
74 #endif
75 
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 
84 typedef enum {
90 
91 
97 typedef enum {
117 
118 
123 typedef enum {
129 
135 typedef uint32_t SDL_ECC_MemType;
136 
137 #if defined(SOC_AM62X)
138 #define SDL_COMPUTE_CLUSTER0_SAM62_A53_512KB_WRAP_A53_DUAL_WRAP_CBA_WRAP_A53_DUAL_WRAP_CBA_COREPAC_ECC_AGGR_CORE0 (0U)
139 #define SDL_COMPUTE_CLUSTER0_SAM62_A53_512KB_WRAP_A53_DUAL_WRAP_CBA_WRAP_A53_DUAL_WRAP_CBA_COREPAC_ECC_AGGR_CORE1 (1U)
140 #define SDL_COMPUTE_CLUSTER0_SAM62_A53_512KB_WRAP_A53_DUAL_WRAP_CBA_WRAP_A53_DUAL_WRAP_CBA_COREPAC_ECC_AGGR_CORE2 (2U)
141 #define SDL_COMPUTE_CLUSTER0_SAM62_A53_512KB_WRAP_A53_DUAL_WRAP_CBA_WRAP_A53_DUAL_WRAP_CBA_COREPAC_ECC_AGGR_CORE3 (3U)
142 #define SDL_COMPUTE_CLUSTER0_SAM62_A53_512KB_WRAP_A53_DUAL_WRAP_CBA_WRAP_A53_DUAL_WRAP_CBA_COREPAC_ECC_AGGR_COREPAC (4U)
143 #define SDL_CSI_RX_IF0_CSI_RX_IF_ECC_AGGR (5U)
144 #define SDL_DMASS0_DMSS_AM62_ECCAGGR (6U)
145 #define SDL_ECC_AGGR0_SAM62_SEC_ECC_AGGR (7U)
146 #define SDL_FSS0_FSS_UL_OSPI0_OSPI_WRAP_ECC_AGGR (8U)
147 #define SDL_GICSS0_GIC500SS_1_4_ECC_AGGR (9U)
148 #define SDL_ICSSM0_ICSS_M_CORE_BORG_ECC_AGGR (10U)
149 #define SDL_MCAN0_MCANSS_MSGMEM_WRAP_ECC_AGGR (11U)
150 #define SDL_MCU_ECC_AGGR0_SAM62_MCU_ECC_AGGR (12U)
151 #define SDL_MCU_M4FSS0_BLAZAR_ECC (13U)
152 #define SDL_MCU_MCAN0_MCANSS_MSGMEM_WRAP_ECC_AGGR (14U)
153 #define SDL_MCU_MCAN1_MCANSS_MSGMEM_WRAP_ECC_AGGR (15U)
154 #define SDL_MMCSD0_EMMCSD8SS_ECC_AGGR_RXMEM (16U)
155 #define SDL_MMCSD0_EMMCSD8SS_ECC_AGGR_TXMEM (17U)
156 #define SDL_MMCSD1_EMMCSD4SS_ECC_AGGR_RXMEM (18U)
157 #define SDL_MMCSD1_EMMCSD4SS_ECC_AGGR_TXMEM (19U)
158 #define SDL_MMCSD2_EMMCSD4SS_ECC_AGGR_RXMEM (20U)
159 #define SDL_MMCSD2_EMMCSD4SS_ECC_AGGR_TXMEM (21U)
160 #define SDL_PDMA0_SAM62_PDMA_SPI_ECCAGGR (22U)
161 #define SDL_PDMA1_SAM62_PDMA_UART_ECCAGGR (23U)
162 #define SDL_PSRAMECC_16K0_PSRAM16KX32E_ECC_AGGR (24U)
163 #define SDL_PSRAMECC0_PSRAM256X32E_ECC_AGGR (25U)
164 #define SDL_SA3_SS0_SA3SS_AM62_DMSS_ECCAGGR (26U)
165 #define SDL_SA3_SS0_SA3SS_AM62_SA_UL_ECC_AGGR (27U)
166 #define SDL_SMS0_SMS_HSM_ECC (28U)
167 #define SDL_SMS0_SMS_TIFS_ECC (29U)
168 #define SDL_USB0_USB2SS_16FFC_USB2SS_CORE_ECC_AGGR (30U)
169 #define SDL_USB1_USB2SS_16FFC_USB2SS_CORE_ECC_AGGR (31U)
170 #define SDL_WKUP_ECC_AGGR0_SAM62_DM_ECC_AGGR (32U)
171 #define SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR (33U)
172 #define SDL_WKUP_SAFE_ECC_AGGR0_SAM62_WKUP_SAFE_ECC_AGGR (34U)
173 #define SDL_WKUP_VTM0_K3VTM_N16FFC_ECCAGGR (35U)
174 #define SDL_CPSW0_CPSW_3GUSS_CORE_ECC_CPSW_ECC_AGGR (36u)
175 #define SDL_ECC_MEMTYPE_MAX (SDL_CPSW0_CPSW_3GUSS_CORE_ECC_CPSW_ECC_AGGR + 1U)
176 #endif
177 
178 #if defined(SOC_AM62X)
179 
180 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK0_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_ATCM0_BANK0_RAM_ID)
181 
182 #define SDL_ECC_R5F_MEM_SUBTYPE_ATCM0_BANK1_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_ATCM0_BANK1_RAM_ID)
183 
184 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK0_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_B0TCM0_BANK0_RAM_ID)
185 
186 #define SDL_ECC_R5F_MEM_SUBTYPE_B0TCM0_BANK1_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_B0TCM0_BANK1_RAM_ID)
187 
188 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK0_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_B1TCM0_BANK0_RAM_ID)
189 
190 #define SDL_ECC_R5F_MEM_SUBTYPE_B1TCM0_BANK1_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_B1TCM0_BANK1_RAM_ID)
191 
192 #define SDL_ECC_R5F_MEM_SUBTYPE_KS_VIM_RAM_VECTOR_ID (SDL_WKUP_R5FSS0_PULSAR_UL_CPU0_ECC_AGGR_PULSAR_UL_PULSAR_KS_VIM_COMMON_CORE0_RAM_RAM_ID)
193 #endif
194 
200 typedef uint32_t SDL_ECC_MemSubType;
201 
203 typedef void (*SDL_ECC_ErrorCallback_t) (uint32_t errorSrc, uint32_t address);
204 
206 typedef void (*SDL_ECC_VIMDEDVector_t) (void);
207 
208 
213 typedef struct SDL_ECC_InitConfig_s
214 {
215  uint32_t numRams;
221 
226 typedef struct SDL_ECC_InjectErrorConfig_s
227 {
228  uint32_t *pErrMem;
230  uint32_t flipBitMask;
232  uint16_t chkGrp;
235 
240 typedef struct SDL_ECC_ErrorInfo_s
241 {
248  uint32_t bitErrCnt;
250  uint32_t injectBitErrCnt;
252  uint32_t bitErrorGroup;
254  uint64_t bitErrorOffset;
257 
266 int32_t SDL_ECC_initEsm (const SDL_ESM_Inst esmInstType);
267 
277 int32_t SDL_ECC_init (SDL_ECC_MemType eccMemType,
278  const SDL_ECC_InitConfig_t *pECCInitConfig);
279 
291  SDL_ECC_MemSubType memSubType);
292 
307  SDL_ECC_MemSubType memSubType,
308  SDL_ECC_InjectErrorType errorType,
309  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig,
310  uint32_t selfTestTimeOut);
311 
325  SDL_ECC_MemSubType memSubType,
326  SDL_ECC_InjectErrorType errorType,
327  const SDL_ECC_InjectErrorConfig_t *pECCErrorConfig);
328 
339  SDL_ECC_staticRegs *pStaticRegs);
340 
353  SDL_Ecc_AggrIntrSrc intrSrc,
354  SDL_ECC_ErrorInfo_t *pErrorInfo);
355 
365 int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType,
366  SDL_Ecc_AggrIntrSrc intrSrc);
367 
381 int32_t SDL_ECC_getESMErrorInfo(SDL_ESM_Inst instance, uint32_t intSrc,
382  SDL_ECC_MemType *eccMemType, SDL_Ecc_AggrIntrSrc *intrSrcType);
383 
398  SDL_Ecc_AggrIntrSrc intrSrc,
399  SDL_Ecc_AggrEDCErrorSubType subType, uint32_t numEvents);
400 
418  uint32_t errorSrc,
419  uint32_t address,
420  uint32_t ramId,
421  uint64_t bitErrorOffset,
422  uint32_t bitErrorGroup);
423 
424 #ifdef __cplusplus
425 }
426 #endif /* extern "C" */
427 
428 #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:203
SDL_ESM_Inst
SDL_ESM_Inst
Definition: sdl_esm_soc.h:59
SDL_ECC_AggregatorType
SDL_ECC_AggregatorType
Definition: sdl_ecc.h:84
SDL_ECC_InitConfig_t
Definition: sdl_ecc.h:214
SDL_ECC_ErrorInfo_t::memSubType
SDL_ECC_MemSubType memSubType
Definition: sdl_ecc.h:244
SDL_ECC_InitConfig_t::numRams
uint32_t numRams
Definition: sdl_ecc.h:215
SDL_ECC_MemType
uint32_t SDL_ECC_MemType
This enumerator indicate ECC memory type.
Definition: sdl_ecc.h:135
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:113
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: sdl_ip_ecc.h:189
SDL_ECC_MemSubType
uint32_t SDL_ECC_MemSubType
This enumerator indicate ECC memory Sub Type.
Definition: sdl_ecc.h:200
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:123
SDL_INJECT_ECC_ERROR_FORCING_1BIT_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_1BIT_REPEAT
Definition: sdl_ecc.h:109
SDL_ECC_InjectErrorConfig_t::chkGrp
uint16_t chkGrp
Definition: sdl_ecc.h:232
SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_REPEAT
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_REPEAT
Definition: sdl_ecc.h:115
SDL_ECC_RAM_ID_TYPE_INTERCONNECT
@ SDL_ECC_RAM_ID_TYPE_INTERCONNECT
Definition: sdl_ecc.h:126
SDL_INJECT_ECC_NO_ERROR
@ SDL_INJECT_ECC_NO_ERROR
Definition: sdl_ecc.h:99
SDL_ECC_ErrorInfo_t::bitErrorGroup
uint32_t bitErrorGroup
Definition: sdl_ecc.h:252
SDL_ECC_ErrorInfo_t::intrSrc
SDL_Ecc_AggrIntrSrc intrSrc
Definition: sdl_ecc.h:246
sdl_esm.h
Header file contains enumerations, structure definitions and function declarations for SDL Error Sign...
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:227
SDL_ECC_InjectErrorConfig_t::pErrMem
uint32_t * pErrMem
Definition: sdl_ecc.h:228
SDL_ECC_staticRegs
This structure contains the static register group for Ecc aggregator used by the SDL_ecc_aggrReadStat...
Definition: sdl_ip_ecc.h:350
SDL_ECC_VIMDEDVector_t
void(* SDL_ECC_VIMDEDVector_t)(void)
Definition: sdl_ecc.h:206
SDL_ECC_ErrorInfo_t::bitErrorOffset
uint64_t bitErrorOffset
Definition: sdl_ecc.h:254
SDL_ECC_InjectErrorConfig_t::flipBitMask
uint32_t flipBitMask
Definition: sdl_ecc.h:230
SDL_ECC_InjectErrorType
SDL_ECC_InjectErrorType
ECC Inject error types.
Definition: sdl_ecc.h:97
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:103
SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_ONCE
@ SDL_INJECT_ECC_ERROR_FORCING_2BIT_N_ROW_ONCE
Definition: sdl_ecc.h:107
SDL_Ecc_AggrIntrSrc
uint32_t SDL_Ecc_AggrIntrSrc
This enumerator defines the types of possible ECC errors.
Definition: sdl_ip_ecc.h:108
SDL_ECC_ErrorInfo_t
Definition: sdl_ecc.h:241
SDL_ECC_AGGR_TYPE_FULL_FUNCTION
@ SDL_ECC_AGGR_TYPE_FULL_FUNCTION
Definition: sdl_ecc.h:87
SDL_ECC_InitConfig_t::pMemSubTypeList
SDL_ECC_MemSubType * pMemSubTypeList
Definition: sdl_ecc.h:218
SDL_ECC_AGGR_TYPE_INJECT_ONLY
@ SDL_ECC_AGGR_TYPE_INJECT_ONLY
Definition: sdl_ecc.h:85
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:124
SDL_ECC_ErrorInfo_t::injectBitErrCnt
uint32_t injectBitErrCnt
Definition: sdl_ecc.h:250
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:101
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:111
SDL_ECC_ErrorInfo_t::bitErrCnt
uint32_t bitErrCnt
Definition: sdl_ecc.h:248
SDL_ECC_ErrorInfo_t::eccMemType
SDL_ECC_MemType eccMemType
Definition: sdl_ecc.h:242
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:105
SDL_ECC_ackIntr
int32_t SDL_ECC_ackIntr(SDL_ECC_MemType eccMemType, SDL_Ecc_AggrIntrSrc intrSrc)
Acknowledge the ECC interrupt.