123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
-
- #include "stm32fxx_STUlib.h"
- /**
- * @brief Initializes the pointer to the RAM for the run-time
- * transparent functional test.
- * @param : None
- * @retval : None
- */
- void STU_RamRunInit(void)
- {
- /* start address of the test has to be aligned to 16 address range */
- pRunTimeRamChk = (uint32_t *)((uint32_t)CLASS_B_START & 0xFFFFFFFCuL);
- pRunTimeRamChkInv = (uint32_t *)(uint32_t)(~(uint32_t)pRunTimeRamChk);
- }
- /* ---------------------------------------------------------------------------*/
- /**
- * @brief This function verifies that 4 words of RAM are functional,
- * overlapping) using the walkpat algorithm.
- * @param : None
- * @retval : STU_TestStatus (TEST_RUNNING, CLASS_C_DATA_FAIL,
- * TEST_FAILURE, TEST_OK)
- */
- STU_TestStatus STU_RamRun(void)
- {
- STU_TestStatus result = TEST_RUNNING;
-
- /* Check Class C var integrity */
- if ((((uint32_t)pRunTimeRamChk) ^ ((uint32_t)pRunTimeRamChkInv)) == 0xFFFFFFFFuL)
- {
- if (pRunTimeRamChk >= CLASS_B_END)
- {
- /*------------- March test applied on the RAM Buffer itself --------------- */
- if (STU_RamWalkpatStep(&aRunTimeRamBuf[0], &aRunTimeRamBuf[0]) == 1)
- {
- /* All the RAM test is completed successfully */
- result = TEST_OK;
- }
- else /* Buffer is not functional */
- {
- result = TEST_FAILURE;
- }
- /* Init next cycle of the transparent RAM test starting from the begin of the Class B area */
- pRunTimeRamChk = CLASS_B_START;
- pRunTimeRamChkInv = ((uint32_t *)~((uint32_t)CLASS_B_START));
- }
- else
- { /* ------------- RAM test applied on Class B data area ------------------ */
- /* !!! Application has to ensure that no write or read operation
- is performed within Class B RAM area during this test !!! */
- if (STU_RamWalkpatStep(pRunTimeRamChk, &aRunTimeRamBuf[0]) == 1)
- {
- /* Prepare next Row Transparent RAM test */
- pRunTimeRamChk += RT_RAM_BLOCKSIZE - (2u * RT_RAM_BLOCK_OVERLAP);
- pRunTimeRamChkInv = (uint32_t *)(uint32_t)(~(uint32_t)pRunTimeRamChk);
- }
- else
- {
- result = TEST_FAILURE; /* Word line under test was not functional */
- }
- }
- }
- else /* Class C error on pRunTimeRamChk */
- {
- result = CLASS_C_DATA_FAIL;
- }
- return (result);
- }
- /**********************END OF FILE***********************************/
|