Hardware Libraries
20.1
Arria 10 SoC Hardware Manager
|
This module provides programmatic access and control of the Error-Correcting Code (ECC) protection features for the embedded RAM blocks in HPS peripherals.
ECC protection can be enabled or disabled for each of the following HPS peripheral embedded RAM blocks:
All ECC protected peripherals support detection of single bit, correctable errors and double bit, non-correctable errors.
With the exception of L2 cache data RAM, each of the ECC protected memories generates single and double bit interrupts to the global interrupt controller (GIC) and sets error status condition bits in the ECC Manager. The L2 cache interrupt only generates single and double bit interrupts to the global interrupt controller (GIC) - no error status conditions are set in the ECC Manager.
When ECC protection is enabled, RAM data should first be written before ever being read. Otherwise the ECC syndrome encoding bits for each memory location probably contain random uninitialized data that will result in spurious ECC errors. A utility function is provided to guarantee proper initialization is performed on a memory block once ECC is enabled.
Fault injection capabilities for single, correctable errors and double, non-correctable errors are provided for test purposes.
Typedefs | |
typedef enum ALT_ECC_RAM_ENUM_e | ALT_ECC_RAM_ENUM_t |
typedef enum ALT_ECC_STATUS_e | ALT_ECC_STATUS_t |
Functions | |
ALT_STATUS_CODE | alt_ecc_init (void) |
ALT_STATUS_CODE | alt_ecc_uninit (void) |
ALT_STATUS_CODE | alt_ecc_start (ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_stop (ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_is_enabled (ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_status_get (ALT_ECC_RAM_ENUM_t ram_block, uint32_t *status) |
ALT_STATUS_CODE | alt_ecc_status_get_next (ALT_ECC_RAM_ENUM_t *ram_block, uint32_t *status) |
ALT_STATUS_CODE | alt_ecc_status_clear (ALT_ECC_RAM_ENUM_t ram_block, uint32_t ecc_mask) |
ALT_STATUS_CODE | alt_ecc_status_int_enable (ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_status_int_disable (ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_serr_inject (ALT_ECC_RAM_ENUM_t ram_block, uintptr_t location, uint32_t mem_size) |
ALT_STATUS_CODE | alt_ecc_derr_inject (ALT_ECC_RAM_ENUM_t ram_block, uintptr_t location, uint32_t mem_size) |
typedef enum ALT_ECC_RAM_ENUM_e ALT_ECC_RAM_ENUM_t |
This type enumerates the ECC protected RAM blocks embedded in HPS peripherals.
typedef enum ALT_ECC_STATUS_e ALT_ECC_STATUS_t |
This type definition enumerates the ECC status conditions for each of the HPS embedded RAM blocks.
The enumerations serve as masks for the ECC status conditions monitored in each of the individual embedded RAM blocks. If ECC protection is enabled on the selected RAM block, then a mask bit corresponding to the type of ECC error is set to 1 if the error occurs.
Additionally, when any of these ECC error conditions occur, then an ECC interrupt signal is asserted.
Interrupt sources are cleared by calling alt_ecc_status_clear(). The ECC interrupt sources are enabled by calling alt_ecc_status_int_enable(). This causes the selected RAM block ECC status to contribute to the ALT_INT_INTERRUPT_SERR_GLOBAL and ALT_INT_INTERRUPT_DERR_GLOBAL interrupt generation.
enum ALT_ECC_RAM_ENUM_e |
This type enumerates the ECC protected RAM blocks embedded in HPS peripherals.
enum ALT_ECC_STATUS_e |
This type definition enumerates the ECC status conditions for each of the HPS embedded RAM blocks.
The enumerations serve as masks for the ECC status conditions monitored in each of the individual embedded RAM blocks. If ECC protection is enabled on the selected RAM block, then a mask bit corresponding to the type of ECC error is set to 1 if the error occurs.
Additionally, when any of these ECC error conditions occur, then an ECC interrupt signal is asserted.
Interrupt sources are cleared by calling alt_ecc_status_clear(). The ECC interrupt sources are enabled by calling alt_ecc_status_int_enable(). This causes the selected RAM block ECC status to contribute to the ALT_INT_INTERRUPT_SERR_GLOBAL and ALT_INT_INTERRUPT_DERR_GLOBAL interrupt generation.
ALT_STATUS_CODE alt_ecc_init | ( | void | ) |
Initializes the ECC subsystem. This API should be called before any other ECC related operation.
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Error status. |
ALT_STATUS_CODE alt_ecc_uninit | ( | void | ) |
Uninitializes the ECC subsystem. This API should be called after all other ECC related operation.
ALT_E_SUCCESS | Successful status. |
ALT_E_ERROR | Error status. |
ALT_STATUS_CODE alt_ecc_start | ( | ALT_ECC_RAM_ENUM_t | ram_block | ) |
Initializes and starts ECC protection for the specified embedded RAM block.
This function performs any necessary initialization on the embedded RAM block for the specified peripheral. The decision on whether to enable ECC protection for the peripheral embedded RAM block should be made before commencing normal operational use of the peripheral. Ideally, ECC protection for a peripheral should be enabled immediately after calling the peripheral's initialization function and calling the alt_ecc_init() function designating the applicable peripheral embedded RAM block.
For example, the proper initialization sequence for enabling ECC for the QSPI controller embedded RAM block is:
alt_qspi_init(); // Initialize the QSPI controller. alt_qspi_enable(); // Enable the QSPI controller. alt_ecc_init(); // Initialize the ECC subsystem. alt_ecc_start(ALT_ECC_RAM_QSPI); // Bring up ECC protection for QSPI.
NOTE: The contents of the embedded RAM block are overwritten during initialization. This should not normally present a problem as the presumption is that this routine is called as part of the peripheral's initialization sequence. As well, any special RAM configurations may be overwritten as part of the initialization. Particularly, the L2 data RAM may alter the lockdown settings.
ram_block | The RAM block to initialize. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | The ram_block argument is invalid. |
ALT_E_TMO | Timeout initializing RAM block contents. |
ALT_STATUS_CODE alt_ecc_stop | ( | ALT_ECC_RAM_ENUM_t | ram_block | ) |
Stops and Uninitializes ECC protection for the specified embedded RAM block.
ram_block | The RAM block to uninitialize. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | The ram_block argument is invalid. |
ALT_STATUS_CODE alt_ecc_is_enabled | ( | ALT_ECC_RAM_ENUM_t | ram_block | ) |
Returns ALT_E_TRUE if the specified RAM block is enabled for ECC protection and ALT_E_FALSE otherwise.
ram_block | The RAM block to check for ECC protection enablement. |
ALT_E_TRUE | ECC protection is enabled. |
ALT_E_FALSE | ECC protection is not enabled. |
ALT_E_BAD_ARG | The ram_block argument is invalid. |
ALT_STATUS_CODE alt_ecc_status_get | ( | ALT_ECC_RAM_ENUM_t | ram_block, |
uint32_t * | status | ||
) |
Returns an ECC error status bit mask for the specified RAM block.
The returned bit mask reflects the ECC status conditions for the specified RAM block.
ram_block | The RAM block to return the ECC error status mask for. |
status | [out] An ECC status condition bit mask is returned indicating the single bit, correctable (SERR) and/or double bit, non-correctable error (DERR) conditions set for the specified RAM block. A set (1) bit indicates an error detection for the corresponding ECC error type mask. |
ALT_E_TRUE | ECC protection is enabled. |
ALT_E_FALSE | ECC protection is not enabled. |
ALT_E_BAD_ARG | The ram_block argument is invalid. |
ALT_STATUS_CODE alt_ecc_status_get_next | ( | ALT_ECC_RAM_ENUM_t * | ram_block, |
uint32_t * | status | ||
) |
Scans the status of all ECC enabled RAM blocks and reports an active ECC status and the associated RAM block.
ram_block | [out] A RAM block that has status to report. |
status | [out] An ECC status condition bit mask is returned indicating the single bit, correctable (SERR) and/or double bit, non-correctable error (DERR) conditions set for the specified RAM block. A set (1) bit indicates an error detection for the corresponding ECC error type mask. |
ALT_E_ERROR | No RAM blocks have ECC status to report. The output values for ram_block and status should be ignored. |
ALT_E_SUCCESS |
ALT_STATUS_CODE alt_ecc_status_clear | ( | ALT_ECC_RAM_ENUM_t | ram_block, |
uint32_t | ecc_mask | ||
) |
Clears the selected ECC error conditions for the specified RAM block.
A bit mask is returned containing indications of any single bit, correctable (SERR) and/or double bit, non-correctable error (DERR) occurrences for the specified RAM block. A 1 indicates an error detection of the corresponding error type mask position.
ram_block | The RAM block to clear the ECC error condition statuses for. |
ecc_mask | A bit mask specification of the ECC error condition statuses (ALT_ECC_STATUS_t) to clear. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | An invalid ecc_mask was specified. |
ALT_E_BAD_ARG | Either the ram_block or ecc_mask argument is invalid. |
ALT_STATUS_CODE alt_ecc_status_int_enable | ( | ALT_ECC_RAM_ENUM_t | ram_block | ) |
Enables the particular RAM block ECC status to trigger the system interrupt ALT_INT_INTERRUPT_SERR_GLOBAL and ALT_INT_INTERRUPT_DERR_GLOBAL generation.
ram_block | The RAM block to clear the ECC error condition statuses for. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | Failure status. |
ALT_E_BAD_ARG | The ram_block is invalid. |
ALT_STATUS_CODE alt_ecc_status_int_disable | ( | ALT_ECC_RAM_ENUM_t | ram_block | ) |
Disables the particular RAM block ECC status from triggering the system interrupt ALT_INT_INTERRUPT_SERR_GLOBAL and ALT_INT_INTERRUPT_DERR_GLOBAL generation.
ram_block | The RAM block to clear the ECC error condition statuses for. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | Failure status. |
ALT_E_BAD_ARG | The ram_block is invalid. |
ALT_STATUS_CODE alt_ecc_serr_inject | ( | ALT_ECC_RAM_ENUM_t | ram_block, |
uintptr_t | location, | ||
uint32_t | mem_size | ||
) |
Injects a single bit, correctable error into the specified ECC protected RAM block for test purposes. For RAM blocks which have mutliple RAM sub-blocks, all sub-blocks are injected. This affects the EMAC0, EMAC1, EMAC2, NAND, and SDMMC.
ECC protection is required to be enabled on the RAM block.
For error injection into L2, this API may alter the memory cached state in L1 and L2.
ram_block | The RAM block to inject the ECC error into. |
location | For L2, this speicifies the virtual address of a cache line where the error will be injected. For all other ROM blocks, this parameter specifies the index into the protected memory. The maximum value value varies depending on the size and organization of that memory. |
mem_size | For SDMMC, this specifies how much of the memory will written and read. For all other RAM blocks, it is not used. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | The ram_block argument is invalid or location in valid for the specified RAM. |
ALT_E_BAD_OPERATION | ECC is not enabled on the specified RAM block. |
ALT_STATUS_CODE alt_ecc_derr_inject | ( | ALT_ECC_RAM_ENUM_t | ram_block, |
uintptr_t | location, | ||
uint32_t | mem_size | ||
) |
Injects a double bit, non-correctable error into the specified ECC protected RAM block for test purposes. For RAM blocks which have mutliple RAM sub-blocks, all sub-blocks are injected. This affects the EMAC0, EMAC1, EMAC2, NAND, and SDMMC.
ECC protection is required to be enabled on the RAM block.
For error injection into L2, this API may alter the memory cached state in L1 and L2.
ram_block | The RAM block to disable ECC protection for. |
location | For L2, this speicifies the virtual address of a cache line where the error will be injected. For all other ROM blocks, this parameter specifies the index into the protected memory. The maximum value value varies depending on the size and organization of that memory. |
mem_size | For SDMMC, this specifies how much of the memory will be written and read. For all other RAM blocks, it is not used. |
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | The ram_block argument is invalid or location in valid for the specified RAM. |
ALT_E_BAD_OPERATION | ECC is not enabled on the specified RAM block. |