Index: firmware/App/Services/NVRecordsDD.c =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVRecordsDD.c (.../NVRecordsDD.c) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVRecordsDD.c (.../NVRecordsDD.c) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -17,12 +17,15 @@ #include "DDDefs.h" #include "NVMsgQ.h" #include "NVRecordsDD.h" -#include "NVMgmtDD.h" #include "Timers.h" #include "Utilities.h" // For crc calculation -// Data addresses and length in RTC RAM +/** + * @addtogroup NVRecordsDD + * @{ + */ +// ********** private definitions ********** #define RECORD_DEFAULT_TIME 0U ///< Record default time (calibration/set). #define RECORD_FOURTH_ORDER_COEFF 0.0F ///< Record fourth order coefficient. @@ -163,6 +166,8 @@ #pragma pack(pop) +// ********** private data ********** + // Calibration variables static DD_CALIBRATION_RECORD_T ddCalibrationRecord; ///< DG calibration record structure (including padding and final CRC). static DD_SYSTEM_GROUP_T ddSystemGroup; ///< DG system group structure (including padding and final CRC). @@ -191,7 +196,10 @@ static NVDATAMGMT_SELF_TEST_STATE_T nvDataMgmtSelfTestState; ///< NVDataMgmt self-test state variable. static SELF_TEST_STATUS_T nvDataMgmtSelfTestResult; ///< NVDataMgmt self-test result. static U32 usageWriteTries; ///< Usage write tries. +static BOOL isSelfTestReadRecordsDone; ///< Set to true when all the records are read +// ********** private function prototypes ********** + // Self test functions static NVDATAMGMT_SELF_TEST_STATE_T handleSelfTestReadRecords( void ); static NVDATAMGMT_SELF_TEST_STATE_T handleSelfTestCheckCRC( void ); @@ -277,7 +285,7 @@ // Check if the queues are empty and the exec state machine is in Idle meaning all the records have been read and the state machine // is back at Idle so even the last job in the queue has been processed - if ( ( TRUE == isRecordQueueEmpty() ) && ( TRUE == isNVExecStateIdle() ) ) + if ( TRUE == isSelfTestReadRecordsDone ) { updateRecordReadStatus( NVDATAMGMT_RECORDS_READ ); state = NVDATAMGMT_SELF_TEST_STATE_CHECK_CRC; @@ -286,7 +294,6 @@ return state; } - /*********************************************************************//** * @brief * The handleSelfTestCheckCRC calculates the CRC of the records and compares @@ -319,7 +326,8 @@ // If any of the records did not pass, they should be filled // with benign values. After that, schedule a write to sector 0 // to re-write the records with the benign values - if ( ( FALSE == hasServiceRecordPassed ) || ( FALSE == haveCalGroupsPassed ) || ( FALSE == hasSystemRecordPassed ) || ( FALSE == hasInstitutionalRecordPassed ) ) + if ( ( FALSE == hasServiceRecordPassed ) || ( FALSE == haveCalGroupsPassed ) || + ( FALSE == hasSystemRecordPassed ) || ( FALSE == hasInstitutionalRecordPassed ) ) { enqueueSector0Records(); SEND_EVENT_WITH_2_U32_DATA( RECORDS_SPECS[ NVDATAMGMT_CALIBRATION_RECORD ].nvEvent, 0, 0 ) @@ -1522,6 +1530,11 @@ nvDataMgmtSelfTestState = state; } +void updateSelfTestReadRecordsFlag ( BOOL value ) +{ + isSelfTestReadRecordsDone = value; +} + #ifndef _RELEASE_ /*********************************************************************//** * @brief @@ -1544,3 +1557,6 @@ return value; } #endif + +/**@}*/ +