![]() |
Altera HWLIB
16.0
The Altera HW Manager API Reference Manual
|
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 System 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 System 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_ERROR_STATUS_e | ALT_ECC_ERROR_STATUS_t |
Functions | |
ALT_STATUS_CODE | alt_ecc_start (const ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_stop (const ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_is_enabled (const ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_status_get (const ALT_ECC_RAM_ENUM_t ram_block, uint32_t *status) |
ALT_STATUS_CODE | alt_ecc_status_clear (const ALT_ECC_RAM_ENUM_t ram_block, const uint32_t ecc_mask) |
ALT_STATUS_CODE | alt_ecc_serr_inject (const ALT_ECC_RAM_ENUM_t ram_block) |
ALT_STATUS_CODE | alt_ecc_derr_inject (const ALT_ECC_RAM_ENUM_t ram_block) |
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_ERROR_STATUS_e ALT_ECC_ERROR_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 automatically when ECC is started.
enum ALT_ECC_RAM_ENUM_e |
This type enumerates the ECC protected RAM blocks embedded in HPS peripherals.
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 automatically when ECC is started.
ALT_STATUS_CODE alt_ecc_start | ( | const 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_start(ALT_ECC_RAM_QSPI); // Bring up ECC protection for QSPI.
There may be some spurious interrupts that occurs as part of the ECC bring up. However at the completion of the ECC bring up, there will be no ECC related interrupts pending.
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_STATUS_CODE alt_ecc_stop | ( | const 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 | ( | const 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 | ( | const 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_clear | ( | const ALT_ECC_RAM_ENUM_t | ram_block, |
const 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_ERROR_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_serr_inject | ( | const ALT_ECC_RAM_ENUM_t | ram_block | ) |
Injects a single bit, correctable error into the specified ECC protected RAM block for test purposes. This error will occur at the next write to the specified RAM block and will remain pending until such time. For RAM blocks which have mutliple RAM sub-blocks, all sub-blocks are injected. This affects the EMAC0, EMAC1, NAND, and SDMMC.
ECC protection is required to be enabled on the RAM block.
ram_block | The RAM block to inject the ECC error into. |
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_BAD_OPERATION | ECC is not enabled on the specified RAM block. |
ALT_STATUS_CODE alt_ecc_derr_inject | ( | const ALT_ECC_RAM_ENUM_t | ram_block | ) |
Injects a double bit, non-correctable error into the specified ECC protected RAM block for test purposes. This error will occur at the next write to the specified RAM block and will remain pending until such time. For RAM blocks which have mutliple RAM sub-blocks, all sub-blocks are injected. This affects the EMAC0, EMAC1, NAND, and SDMMC.
ECC protection is required to be enabled on the RAM block.
ram_block | The RAM block to disable ECC protection for. |
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_BAD_OPERATION | ECC is not enabled on the specified RAM block. |