Index: firmware/App/Drivers/NVDriver.c =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Drivers/NVDriver.c (.../NVDriver.c) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Drivers/NVDriver.c (.../NVDriver.c) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -11,11 +11,19 @@ * @date (original) 31-Mar-2026 * ***************************************************************************/ -#include "system.h" // For fapi operations + #include "F021.h" // For fapi operations #include "FapiFunctions.h" #include "NVDriver.h" +#include "system.h" // For fapi operations +/** + * @addtogroup NVDriver + * @{ + */ + +// ********** private definitions ********** + // The clock frequency comes from HCLK_FREQ and it has to be rounded up to the nearest number #define ROUNDED_HCLK_FREQ FLOAT_TO_INT_WITH_ROUND(HCLK_FREQ) ///< Rounded HCLK for EERPOM clock. #define BANK7_SECTOR_0_31_ENABLE_BIT_MASK 0x0000000F ///< Bank7 sector 0 t0 31 enable mask. @@ -59,3 +67,6 @@ { return (Fapi_Status_FsmReady == FAPI_CHECK_FSM_READY_BUSY); } + +/**@}*/ + Index: firmware/App/Drivers/NVDriver.h =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Drivers/NVDriver.h (.../NVDriver.h) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Drivers/NVDriver.h (.../NVDriver.h) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -17,8 +17,23 @@ #include "Common.h" +/** + * @defgroup NVDriver NVDriver + * @brief + * + * @addtogroup NVDriver + * @{ + */ + +// ********** public definitions ********** + #define BANK7_SECTOR0_START_ADDRESS 0xF0200000 ///< Bank7 sector 0 start address. +#ifndef _RELEASE_ +#define SW_CONFIG_ENABLE_VALUE 1 ///< Software configuration enable. +#define SW_CONFIG_DISABLE_VALUE 0 ///< Software configuration disable. +#endif + /// NVDataMgmt memory operation modes enumeration. typedef enum NVDataMgmt_Operation { @@ -51,10 +66,14 @@ RECORD_JOBS_STATE_T recordJob; ///< Record job (i.e sector 0). } PROCESS_RECORD_JOB_T; +// ********** public function prototypes ********** + void initNVDriver( void ); void eraseSector( U32* startAddress ); void writeSector( U32* startAddress, U08* bufferAddress, U32 bufferSize ); void readSector( U32* startAddress, U32* bufferAddress, U32 bufferSize ); BOOL isFlashReady( void ); +/**@}*/ + #endif /* _NV_DRIVER_H */ Index: firmware/App/Services/NVMgmtDD.c =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVMgmtDD.c (.../NVMgmtDD.c) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVMgmtDD.c (.../NVMgmtDD.c) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -11,6 +11,7 @@ * @date (original) 31-Mar-2026 * ***************************************************************************/ + #include // For memcpy #include "Common.h" #include "NVDriver.h" @@ -19,6 +20,17 @@ #include "NVRecordsDD.h" #include "Timers.h" +/** + * @addtogroup NVMgmtDD + * @{ + */ + +// ********** private definitions ********** + +#define COMMAND_TIME_OUT (1 * MS_PER_SECOND) ///< Timeout for an EEPROM or RTC command in ms. +/// EEPROM functions use the buffer length as the size of U32. So before send the length to any of FAPI functions, it should be divided by 4. +#define EEPROM_OPS_SIZE_OF_CONVERTER 4 + /// NVDataMgmt Exec states enumeration. typedef enum NVDataMgmt_Exec_State { @@ -39,9 +51,7 @@ NUM_OF_NVDATAMGMT_RECORD_VALIDITY_CHECK ///< Number of NVDataMgmt validity check states. } RECORD_VALIDITY_CHECK_T; -#define COMMAND_TIME_OUT (1 * MS_PER_SECOND) ///< Timeout for an EEPROM or RTC command in ms. -/// EEPROM functions use the buffer length as the size of U32. So before send the length to any of FAPI functions, it should be divided by 4. -#define EEPROM_OPS_SIZE_OF_CONVERTER 4 +// ********** private data ********** static NVDATAMGMT_EXEC_STATE_T nvDataMgmtExecState; ///< NVDataMgmt exec state variable. static volatile BOOL powerOffIsImminent; ///< Power off warning has been signaled. Non-volatile memory operations should be completed ASAP and then ceased. @@ -50,6 +60,8 @@ static U32 currentTime; ///< Current time. static U32 recordAddressOffset; ///< Record address offset. +// ********** private function prototypes ********** + // Exec functions static NVDATAMGMT_EXEC_STATE_T handleExecIdleState( void ); static NVDATAMGMT_EXEC_STATE_T handleExecEraseState( void ); @@ -71,6 +83,7 @@ initNVDriver(); initNVMsgQ(); + initNVRecordsDD(); enqueuePOSTReadRecords(); } @@ -193,6 +206,16 @@ } + // Update Self Test Read Records Flag + if ( ( TRUE == isRecordQueueEmpty() ) && ( state == NVDATAMGMT_EXEC_STATE_IDLE ) ) + { + updateSelfTestReadRecordsFlag( TRUE ); + } + else + { + updateSelfTestReadRecordsFlag( FALSE ); + } + return state; } @@ -375,11 +398,6 @@ updateNVSelfTestState( NVDATAMGMT_SELF_TEST_STATE_READ_RECORDS ); } -BOOL isNVExecStateIdle ( void ) -{ - return ( NVDATAMGMT_EXEC_STATE_IDLE == nvDataMgmtExecState ); -} - /*********************************************************************//** * @brief * The didCommandTimedout checks whether the a command whether RTC RAM or @@ -403,6 +421,4 @@ return status; } - - - +/**@}*/ Index: firmware/App/Services/NVMgmtDD.h =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVMgmtDD.h (.../NVMgmtDD.h) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVMgmtDD.h (.../NVMgmtDD.h) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -18,15 +18,21 @@ #include "AlarmDefs.h" #include "NVRecordsDD.h" -#ifndef _RELEASE_ -#define SW_CONFIG_ENABLE_VALUE 1 ///< Software configuration enable. -#define SW_CONFIG_DISABLE_VALUE 0 ///< Software configuration disable. -#endif +/** + * @defgroup NVMgmtDD NVMgmtDD + * @brief + * + * @addtogroup NVMgmtDD + * @{ + */ +// ********** public function prototypes ********** + void initNVMgmtDD( void ); void signalPowerOffWarning( void ); void execNVDataMgmt( void ); void resetNVDataMgmtPOSTState( void ); -BOOL isNVExecStateIdle ( void ); +/**@}*/ + #endif /* _NV_MGMT_DD_H_ */ Index: firmware/App/Services/NVMsgQ.c =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVMsgQ.c (.../NVMsgQ.c) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVMsgQ.c (.../NVMsgQ.c) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -14,14 +14,20 @@ #include // For memcpy #include // For ceilf function - #include "Common.h" #include "NVMsgQ.h" #include "NVRecordsDD.h" #include "TaskGeneral.h" #include "Timers.h" #include "Utilities.h" // For crc calculation +/** + * @addtogroup NVMsgQ + * @{ + */ + +// ********** private definitions ********** + #define QUEUE_MAX_SIZE 20U ///< Max queue size. #define QUEUE_START_INDEX 0U ///< Queue start index. #define MAX_JOB_DATA_SIZE_BYTES 32U ///< Max bytes per job (32 bytes). @@ -33,14 +39,6 @@ // Once a new calibration data is available the driver, sets a signal for the defined time. Once the time is out, it turns the signal off. #define NEW_CAL_AVAILABLE_SIGNAL_TIMEOUT_MS (1 * MS_PER_SECOND) ///< New calibration available signal timeout in milliseconds. -/// Memory operations structure. -typedef struct -{ - NVDATAMGMT_OPERATION_STATE_T memoryOperation; ///< Memory operation. - U32 startAddress; ///< Operation start address. - U08 buffer[ MAX_JOB_DATA_SIZE_BYTES ]; ///< Buffer. - U32 length; ///< Length of a buffer. -} MEMORY_OPS_T; /// NVDataMgmt process records states typedef enum NVDataMgmt_Process_Records_States @@ -50,6 +48,15 @@ NUM_OF_NVDATAMGMT_PROCESS_RECORD_STATES ///< Number of NVDataMgmt process records state. } PROCESS_RECORD_STATE_T; +/// Memory operations structure. +typedef struct +{ + NVDATAMGMT_OPERATION_STATE_T memoryOperation; ///< Memory operation. + U32 startAddress; ///< Operation start address. + U08 buffer[ MAX_JOB_DATA_SIZE_BYTES ]; ///< Buffer. + U32 length; ///< Length of a buffer. +} MEMORY_OPS_T; + /// NVDataMgmt receive records states typedef enum NVDataMgmt_Receive_Records_States { @@ -58,6 +65,8 @@ NUM_OF_NVDATAMGMT_RECEIVE_RECORD_STATES ///< Number of NVDataMgmt receive record. } RECEIVE_RECORD_STATE_T; +// ********** private data ********** + static PROCESS_RECORD_JOB_T recordJobQueue[ QUEUE_MAX_SIZE ]; ///< Record queue jobs. static U08 recordQueueRearIndex; ///< Record queue rear index. static U08 recordQueueFrontIndex; ///< Record queue front index. @@ -79,10 +88,11 @@ static U32 recordReceiveStartTime; ///< Time stamp the calibration/service was received. static U32 newCalStartTimer; ///< New calibration availability start timer. +// ********** private function prototypes ********** + // Process record functions static PROCESS_RECORD_STATE_T handleExecProcessRecordIdleState( void ); static PROCESS_RECORD_STATE_T handleExecProcessRecordSendRecordState( void ); - static void monitorNewCalSignal( void ); void initNVMsgQ ( void ) @@ -594,3 +604,5 @@ { return recordCurrentJob; } + +/**@}*/ Index: firmware/App/Services/NVMsgQ.h =================================================================== diff -u -r45b03b9f23005c05fc75f69416595a155e250cbe -r43e60a63eae841e599ff9106f43177a8f63d22be --- firmware/App/Services/NVMsgQ.h (.../NVMsgQ.h) (revision 45b03b9f23005c05fc75f69416595a155e250cbe) +++ firmware/App/Services/NVMsgQ.h (.../NVMsgQ.h) (revision 43e60a63eae841e599ff9106f43177a8f63d22be) @@ -15,10 +15,20 @@ #ifndef _NV_MSG_Q_H_ #define _NV_MSG_Q_H_ -#include "NVDriver.h" #include "Common.h" #include "DDDefs.h" +#include "NVDriver.h" +/** + * @defgroup NVMsgQ NVMsgQ + * @brief + * + * @addtogroup NVMsgQ + * @{ + */ + +// ********** public definitions ********** + #define MIN_JOBS_NEEDED_FOR_SECTOR_0 5U ///< Min queue count needed to erase and write all (5) records back in sector 0. #define DD_USAGE_INFO_START_ADDRESS 0x00000030 /* 48 */ ///< DG usage info start address in RTC RAM (48). #define DD_SCHEDULED_RUNS_START_ADDRESS (DD_USAGE_INFO_START_ADDRESS + sizeof(DD_SERVICE_GROUP_T)) ///< DG scheduled runs start address in RTC RAM. @@ -39,6 +49,8 @@ NUM_OF_NVDATAMGMT_READ_RECORDS_STATES, ///< Number of NVDataMgmt read records states. } NVDATAMGMT_RECORDS_READ_STATUS_T; +// ********** public function prototypes ********** + void initNVMsgQ ( void ); void execNVDataMgmtProcessRecord( void ); @@ -61,4 +73,6 @@ PROCESS_RECORD_JOB_T getCurrentProcessRecordJob ( void ); +/**@}*/ + #endif /* _NV_MSG_Q_H_ */ 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 + +/**@}*/ + 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_ */