Runs the functional self-test for the Peripheral Protection Unit.
Attempts an unauthorized write to an application-provided, already-protected peripheral register, then verifies that the expected peripheral-protection violation was captured in the supplied fault structure (with the fault address matching the accessed register) and, optionally, that the register content is unchanged.
- Parameters
-
| entry | Pointer to stl_ppu_entry_t describing the protected register under test and the fault structure / expected fault source to observe. |
- Returns
- OK_STATUS - The denied write was captured as
entry->expectedFault with the fault address equal to entry->testReg, and (if entry->checkIntegrity is true) the register content is unchanged.
ERROR_STATUS - A fault was already present when the function was called (captured in the fault structure, or a pending entry->expectedFault): the write is not attempted and the fault is left for the application. Otherwise: the expected violation was not observed, the fault address did not match, or the register content changed.
ERROR_BAD_PARAM - Invalid entry: null entry, testReg, or faultStruct pointer, entry->expectedFault not below CY_SYSFAULT_NO_FAULT, or entry->checkIntegrity is true and entry->writeValue equals entry->expectedValue.
- Note
- Preconditions: the final application PPU policy is applied (the calling core runs at a non-zero protection context, and at its privilege level, that is denied write access to
entry->testReg), entry->faultStruct is accessible at that protection context, and the bus-error conditions in More Information are met. Any fault captured in entry->faultStruct and any pending entry->expectedFault (for example from an earlier failed call) must be handled by the application first. The self-test does not discard faults it did not cause.
-
Side effects:
- During the call,
entry->faultStruct captures only entry->expectedFault, with the fault interrupt (INTR_MASK) and the reset request, IO output (fault_out) and trigger outputs (CTL) disabled, so the deliberate fault raises no fault ISR, reset, or external fault signal. Faults of other sources are not captured by this structure and stay pending.
- On exit,
entry->faultStruct is released: MASK0..2 and INTR_MASK are cleared and CTL has all outputs disabled. STATUS.VALID and INTR are cleared only if they hold the test's own violation (entry->expectedFault at entry->testReg). Any other captured fault is left for the application. If the induced violation was not captured (for example a wrong entry->expectedFault), it stays pending. If the application uses this fault structure, it must configure it again after the self-test.
-
This function is blocking; the poll for the violation is bounded by PPU_TEST_POLL_TIMEOUT_US. It is not reentrant and must not be called from an ISR.