3.1.2.1 DIAG_SRAM_MarchCMinus()
diag_result_t DIAG_SRAM_MarchCMinus (uint16_t startAddress, uint16_t length, uint16_t bufferAddress)
Implements the March C- test on the SRAM. It is a complete and irredundant test capable of detecting stuck-at Faults, addressing Faults, transition Faults, and coupling Faults. Since this is a destructive test, a buffer must be provided to save and restore user memory during its run.
-
March C- test algorithm is executed in six steps:
-
Step 1: Ascending (w0)
-
Step 2: Ascending (r0, w1)
-
Step 3: Ascending (r1, w0)
-
Step 4: Descending (r0, w1)
-
Step 5: Descending (r1, w0)
-
Step 6: Ascending (r0)
-
in | startAddress |
- Address of the first SRAM location to test |
in | length |
- Number of bytes to test |
in | bufferAddress |
- Address of buffer where user data will be stored during test |
DIAG_PASS - No Fault detected DIAG_FAIL - Fault detected DIAG_INVALID_ARG - Invalid length or address is passed to this function |
MISRA C:2012 Deviation Advisory: misra-c2012-15.5
Justification: The function should return as soon as a Fault is detected. Avoiding the use of multiple return statements requires having multiple additional checks which would add overhead, diminish code readability and would imply defaulting the test result to DIAG_PASS. The latter is deemed less safe than only returning DIAG_PASS when all sections have been tested with no Fault detected. Since there is no functional termination code in this function, it cannot accidentally be omitted, and since the function does not have any persistent side effects, there is no issue in discerning which side effects have been applied when the function is executed/exits, and thus the deviation is deemed safe.