Index: NVDataMgmt.c =================================================================== diff -u -rb4e91eb8049e94b0937e341880a90327113fce56 -r9a59cef171550b5a9cb4f3028520c5d3f9d0c4c0 --- NVDataMgmt.c (.../NVDataMgmt.c) (revision b4e91eb8049e94b0937e341880a90327113fce56) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision 9a59cef171550b5a9cb4f3028520c5d3f9d0c4c0) @@ -219,6 +219,7 @@ static BOOL hasCommandTimedout = FALSE; ///< Boolean flag for timeout of the commands static U32 currentTime = 0; ///< Current time static BOOL calRecordIsValid = FALSE; ///< Flag indicates whether stored calibration record was found to be valid +static volatile BOOL powerOffIsImminent = FALSE; ///< Power off warning has been signaled. Non-volatile memory operations should be completed ASAP and then ceased. // Private functions @@ -283,6 +284,21 @@ } /************************************************************************* + * @brief + * The signalPowerOffWarning signals this module that system power off is \n + * imminent and any non-volatile data writes in progress should be wrapped up \n + * quickly and any pending non-volatile data writes should not be started. + * @details + * Inputs : none + * Outputs : powerOffIsImminent + * @return none + *************************************************************************/ +void signalPowerOffWarning( void ) +{ + powerOffIsImminent = TRUE; +} + +/************************************************************************* * @brief setMfgData * The setMfgData updates the struct that holds the manufacturing data, * calls another function to calculate the CRC for the provided data and @@ -366,10 +382,7 @@ if ( buffer != NULL ) { memcpy ( buffer, (U08*)&calibrationRecord.calData, sizeof(CALIBRATION_DATA_T) ); - if ( TRUE == calRecordIsValid ) - { - status = TRUE; - } + status = calRecordIsValid; } return status; @@ -740,7 +753,7 @@ * @return none *************************************************************************/ void execNVDataMgmt( void ) -{ +{ // TODO - not sure where it should go Dara, but need to look at powerOffIsImminent flag and block queuing of any new jobs, maybe even block starting of any new jobs if flag is set switch ( NVDataMgmtExecState ) { case NVDATAMGMT_EXEC_STATE_WAIT_FOR_POST: