Index: firmware/App/Services/NVRecordsDD.h =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVRecordsDD.h (.../NVRecordsDD.h) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -15,10 +15,18 @@ #ifndef _NV_RECORDS_DD_H_ #define _NV_RECORDS_DD_H_ +#include "Common.h" #include "DDDefs.h" #include "NVDriver.h" -#include "Common.h" +/** + * @defgroup NVRecordsDD NVRecordsDD + * @brief + * + * @addtogroup NVRecordsDD + * @{ + */ + // ********** public definitions ********** #define MAX_TOP_LEVEL_PN_CHARS 10U ///< Max number of characters for top level part number. @@ -27,10 +35,17 @@ #define FLOW_SENSROS_RESERVED_SPACE_COUNT 2 ///< Flow sensors reserved space count. #define TEMP_SENSORS_RESERVED_SPACE_COUNT 2 ///< Temperature sensors reserved space count. #define GENERIC_VOL_RESERVED_SPACE_COUNT 4 ///< Generic volumes reserved space count. - - #define MAX_EEPROM_WRITE_BUFFER_BYTES 16U ///< Max allowed bytes for an EEPROM write (16 bytes). +/// 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; + /// Process records specifications structure typedef struct { @@ -40,11 +55,10 @@ 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). + DD_EVENT_ID_T nvEvent; ///< Jobs non-volatile DD event (i.e calibration, system). } PROCESS_RECORD_SPECS_T; - #ifndef _RELEASE_ /// Software configuration enums typedef enum software_configurations @@ -78,7 +92,7 @@ } SOFTWARE_CONFIG_T; #endif -/// DG available NV data to get +/// DD available NV data to get typedef enum DD_nv_commands { GET_CAL_PRESSURE_SENOSRS = 0, ///< Get pressure sensors calibration data. @@ -105,26 +119,26 @@ NUM_OF_NV_DD_DATA ///< Number of non-volatile data. } NV_DATA_T; -/// DG pressure sensors enumeration. +/// DD pressure sensors enumeration. typedef enum DD_pressure_sensors { - CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, ///< DG calibration data RO pump inlet pressure sensor. - CAL_DATA_RO_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data RO pump outlet pressure sensor. - CAL_DATA_DRAIN_PUMP_INLET_PRES_SENSOR, ///< DG calibration data drain pump inlet pressure sensor. - CAL_DATA_DRAIN_PUMP_OUTLET_PRES_SENSOR, ///< DG calibration data drain pump outlet pressure sensor. - CAL_DATA_BAROMETRIC_PRES_SENSOR, ///< DG calibration data barometric pressure sensor. + CAL_DATA_RO_PUMP_INLET_PRES_SENSOR = 0, ///< DD calibration data RO pump inlet pressure sensor. + CAL_DATA_RO_PUMP_OUTLET_PRES_SENSOR, ///< DD calibration data RO pump outlet pressure sensor. + CAL_DATA_DRAIN_PUMP_INLET_PRES_SENSOR, ///< DD calibration data drain pump inlet pressure sensor. + CAL_DATA_DRAIN_PUMP_OUTLET_PRES_SENSOR, ///< DD calibration data drain pump outlet pressure sensor. + CAL_DATA_BAROMETRIC_PRES_SENSOR, ///< DD calibration data barometric pressure sensor. NUM_OF_CAL_DATA_PRES_SENSORS, ///< Number of calibration data pressure sensors. } CAL_DATA_DD_PRES_SENSORS_T; -/// DG flow sensors enumeration. +/// DD flow sensors enumeration. typedef enum DD_flow_sensors { CAL_DATA_RO_PUMP_FLOW_SENSOR = 0, ///< RO pump flow sensor. CAL_DATA_DIALYSATE_FLOW_SENSOR, ///< RO pump dialysate flow sensor. NUM_OF_CAL_DATA_FLOW_SENSORS, ///< Number of flow sensors. } CAL_DATA_DD_FLOW_SENSORS_T; -/// DG load cells enumeration. +/// DD load cells enumeration. typedef enum DD_load_cells { CAL_DATA_LOAD_CELL_A1 = 0, ///< Load cell A1. @@ -134,7 +148,7 @@ NUM_OF_CAL_DATA_LOAD_CELLS, ///< Number of load cells. } CAL_DATA_DD_LOAD_CELLS_T; -/// DG temperature sensors enumeration. +/// DD temperature sensors enumeration. typedef enum DD_temperature_sensors { CAL_DATA_FPGA_BOARD_TEMP = 0, ///< FPGA board temperature sensor. @@ -143,7 +157,7 @@ CAL_DATA_INTERNAL_THDO_RTD_TEMP, ///< Internal THDO RTC temperature sensor. CAL_DATA_INTERNAL_TDI_RTD_TEMP, ///< Internal TDI RTD temperature sensor. CAL_DATA_INTERNAL_COND_SENSOR_TEMP, ///< Internal conductivity sensor temperature sensor. - CAL_DATA_THERMISTOR_DD_ONBOARD_NTC_TEMP, ///< DG onboard NTC thermistor. + CAL_DATA_THERMISTOR_DD_ONBOARD_NTC_TEMP, ///< DD onboard NTC thermistor. CAL_DATA_THERMISTOR_POWER_SUPPLY_1_TEMP, ///< Power supply 1 thermistor. CAL_DATA_THERMISTOR_POWER_SUPPLY_2_TEMP, ///< Power supply 2 thermistor. CAL_DATA_OUTLET_REDUNDANT_TEMP, ///< Outlet redundant temperature sensor. @@ -158,23 +172,15 @@ NUM_OF_CAL_DATA_TEMP_SENSORS, ///< Number of temperature sensors. } CAL_DATA_DD_TEMP_SENSORS_T; -/// DG pumps enumeration. +/// DD pumps enumeration. typedef enum DD_pumps { CAL_DATA_CONC_PUMP_CP1_ACID = 0, ///< Concentrate pump 1. CAL_DATA_CONC_PUMP_CP2_BICARB, ///< Concentrate pump 2. - NUM_OF_CAL_DATA_DD_CONC_PUMPS ///< Number of DG concentrate pumps. + NUM_OF_CAL_DATA_DD_CONC_PUMPS ///< Number of DD concentrate pumps. } CAL_DATA_DD_PUMPS_T; -/// DG reservoirs enumeration. -typedef enum DD_reservoirs -{ - CAL_DATA_RSRVR_1 = 0, ///< Reservoir 1. - CAL_DATA_RSRVR_2, ///< Reservoir 2. - NUM_OF_CAL_DATA_RSRVRS ///< Number of reservoirs. -} CAL_DATA_DD_RESERVOIRS_T; - -/// DG acid concentrate enumeration. +/// DD acid concentrate enumeration. typedef enum DD_acid_concentrate { CAL_DATA_ACID_CONCENTRATE_1 = 0, ///< Acid concentrate 1. @@ -185,7 +191,7 @@ NUM_OF_CAL_DATA_ACID_CONCENTRATES ///< Number of acid concentrates. } CAL_DATA_DD_ACID_CONCENTRATES_T; -/// DG bicarb concentrate enumeration. +/// DD bicarb concentrate enumeration. typedef enum DD_bicarb_concentrate { CAL_DATA_BICARB_CONCENTRATE_1 = 0, ///< Bicarb concentrate 1. @@ -196,7 +202,7 @@ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ///< Number of bicarb concentrates. } CAL_DATA_DD_BICARB_CONCENTRATES_T; -/// DG fans enumeration. +/// DD fans enumeration. typedef enum DD_fans { CAL_DATA_INLET_FAN_1 = 0, ///< Inlet fan 1. @@ -208,16 +214,16 @@ NUM_OF_CAL_DATA_FANS ///< Number of fans. } CAL_DATA_DD_FANS_T; -/// DG scheduled runs enumeration. +/// DD scheduled runs enumeration. typedef enum DD_scheduled_runs { RUN_FLUSH = 0, ///< Flush run. RUN_HEAT_DISINFECT, ///< Heat disinfect run. RUN_CHEMICAL_DISINFECT, ///< Chemical disinfect run. - NUM_OF_DD_SCHEDULED_RUNS ///< Number of DG scheduled runs. + NUM_OF_DD_SCHEDULED_RUNS ///< Number of DD scheduled runs. } SCHEDULED_DD_RUNS_T; -/// DG usage info items +/// DD usage info items typedef enum DD_usage_items { USAGE_INFO_RO_GEN_WATER = 0, ///< Usage info RO generated water. @@ -231,7 +237,7 @@ NUM_OF_USAGE_INFO_ITEMS ///< Number of usage info items. } DD_USAGE_INFO_ITEMS_T; -/// DG fill conductivity tests +/// DD fill conductivity tests typedef enum DD_conductivity_ops { FILL_COND_NORMAL_OP = 0, ///< Fill conductivity normal operation. @@ -253,7 +259,7 @@ U16 crc; ///< CRC for the polynomial calibration payload. } POLYNOMIAL_CAL_PAYLOAD_T; -/// DG calibration sensor temperature compensation calibration structure +/// DD calibration sensor temperature compensation calibration structure typedef struct { F32 gain; ///< Gain. @@ -263,13 +269,13 @@ U16 crc; ///< CRC for the conductivity sensors temperature compensation cal payload. } DD_COND_SENSOR_TEMP_COMP_CAL_PAYLOAD_T; -/// DG concentrate pumps calibration record +/// DD concentrate pumps calibration record typedef struct { - POLYNOMIAL_CAL_PAYLOAD_T concentratePumps[ NUM_OF_CAL_DATA_DD_CONC_PUMPS ]; ///< DG concentrate pumps calibration data. + POLYNOMIAL_CAL_PAYLOAD_T concentratePumps[ NUM_OF_CAL_DATA_DD_CONC_PUMPS ]; ///< DD concentrate pumps calibration data. } DD_CONC_PUMPS_CAL_RECORD_T; -/// DG drain pump two-gain payload +/// DD drain pump two-gain payload typedef struct { F32 voltage2SpeedRatio; ///< Voltage to speed ratio. @@ -278,14 +284,14 @@ U16 crc; ///< CRC for the drain pump structure. } DD_DRAIN_PUMP_CAL_RECORD_T; -/// DG RO pump calibration structure. +/// DD RO pump calibration structure. typedef struct { F32 gain1Ratio; ///< RO pump gain1 ratio. F32 gain2Ratio; ///< RO pump gain2 ratio. F32 gain3Ratio; ///< RO pump gain3 ratio. U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the DG RO pump calibration structure. + U16 crc; ///< CRC for the DD RO pump calibration structure. } DD_RO_PUMP_CAL_RECORD_T; /// Pressure sensors calibration structure @@ -318,12 +324,12 @@ /// Drain line volume calibration structure typedef struct { - F32 volume; ///< DG Drain line volume. + F32 volume; ///< DD Drain line volume. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC. } DD_DRAIN_LINE_VOLUME_T; -/// DG pre RO purge volume calibration structure +/// DD pre RO purge volume calibration structure typedef struct { F32 pressure2FlowRatio; ///< Pressure to flow ratio. @@ -332,21 +338,21 @@ U16 crc; ///< CRC. } DD_PRE_RO_PURGE_VOLUME_T; -/// DG generic volumes (reserved space) +/// DD generic volumes (reserved space) typedef struct { F32 volume; ///< Volume. U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC. } DD_GENERIC_VOLUME_DATA_T; -/// DG generic volume record +/// DD generic volume record typedef struct { - DD_GENERIC_VOLUME_DATA_T genericVolume[ GENERIC_VOL_RESERVED_SPACE_COUNT ]; ///< DG generic volume record. + DD_GENERIC_VOLUME_DATA_T genericVolume[ GENERIC_VOL_RESERVED_SPACE_COUNT ]; ///< DD generic volume record. }DD_GENERIC_VOLUME_RECORD_T; -/// DG acid concentrate +/// DD acid concentrate typedef struct { F32 acidConcMixRatio; ///< Acid concentrate mix ratio. @@ -357,7 +363,7 @@ U16 crc; ///< CRC. } DD_ACID_CONCENTRATE_T; -/// DG bicarb concentrate +/// DD bicarb concentrate typedef struct { F32 bicarbConcMixRatio; ///< Bicarb concentrate mix ratio. @@ -368,29 +374,29 @@ U16 crc; ///< CRC. } DD_BICARB_CONCENTRATE_T; -/// DG acid concentrates +/// DD acid concentrates typedef struct { - DD_ACID_CONCENTRATE_T acidConcentrate[ NUM_OF_CAL_DATA_ACID_CONCENTRATES ]; ///< DG acid concentrates. + DD_ACID_CONCENTRATE_T acidConcentrate[ NUM_OF_CAL_DATA_ACID_CONCENTRATES ]; ///< DD acid concentrates. } DD_ACID_CONCENTRATES_RECORD_T; -/// DG bicarb concentrates +/// DD bicarb concentrates typedef struct { - DD_BICARB_CONCENTRATE_T bicarbConcentrate[ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ]; ///< DG bicarb concentrates. + DD_BICARB_CONCENTRATE_T bicarbConcentrate[ NUM_OF_CAL_DATA_BICARB_CONCENTRATES ]; ///< DD bicarb concentrates. } DD_BICARB_CONCENTRATES_RECORD_T; -/// DG filter calibration record +/// DD filter calibration record typedef struct { - F32 reservedSpace1; ///< DG filter reserved space 1. - F32 reservedSpace2; ///< DG filter reserved space 2. - F32 reservedSpace3; ///< DG filter reserved space 3 + F32 reservedSpace1; ///< DD filter reserved space 1. + F32 reservedSpace2; ///< DD filter reserved space 2. + F32 reservedSpace3; ///< DD filter reserved space 3 U32 calibrationTime; ///< Calibration time. U16 crc; ///< CRC. } DD_FILTER_CAL_RECORD_T; -/// DG filters calibration data structure +/// DD filters calibration data structure typedef struct { DD_FILTER_CAL_RECORD_T roFilter; ///< RO filter. @@ -400,7 +406,7 @@ DD_FILTER_CAL_RECORD_T carbonPolishFilter; ///< Carbon polish filter. } DD_FILTERS_CAL_RECORD_T; -/// DG fan calibration data structure +/// DD fan calibration data structure typedef struct { F32 reservedSpace1; ///< Reserved space 1. @@ -409,7 +415,7 @@ U16 crc; ///< CRC. } DD_FAN_CAL_RECORD_T; -/// DG fans calibration data structure +/// DD fans calibration data structure typedef struct { DD_FAN_CAL_RECORD_T fans[ NUM_OF_CAL_DATA_FANS ]; ///< Fans calibration record. @@ -418,14 +424,14 @@ /// HD accelerometer sensor calibration record typedef struct { - F32 accelXOffset; ///< DG accelerometer X axis offset. - F32 accelYOffset; ///< DG accelerometer Y axis offset. - F32 accelZOffset; ///< DG accelerometer Z axis offset. + F32 accelXOffset; ///< DD accelerometer X axis offset. + F32 accelYOffset; ///< DD accelerometer Y axis offset. + F32 accelZOffset; ///< DD accelerometer Z axis offset. U32 calibrationTime; ///< Calibration time. - U16 crc; ///< CRC for the DG accelerometer sensor. + U16 crc; ///< CRC for the DD accelerometer sensor. } DD_ACCEL_SENSOR_CAL_RECORD_T; -/// DG heating calibration record +/// DD heating calibration record typedef struct { F32 reservoirTempTauCPerMin; ///< Reservoir temperature Tau C/min. @@ -435,7 +441,7 @@ U16 crc; ///< CRC for the reservoirs and UF record. } DD_HEATING_CAL_RECORD_T; -/// DG acid and bicarb fill conductivity values +/// DD acid and bicarb fill conductivity values typedef struct { F32 acidConduSPerCM; ///< Acid conductivity uS/cm. @@ -444,43 +450,43 @@ U16 crc; ///< CRC for the acid/bicarb fill conductivity values. } DD_ACID_BICARB_FILL_COND_VALUES_T; -/// DG acid and bicarb fill conductivity record +/// DD acid and bicarb fill conductivity record typedef struct { DD_ACID_BICARB_FILL_COND_VALUES_T fillCondValues[ NUM_OF_ACID_TYPE ][ NUM_OF_FILL_COND_TEST ]; ///< Acid and bicarb fill conductivity values. } DD_CHEMICALS_FILL_COND_CAL_RECORD_T; -/// DG systems record structure +/// DD systems record structure typedef struct { - char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DG top level part number. - char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DG top level serial number. - U08 mfgLocation; ///< DG manufacturing location. - U32 mfgDate; ///< DG manufacturing date. - U16 crc; ///< CRC for the DG system record structure. + char topLevelPN[ MAX_TOP_LEVEL_PN_CHARS ]; ///< DD top level part number. + char topLevelSN[ MAX_TOP_LEVEL_SN_CHARS ]; ///< DD top level serial number. + U08 mfgLocation; ///< DD manufacturing location. + U32 mfgDate; ///< DD manufacturing date. + U16 crc; ///< CRC for the DD system record structure. } DD_SYSTEM_RECORD_T; -/// DG scheduled runs record structure +/// DD scheduled runs record structure typedef struct { - U32 lastRunTime; ///< DG scheduled run last run time. - U16 crc; ///< CRC for the DG scheduled run record structure. + U32 lastRunTime; ///< DD scheduled run last run time. + U16 crc; ///< CRC for the DD scheduled run record structure. } DD_SCHEDULED_RUN_T; -/// DG scheduled run record structure +/// DD scheduled run record structure typedef struct { - DD_SCHEDULED_RUN_T ddScheduledRun[ NUM_OF_DD_SCHEDULED_RUNS ]; ///< DG scheduled run. + DD_SCHEDULED_RUN_T ddScheduledRun[ NUM_OF_DD_SCHEDULED_RUNS ]; ///< DD scheduled run. } DD_SCHEDULED_RUN_RECORD_T; -/// DG heaters information structure +/// DD heaters information structure typedef struct { F32 averageFillFlow; ///< Average fill flow rate. } DD_HEATERS_RECORD_T; #ifndef _RELEASE_ -/// DG software configurations +/// DD software configurations typedef struct { U08 swConfigs[ NUM_OF_SW_CONFIGS ]; ///< Software configurations. @@ -502,28 +508,21 @@ 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. + U16 crc; ///< CRC for the DD 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. + U08 serviceLoc; ///< DD service location. + U32 lastServiceEpochDate; ///< DD last service date in epoch. + U32 serviceIntervalSeconds; ///< DD service interval in seconds. U32 lastResetTimeEpoch; ///< Last time the record was reset in epoch. - U16 crc; ///< CRC for the DG service record structure. + U16 crc; ///< CRC for the DD 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; +// ********** public function prototypes ********** void initNVRecordsDD( void ); SELF_TEST_STATUS_T execNVDataMgmtSelfTest ( void ); @@ -535,8 +534,12 @@ BOOL testSetNVRecordCRCOverride( U32 job, U16 crc ); void updateNVSelfTestResult( SELF_TEST_STATUS_T result ); void updateNVSelfTestState( NVDATAMGMT_SELF_TEST_STATE_T state ); +void updateSelfTestReadRecordsFlag ( BOOL value ); + #ifndef _RELEASE_ U08 getSoftwareConfigStatus( SOFTWARE_CONFIG_T config ); #endif +/**@}*/ + #endif /* _NV_RECORDS_DD_H_ */