Index: firmware/App/Services/NVRecordsDD.h =================================================================== diff -u -r1e809a81cb8831f5aa5938bd333cc374920d5b87 -r45b03b9f23005c05fc75f69416595a155e250cbe --- firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 1e809a81cb8831f5aa5938bd333cc374920d5b87) +++ firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) @@ -15,8 +15,9 @@ #ifndef _NV_RECORDS_DD_H_ #define _NV_RECORDS_DD_H_ -#include "Common.h" #include "DDDefs.h" +#include "NVDriver.h" +#include "Common.h" // ********** public definitions ********** @@ -30,6 +31,20 @@ #define MAX_EEPROM_WRITE_BUFFER_BYTES 16U ///< Max allowed bytes for an EEPROM write (16 bytes). +/// Process records specifications structure +typedef struct +{ + U32 startAddress; ///< Jobs spec start address. + U32 sizeofJob; ///< Jobs spec size of job. + U32 maxWriteBufferSize; ///< Jobs max write allowed processing buffer size. + U32 maxReadBufferSize; ///< Jobs max read allowed processing buffer size. + U08* structAddressPtr; ///< Jobs structure address pointer. + U08* structCRCPtr; ///< Jobs structure CRC pointer. + DD_EVENT_ID_T nvEvent; ///< Jobs non-volatile DG event (i.e calibration, system). + +} PROCESS_RECORD_SPECS_T; + + #ifndef _RELEASE_ /// Software configuration enums typedef enum software_configurations @@ -72,10 +87,7 @@ GET_CAL_ACID_CONCENTREATES, ///< Get acid concentrates calibration data. GET_CAL_BICARB_CONCENTRATES, ///< Get bicarb concentrates calibration data. GET_CAL_ACCEL_SENSORS, ///< Get accelerometers calibration data. - GET_CAL_CONDUCTIVITY_SENSORS, ///< Get conductivity sensors calibration data. - GET_CAL_CONDUCTIVITY_SENSORS_TEMP_COMP, ///< Get conductivity sensors temperature compensation calibration data. GET_CAL_TEMP_SENSORS, ///< Get temperature sensors calibration data. - GET_CAL_RSRVRS_VOL_RECORD, ///< Get reservoirs volume record. GET_CAL_HEATING_RECORD, ///< Get heating calibration record. GET_CAL_DRAIN_LINE_VOLUME_RECORD, ///< Get drain line volume record. GET_CAL_RO_PUMP_RECORD, ///< Get RO pump calibration record. @@ -320,23 +332,6 @@ U16 crc; ///< CRC. } DD_PRE_RO_PURGE_VOLUME_T; -/// DG reservoir volume calibration structure -typedef struct -{ - F32 rsrvrVolume; ///< Reservoir volume. - F32 normalFillVolume; ///< Normal fill volume. - F32 maxResidualFluid; ///< Max residual fluid. - F32 rsrvrUnfilledWeight; ///< Reservoir unfilled weight. - U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC. -} DD_RESERVOIR_VOLUME_DATA_T; - -/// DG reservoir volume record -typedef struct -{ - DD_RESERVOIR_VOLUME_DATA_T reservoir[ NUM_OF_CAL_DATA_RSRVRS ]; ///< DG reservoir volume data. -} DD_RESERVOIR_VOLUME_RECORD_T; - /// DG generic volumes (reserved space) typedef struct { @@ -493,10 +488,55 @@ #endif #pragma pack(pop) +#pragma pack(push, 1) +/// DD usage info structure. +typedef struct +{ + F32 roWaterGenTotalL; ///< Total RO water generated in liters. (Cannot be reset) + F32 roWaterGenSinceLastServiceL; ///< RO water generated since last treatment in liters. + U32 lastBasicFlushCompleteDateEpoch; ///< Last basic flush complete date in epoch. + U32 lastChemDisStartDateEpoch; ///< Last chemical disinfect start date in epoch. + U32 lastChemDisCompleteDateEpoch; ///< Last chemical disinfect complete date in epoch. + U32 lastChemDisFlushCompleteDateEpoch; ///< Last chemical disinfect flush complete date in epoch. + U32 lastHeatDisCompleteDateEpoch; ///< Last heat disinfect complete date in epoch. + U32 lastHeatActiveCoolCompleteDateEpoch; ///< Last heat disinfect active cool complete date in epoch. + U32 lastFilterFlushCompleteDateEpoch; ///< Last filter flush complete date in epoch. + U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. + U16 crc; ///< CRC for the DG usage info structure. +} DD_USAGE_INFO_RECORD_T; + +/// DD service record structure +typedef struct +{ + U08 serviceLoc; ///< DG service location. + U32 lastServiceEpochDate; ///< DG last service date in epoch. + U32 serviceIntervalSeconds; ///< DG service interval in seconds. + U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. + U16 crc; ///< CRC for the DG service record structure. +} DD_SERVICE_RECORD_T; +#pragma pack(pop) + +/// NVDataMgmt self-test states enumeration. +typedef enum NVDataMgmt_Self_Test_States +{ + NVDATAMGMT_SELF_TEST_STATE_READ_RECORDS = 0, ///< Self test read records. + NVDATAMGMT_SELF_TEST_STATE_CHECK_CRC, ///< Self test check CRC. + NVDATAMGMT_SELF_TEST_STATE_COMPLETE, ///< Self test complete. + NUM_OF_NVDATAMGMT_SELF_TEST_STATES ///< Total number of self-test states. +} NVDATAMGMT_SELF_TEST_STATE_T; + void initNVRecordsDD( void ); SELF_TEST_STATUS_T execNVDataMgmtSelfTest ( void ); +PROCESS_RECORD_SPECS_T getProcessRecord( RECORD_JOBS_STATE_T job ); void benignPolynomialCalRecord( POLYNOMIAL_CAL_PAYLOAD_T* record ); BOOL setLastDisinfectDate( DD_USAGE_INFO_ITEMS_T disinfect, U32 epochTime ); BOOL setServiceTime( void ); +BOOL getNVRecord2Driver( NV_DATA_T nvData, U08* bufferAddress, U32 bufferLength, U08 numOfSnsrs2Check, ALARM_ID_T nvAlarm ); +BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ); +void updateNVSelfTestResult( SELF_TEST_STATUS_T result ); +void updateNVSelfTestState( NVDATAMGMT_SELF_TEST_STATE_T state ); +#ifndef _RELEASE_ +U08 getSoftwareConfigStatus( SOFTWARE_CONFIG_T config ); +#endif #endif /* _NV_RECORDS_DD_H_ */