PIE RAM API Functions

The code for this module is contained in source/stl_pie_ram.c, with include/stl_pie_ram.h containing the API declarations for use by applications.

Error Injection

To inject an error for STL_PIE_RAM_testRAM() to detect, call STL_PIE_RAM_injectFault() to bit-flip an entry of the redundant PIE RAM vector table.

To inject an error for STL_PIE_RAM_testHandler(), can disable global interrupts with the DINT macro.

Module Details

group stl_pie_ram

Defines

STL_PIE_RAM_PASS 0U
STL_PIE_RAM_FAIL_HANDLER 1U
STL_PIE_RAM_MIN_INDEX 0x6U
STL_PIE_RAM_MAX_INDEX 0x1C0U
STL_PIE_RAM_REDUNDANT_PIE_ADDRESS 0x1000D00UL
STL_PIE_RAM_TABLE_ROW_M 0x00FFU
STL_PIE_RAM_TABLE_COL_M 0xFF00U
STL_PIE_RAM_TABLE_COL_S 8U
STL_PIE_RAM_VECT_ID_M 0xFFFF0000UL
STL_PIE_RAM_VECT_ID_S 16U

Functions

void STL_PIE_RAM_handler(void)

PIE RAM mismatch error handler used by STL_PIE_RAM_testHandler().

This function sets a static global flag for STL_PIE_RAM_testHandler() and also sets the global error flag for the STL library.

Return

None.

void STL_PIE_RAM_configHandler(const void *handlerPtr)

Configures a vector mismatch handler.

This function configures a PIE RAM mismatch error handler for the users application. On a vector fetch mismatch, an exception will be taken and the error handler will be executed.

Parameters
  • handlerPtr: is a pointer or address of the PIE RAM vector mismatch error exception handler.

Return

None.

void STL_PIE_RAM_injectFault(const uint16_t entry)

Injects a fault by bit-flipping an entry in the redundant PIE RAM vector table.

This function bit-flips an entry of the redundant PIE RAM vector table in order to inject a fault. The

entry parameter must be within the boundaries STL_PIE_RAM_MIN_INDEX and STL_PIE_RAM_MAX_INDEX.
Parameters
  • entry: is an index of the PIE RAM and should be a multiple of 2 for 32-bit alignment.

Data writes to the redundant PIE vector table write only to the redundant table. This is how a fault may be injected. For more details see the device’s Technical Reference Manual chapter on “Vector Address Validity

Check.”

Return

None.

void STL_PIE_RAM_restoreVector(const uint16_t entry)

Restores a PIE RAM redundant vector entry from the PIE RAM vector table.

This function restores the PIE RAM vector entry and consequently the redundant PIE RAM vector table.

Parameters
  • entry: is an index of the PIE RAM and should be a multiple of 2 for 32-bit alignment.

Note

This function can be used to restore the fault injected by STL_PIE_RAM_injectFault().

Return

None.

void STL_PIE_RAM_restoreTable(const uint32_t *pieTableSourcePtr)

Restores the PIE RAM from the initialization source.

This function restores the PIE RAM vector table and consequently the redundant PIE RAM vector table.

Parameters
  • pieTableSourcePtr: is a pointer to the source of the PIE vector table in the user’s application.

Note

This function restores the entire PIE RAM table and not just a single vector entry.

Return

None.

uint16_t STL_PIE_RAM_testRAM(void)

Tests PIE RAM integrity.

This function checks the integrity of PIE RAM vector by comparing the entries in the main PIE vector with the redundant PIE vector located at a higher memory address location. There is a redundant PIE RAM vector table starting at 0X1000D00 which is used for data integrity of the PIE. Data writes to the PIE vector table also write to the redundant PIE vector table. For more details see the device’s Technical Reference Manual chapter on “PIE Vector Address Validity Check.”

Note

The user may call STL_PIE_RAM_configHandler() in order to register an error handler for PIE RAM mismatch.

A failure of this test will not trigger the PIE RAM mismatch handler. Only when a vector is fetched in the PIE and there is a mismatch will the handler be serviced.

Return

If the test passes, it returns STL_PIE_RAM_TEST_PASS. If the test fails, it returns the address in the PIE vector table of the last failure.

uint16_t STL_PIE_RAM_testHandler(const uint32_t interruptNumber)

Tests PIE RAM integrity.

This function checks the functionality of the PIE RAM mismatch error handler. It will inject an error for the input interrupt, enable the interrupt, and force the interrupt. It will then check to see that the error handler was serviced properly. Afterward, it will restore the PIE RAM and and restore the original error handler. It will also acknowledge the PIE so that further interrupts from that group can be serviced.

Parameters
  • interruptNumber: is the 32-bit interrupt value used in the interrupt driver found in hw_ints.h.

Note

This test only covers PIE interrupts. This test does not cover CPU interrupts.

Return

If the test passes, it returns STL_PIE_RAM_PASS. If the test fails, and the error handler was not serviced, then it returns STL_PIE_RAM_FAIL_HANDLER.