Index: NVDataMgmt.c =================================================================== diff -u -rb840bc23aace9db7e7949aed313c4c315966aabd -rff5e595afd7ad79dd7693dfa598b24fdeacad95d --- NVDataMgmt.c (.../NVDataMgmt.c) (revision b840bc23aace9db7e7949aed313c4c315966aabd) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision ff5e595afd7ad79dd7693dfa598b24fdeacad95d) @@ -18,7 +18,7 @@ // Includes #include // For memcpy -#include // For ceil function +#include // For ceilf function #include "system.h" #include "F021.h" @@ -75,21 +75,18 @@ #define MAX_NUM_OF_EVENTS_IN_SECTOR1 ((MAX_NUM_OF_SECTORS_FOR_LOG_DATA - 2) * MAX_LOG_DATA_PER_SECTOR) ///< Max number of accumulated logs in sector 1 (512). // Data addresses and length in RTC RAM -#define BOOTLOADER_FLAG_ADDRESS 0x00000000 ///< Bootloader start address in RTC RAM (0). -#define BOOTLOADER_FLAG_LENGTH_BYTES 4U ///< Bootloader number of bytes (4 bytes). -#define LOG_RECORD_START_ADDRESS 0x00000010 // 16 ///< Log record start address in RTC RAM (16). -#define HD_TREATMENT_TIME_ADDRESS 0X00000030 // 48 ///< HD treatment time start address in RTC RAM (48). -#define DG_CONSUMED_WATER_ADDRESS 0X00000040 // 64 ///< DG water consumption start address in RTC RAM (64). -#define SERVICE_RECORD_START_ADDRESS 0X00000050 // 80 ///< Last service date record start address in RTC RAM (HD/DG) (80). -#define LAST_DISINFECTION_DATE_ADDRESS 0x00000060 // 96 //TODO remove ///< Last disinfection date start address in RTC RAM (96). -#define DG_SCHEDULED_RUNS_START_ADDRESS 0x00000070 // 112 ///< DG scheduler record start address in RTC RAM (112). +#define LOG_RECORD_START_ADDRESS 0x00000000 // 0 ///< Log record start address in RTC RAM (0). +#define HD_TREATMENT_TIME_ADDRESS 0x00000010 // 16 ///< HD treatment time start address in RTC RAM (16). +#define DG_CONSUMED_WATER_ADDRESS 0x00000020 // 32 ///< DG water consumption start address in RTC RAM (32). +#define SERVICE_RECORD_START_ADDRESS 0x00000030 // 48 ///< Service date record start address in RTC RAM (HD/DG) (48). +#define DG_SCHEDULED_RUNS_START_ADDRESS (SERVICE_RECORD_START_ADDRESS + MAX_RTC_RAM_OPS_BUFFER_BYTES) ///< DG scheduled runs start address in RTC RAM. // Data addresses in EEPROM -#define CALIBRATION_RECORD_START_ADDRESS ( BANK7_SECTOR0_START_ADDRESS + sizeof(MFG_RECORD_T) ) ///< Calibration record start address in EEPROM. +#define CALIBRATION_RECORD_START_ADDRESS (BANK7_SECTOR0_START_ADDRESS + sizeof(MFG_RECORD_T)) //TODO remove ///< Calibration record start address in EEPROM. -#define COMMAND_TIME_OUT 500U // time in ms ///< Timeout for an EEPROM or RTC command in ms. +#define COMMAND_TIME_OUT 500U ///< Timeout for an EEPROM or RTC command in ms. -#define ERASE_CALIBRATION_KEY 0xD2C3B4A5 ///< 32-bit key required for clearing calibration data. +#define ERASE_CALIBRATION_KEY 0xD2C3B4A5 ///< 32-bit key required for clearing calibration data. // ********** Calibration data defines ********** #define NUM_OF_BYTES_PER_CAL_PAYLOAD 150U ///< Number of bytes per calibration payload. @@ -99,10 +96,10 @@ #define RECORD_DATA_FIRST_RECEIVING_MSG_NUM 1 ///< Calibration data first receiving message number. #define SYSTEM_DATA_NV_MEM_START_ADDRESS BANK7_SECTOR0_START_ADDRESS + 2048 ///< System record storage start address in NV memory. -#define RECORD_BYTE_SIZE(r) ( sizeof(r) + sizeof(U16) ) ///< Record byte size macro. +#define RECORD_BYTE_SIZE(r) (sizeof(r) + sizeof(U16)) ///< Record byte size macro. // Padding length calculation: (DG struct size % bytes to write(16) == 0 ? 0 : (DG struct size / bytes to write(16)) + 1) * bytes to write(16) /// DG padding length macro that is calculated with the size of the provided structure. -#define RECORD_PADDING_LENGTH(rcrd, buf) ( RECORD_BYTE_SIZE(rcrd) % buf == 0 ? 0 : ( (U32)(RECORD_BYTE_SIZE(rcrd) / buf) + 1 ) ) * buf +#define RECORD_PADDING_LENGTH(rcrd, buf) (RECORD_BYTE_SIZE(rcrd) % buf == 0 ? 0 : ((U32)(RECORD_BYTE_SIZE(rcrd) / buf) + 1)) * buf /// NVDataMgmt self-test states enumeration. typedef enum NVDataMgmt_Self_Test_States @@ -259,21 +256,6 @@ U16 crc; ///< Water consumption CRC } WATER_CONSUMPTION_RECORD_T; -/// Manufacturing data structure. -typedef struct -{ - MFG_DATA_T mfgData; ///< Manufacturing data struct - U16 crc; ///< Manufacturing data CRC - U08 Padding[ 0x30 - sizeof(MFG_DATA_T) - sizeof(U16) ]; ///< Padding for reserved mfg data space -} MFG_RECORD_T; - -/// Service record structure. -typedef struct -{ - SERVICE_DATA_T serviceData; ///< Service date struct - U16 crc; ///< Service data CRC -} SERVICE_RECORD_T; - /// Calibration record structure. typedef struct { @@ -282,15 +264,8 @@ U08 Padding[ 0x50 - sizeof(CALIBRATION_DATA_T) - sizeof(U16) ]; ///< Padding for reserved cal data space } CALIBRATION_RECORD_T; //TODO remove -/// Last disinfection record structure. -typedef struct -{ - DISINFECTION_DATE_T date; ///< Disinfection date (char array) - U16 crc; ///< Disinfection date CRC -} LAST_DISINFECTION_RECORD_T; +// ********** HD/DG record structures ********** -// ********** Calibration data structures ********** - /// DG calibration groups structure typedef struct { @@ -299,12 +274,12 @@ DG_LOAD_CELLS_CAL_RECORD_T loadCellsCalRecord; ///< DG load cells. DG_TEMP_SENSORS_CAL_RECORD_T tempSensorsCalRecord; ///< DG temperature sensors. DG_COND_SENSORS_CAL_RECORD_T condSensorsCalRecord; ///< DG conductivity sensors. - DG_CONC_PUMPS_CAL_RECORD_T concentratePump[ NUM_OF_CONCENTRATE_PUMPS ]; ///< DG concentrate pumps. + DG_CONC_PUMPS_CAL_RECORD_T concentratePumps; ///< DG concentrate pumps. DG_DRAIN_PUMP_CAL_RECORD_T drainPump; ///< DG drain pump. DG_RO_PUMP_CAL_RECORD_T roPump; ///< DG RO pump. DG_DRAIN_LINE_VOLUME_T drainLineVolume; ///< DG drain line volume. DG_PRE_RO_PURGE_VOLUME_T preROPurgeVolume; ///< DG RO purge volume. - DG_RESERVOIR_VOLUME_T reservoir[ NUM_OF_CAL_DATA_RSRVRS ]; ///< DG reservoirs volume. + DG_RESERVOIR_VOLUME_RECORD_T reservoirVolumes; ///< DG reservoir volumes. DG_GENERIC_VOLUME_T genericVolume[ 4 ]; ///< DG generic volume (magic number because the value is unknown). DG_ACID_CONCENTRATES_T acidConcentrates; ///< DG acid concentrates. DG_BICARB_CONCENTRATES_T bicarbConcentrates; ///< DG bicarb concentrates. @@ -356,7 +331,7 @@ typedef struct { - HD_CALIBRATION_GROUPS_T hdCalibratiobGroups; + HD_CALIBRATION_GROUPS_T hdCalibrationGroups; } HD_CALIBRATION_RECORD_T; #pragma pack(pop) @@ -403,17 +378,13 @@ static LOG_RECORD_T logRecord; ///< Log record variable. static TREATMENT_TIME_RECORD_T treatmentTimeRecord; ///< Treatment time record. static WATER_CONSUMPTION_RECORD_T waterConsumptionRecord; ///< Water consumption record. -static MFG_RECORD_T mfgRecord; ///< Manufacturing record. static CALIBRATION_RECORD_T calibrationRecord; ///< Calibration record. -static SERVICE_RECORD_T serviceRecord; ///< Service record. -static LAST_DISINFECTION_RECORD_T lastDisinfectionRecord; ///< Disinfection record. static U08 queueRearIndex = QUEUE_START_INDEX; ///< Queue rear index. static U08 queueFrontIndex = QUEUE_START_INDEX; ///< Queue front index. static U08 queueCount = 0; ///< Queue count. static NVDATAMGMT_SELF_TEST_STATE_T NVDataMgmtSelfTestState = NVDATAMGMT_SELF_TEST_STATE_START; ///< NVDataMgmt self-test state variable. static NVDATAMGMT_EXEC_STATE_T NVDataMgmtExecState = NVDATAMGMT_EXEC_STATE_WAIT_FOR_POST; ///< NVDataMgmt exec state variable. static SELF_TEST_STATUS_T NVDataMgmtSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< NVDataMgmt self-test result. -static U32 bootloaderFlag = 0; ///< Bootloader flag. 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. @@ -1132,63 +1103,196 @@ /*********************************************************************//** * @brief * The getDGPressureSensorsCalibrationRecord function returns the DG pressure - * sensors structure. + * sensors record. * @details Inputs: none * @details Outputs: none - * @return DG pressure sensors calibration structure + * @return DG pressure sensors calibration record *************************************************************************/ DG_PRES_SENSORS_CAL_RECORD_T getDGPressureSensorsCalibrationRecord( void ) { return dgCalibrationRecord.dgCalibrationGroups.presSensorsCalRecord; } -void getDGFlowSensorsCalibrationRecord( U08* buffer ) +/*********************************************************************//** + * @brief + * The getDGFlowSensorsCalibrationRecord function returns the DG flow + * sensors record. + * @details Inputs: none + * @details Outputs: none + * @return DG flow sensors calibration record + *************************************************************************/ + +DG_FLOW_SENSORS_CAL_RECORD_T getDGFlowSensorsCalibrationRecord( void ) { - //memcpy( buffer, &dgCalibrationRecord.flowSensorsCalRecord, sizeof(dgCalibrationRecord.condSensorsCalRecord)); + return dgCalibrationRecord.dgCalibrationGroups.flowSensorsCalRecord; } /*********************************************************************//** * @brief - * The setMfgData updates the structure that holds the manufacturing data, - * calls another function to calculate the CRC for the provided data and - * calls another function to erase sector 0 and write the new manufacturing - * data. - * @details Inputs: mfgRecord - * @details Outputs: mfgRecord - * @return TRUE is the enqueue was successfully scheduled + * The getDGLoadCellsCalibrationRecord function returns the DG load cells + * record. + * @details Inputs: none + * @details Outputs: none + * @return DG load cells calibration record *************************************************************************/ -BOOL setMfgData ( MFG_DATA_T data ) +DG_LOAD_CELLS_CAL_RECORD_T getDGLoadCellsCalibrationRecord( void ) { - mfgRecord.mfgData = data; - mfgRecord.crc = crc16 ( (U08*)&mfgRecord.mfgData, sizeof(MFG_DATA_T) ); - BOOL status = enqueueBank7Sector0Records(); - return status; + return dgCalibrationRecord.dgCalibrationGroups.loadCellsCalRecord; } /*********************************************************************//** * @brief - * The getMfgData returns the data in the structure that holds manufacturing - * record to buffer that the caller has provided. - * @details Inputs: mfgRecord + * The getDGTemperatureSensorsCalibrationRecord function returns the DG + * temperature sensors calibration record. + * @details Inputs: none * @details Outputs: none - * @param buffer address of manufacturing data buffer - * @return TRUE if the buffer pointer was not null and the copy was successful + * @return DG temperature sensors calibration record *************************************************************************/ -BOOL getMfgData ( MFG_DATA_T* buffer ) +DG_TEMP_SENSORS_CAL_RECORD_T getDGTemperatureSensorsCalibrationRecord( void ) { - BOOL status = FALSE; + return dgCalibrationRecord.dgCalibrationGroups.tempSensorsCalRecord; +} - if ( buffer != NULL ) - { - memcpy ( buffer, (U08*)&mfgRecord.mfgData, sizeof(MFG_DATA_T) ); - status = TRUE; - } +/*********************************************************************//** + * @brief + * The getDGConducitivitySensorsCalibrationRecord function returns the DG + * conductivity sensors calibration record. + * @details Inputs: none + * @details Outputs: none + * @return DG conductivity sensors calibration record + *************************************************************************/ +DG_COND_SENSORS_CAL_RECORD_T getDGConducitivitySensorsCalibrationRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.condSensorsCalRecord; +} - return status; +/*********************************************************************//** + * @brief + * The getDGDrainLineVolumeRecord function returns the DG drain volume + * record. + * @details Inputs: none + * @details Outputs: none + * @return DG drain volume record + *************************************************************************/ +DG_DRAIN_LINE_VOLUME_T getDGDrainLineVolumeRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.drainLineVolume; } /*********************************************************************//** * @brief + * The getDGPreROPurgeVolumeRecord function returns the DG pre RO purge + * volume record. + * @details Inputs: none + * @details Outputs: none + * @return DG pre RO purge volume record + *************************************************************************/ +DG_PRE_RO_PURGE_VOLUME_T getDGPreROPurgeVolumeRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.preROPurgeVolume; +} + +/*********************************************************************//** + * @brief + * The getDGReservoirsVolumeRecord function returns the DG reservoirs + * volume record. + * @details Inputs: none + * @details Outputs: none + * @return DG reservoirs volume record + *************************************************************************/ +DG_RESERVOIR_VOLUME_RECORD_T getDGReservoirVolumeRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.reservoirVolumes; +} + +/*********************************************************************//** + * @brief + * The getDGAcidConcentratesRecord function returns the DG acid concentrates + * record. + * @details Inputs: none + * @details Outputs: none + * @return DG acid concentrates record + *************************************************************************/ +DG_ACID_CONCENTRATES_T getDGAcidConcentratesRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.acidConcentrates; +} + +/*********************************************************************//** + * @brief + * The getDGBicarbConcentratesRecord function returns the DG bicarb concentrates + * record. + * @details Inputs: none + * @details Outputs: none + * @return DG bicarb concentrates record + *************************************************************************/ +DG_BICARB_CONCENTRATES_T getDGBicarbConcentratesRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.bicarbConcentrates; +} + +/*********************************************************************//** + * @brief + * The getDGFiltersRecord function returns the DG filters record. + * @details Inputs: none + * @details Outputs: none + * @return DG filters record + *************************************************************************/ +DG_FILTERS_CAL_RECORD_T getDGFiltersRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.filters; +} + +/*********************************************************************//** + * @brief + * The getDGFansRecord function returns the DG fans record. + * @details Inputs: none + * @details Outputs: none + * @return DG fans record + *************************************************************************/ +DG_FANS_CAL_RECORD_T getDGFansRecord( void ) +{ + return dgCalibrationRecord.dgCalibrationGroups.fans; +} + +/*********************************************************************//** + * @brief + * The getDGSystemRecord function returns the DG systems record. + * @details Inputs: none + * @details Outputs: none + * @return DG systems record + *************************************************************************/ +DG_SYSTEM_RECORD_T getDGSystemRecord( void ) +{ + return dgSystemGroup.dgSystemRecord; +} + +/*********************************************************************//** + * @brief + * The getDGServiceRecord function returns the DG service record. + * @details Inputs: none + * @details Outputs: none + * @return DG service record + *************************************************************************/ +DG_SERVICE_RECORD_T getDGServiceRecord( void ) +{ + return dgServiceGroup.dgServiceRecord; +} + +/*********************************************************************//** + * @brief + * The getDGScheduledRunRecord function returns the DG scheduled runs record. + * @details Inputs: none + * @details Outputs: none + * @return DG scheduled runs record + *************************************************************************/ +DG_SCHEDULED_RUN_RECORD_T getDGScheduledRunRecord( void ) +{ + return dgScheduledRunGroup.dgScheduledRun; +} + +/*********************************************************************//** + * @brief * The setCalibrationData updates the structure that holds the calibration data, * calls another function to calculate the CRC for the provided data and * calls another function to erase sector 0 and write the new manufacturing @@ -1266,54 +1370,6 @@ /*********************************************************************//** * @brief - * The setServiceDate updates the structure that holds the calibration data, - * calls another function to calculate the CRC for the provided data if - * there is enough queues available, it schedules a write to RTC RAM. - * @details Inputs: serviceRecord - * @details Outputs: serviceRecord - * @param data service data buffer - * @return TRUE if the queue had enough space to schedule the job - *************************************************************************/ -BOOL setServiceDate ( SERVICE_DATA_T data ) -{ - BOOL status = FALSE; - serviceRecord.serviceData = data; - serviceRecord.crc = crc16 ( (U08*)&serviceRecord.serviceData, sizeof(SERVICE_DATA_T) ); - - if ( !isQueueFull() ) - { - //enqueue( NVDATAMGMT_WRITE, NVDATAMGMT_RTC, SERVICE_DATE_START_ADDRESS, - // (U08*)&serviceRecord, 0, sizeof(SERVICE_RECORD_T) ); - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The getServiceDate returns the data in the structure that holds service - * date to buffer that the caller has provided. - * @details Inputs: serviceRecord - * @details Outputs: none - * @param buffer address of service data buffer - * @return TRUE if the buffer address was not null - *************************************************************************/ -BOOL getServiceDate ( SERVICE_DATA_T* buffer ) -{ - BOOL status = FALSE; - - if ( buffer != NULL ) - { - memcpy ( buffer, (U08*)&serviceRecord.serviceData, sizeof(SERVICE_DATA_T) ); - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief * The writeLogData checks if the queue is not full and if it is not, it calls * enqueue to schedule a job for writing the log data. * @details Inputs: logRecord @@ -1436,88 +1492,6 @@ /*********************************************************************//** * @brief - * The setDisinfectionDate gets the last disinfection date, calculates the - * CRC for it and if the queue is not full, it schedules a write to RTC RAM - * to store the last date. - * @details Inputs: lastDisinfectionRecord - * @details Outputs: lastDisinfectionRecord - * @param date disinfection date buffer - * @return TRUE if the queue was not full - *************************************************************************/ -BOOL setDisinfectionDate ( DISINFECTION_DATE_T date ) -{ - BOOL status = FALSE; - memcpy ( lastDisinfectionRecord.date.disinfectionDate, date.disinfectionDate, sizeof(DISINFECTION_DATE_T) ); - lastDisinfectionRecord.crc = crc16 ( (U08*)&lastDisinfectionRecord.date.disinfectionDate, sizeof(DISINFECTION_DATE_T) ); - - if ( !isQueueFull() ) - { - enqueue( NVDATAMGMT_WRITE, NVDATAMGMT_RTC, LAST_DISINFECTION_DATE_ADDRESS, - (U08*)&lastDisinfectionRecord, 0, sizeof(LAST_DISINFECTION_RECORD_T) ); - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The getDisinfectionDate populates the provided buffer with the last - * disinfection date. - * @details Inputs: lastDisinfectionRecord - * @details Outputs: none - * @param buffer address of disinfection date buffer - * @return TRUE if the buffer address was not null - *************************************************************************/ -BOOL getDisinfectionDate ( DISINFECTION_DATE_T* buffer ) -{ - BOOL status = FALSE; - - if ( buffer != NULL ) - { - memcpy ( buffer, lastDisinfectionRecord.date.disinfectionDate, sizeof(DISINFECTION_DATE_T) ); - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The setBootloaderFlag sets the bootloader flag to RTC RAM. - * @details Inputs: none - * @details Outputs: none - * @param flag the bootloader flag - * @return TRUE if the queue was not full - *************************************************************************/ -BOOL setBootloaderFlag ( U32 flag ) -{ - BOOL status = FALSE; - - if ( !isQueueFull() ) - { - enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_RTC, BOOTLOADER_FLAG_ADDRESS, - (U08*)&flag, 0, BOOTLOADER_FLAG_LENGTH_BYTES ); - status = TRUE; - } - - return status; -} - -/*********************************************************************//** - * @brief - * The getBootloaderFlag gets the bootloader flag from RTC RAM. - * @details Inputs: none - * @details Outputs: none - * @return bootloader flag as a U32 - *************************************************************************/ -U32 getBootloaderFlag( void ) -{ - return bootloaderFlag; -} - -/*********************************************************************//** - * @brief * The handleSelfTestStart enables the EEPROM bank sectors. * @details Inputs: currentTime * @details Outputs: currentTime @@ -1553,7 +1527,7 @@ // Enable was successful, Request a read for bootloader if ( getRTCRAMState() == RTC_RAM_STATE_READY ) { - readFromRAM( BOOTLOADER_FLAG_ADDRESS, BOOTLOADER_FLAG_LENGTH_BYTES ); + //readFromRAM( BOOTLOADER_FLAG_ADDRESS, BOOTLOADER_FLAG_LENGTH_BYTES ); // Get the time to check for timeout currentTime = getMSTimerCount(); state = NVDATAMGMT_SELF_TEST_STATE_READ_BOOTLOADER_FLAG; @@ -1579,7 +1553,7 @@ // If the read for bootloader is done, read it if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - getDataFromRAM( (U08*)&bootloaderFlag, BOOTLOADER_FLAG_LENGTH_BYTES ); + //getDataFromRAM( (U08*)&bootloaderFlag, BOOTLOADER_FLAG_LENGTH_BYTES ); // If the device is HD, read treatment time, // If the device is DG, read water consumption #ifdef _HD_ @@ -1674,14 +1648,14 @@ // If the RAM is in Idle, read the log records if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - U32 len = sizeof(MFG_RECORD_T) / sizeof(U32); - U32 *addr = (U32*)&mfgRecord; + //U32 len = sizeof(MFG_RECORD_T) / sizeof(U32); + //U32 *addr = (U32*)&mfgRecord; getDataFromRAM ( (U08*)&logRecord, sizeof(LOG_RECORD_T) ); currentTime = getMSTimerCount(); // Get ready for reading the manufacturing record - Fapi_doMarginRead( (U32*)BANK7_SECTOR0_START_ADDRESS, addr, len, Fapi_NormalRead ); + //Fapi_doMarginRead( (U32*)BANK7_SECTOR0_START_ADDRESS, addr, len, Fapi_NormalRead ); state = NVDATAMGMT_SELF_TEST_STATE_READ_MFG_RECORD; } @@ -1706,8 +1680,8 @@ { currentTime = getMSTimerCount(); // Send the read command for calibration record - Fapi_doMarginRead ( (U32*)CALIBRATION_RECORD_START_ADDRESS, (U32*)&calibrationRecord, - sizeof(CALIBRATION_RECORD_T) / sizeof(U32), Fapi_NormalRead ); + //Fapi_doMarginRead ( (U32*)CALIBRATION_RECORD_START_ADDRESS, (U32*)&calibrationRecord, + //sizeof(CALIBRATION_RECORD_T) / sizeof(U32), Fapi_NormalRead ); state = NVDATAMGMT_SELF_TEST_STATE_READ_CAL_RECORD; } @@ -1757,11 +1731,11 @@ if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - getDataFromRAM ( (U08*)&serviceRecord, sizeof(SERVICE_RECORD_T) ); + //getDataFromRAM ( (U08*)&serviceRecord, sizeof(SERVICE_RECORD_T) ); if ( getRTCRAMState() == RTC_RAM_STATE_READY ) { currentTime = getMSTimerCount(); - readFromRAM( LAST_DISINFECTION_DATE_ADDRESS, sizeof(LAST_DISINFECTION_RECORD_T) ); + //readFromRAM( LAST_DISINFECTION_DATE_ADDRESS, sizeof(LAST_DISINFECTION_RECORD_T) ); state = NVDATAMGMT_SELF_TEST_STATE_READ_LAST_DISINFECTION_DATE; } } @@ -1784,7 +1758,7 @@ if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - getDataFromRAM ( (U08*)&lastDisinfectionRecord, sizeof(LAST_DISINFECTION_RECORD_T) ); + //getDataFromRAM ( (U08*)&lastDisinfectionRecord, sizeof(LAST_DISINFECTION_RECORD_T) ); state = NVDATAMGMT_SELF_TEST_STATE_CHECK_CRC; } @@ -1827,8 +1801,8 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_NVDATA_HW_USAGE_DATA_CRC_ERROR, recordCRC, calcCRC ); } // Check the CRC for last disinfection date - calcCRC = crc16 ( (U08*)&lastDisinfectionRecord.date.disinfectionDate, sizeof(DISINFECTION_DATE_T) ); - recordCRC = lastDisinfectionRecord.crc; + //calcCRC = crc16 ( (U08*)&lastDisinfectionRecord.date.disinfectionDate, sizeof(DISINFECTION_DATE_T) ); + //recordCRC = lastDisinfectionRecord.crc; if ( calcCRC != recordCRC ) { hasCRCPassed = FALSE; @@ -1852,8 +1826,8 @@ logRecord.logHeader.isHdrCorrupted = TRUE; } // Check CRC for manufacturing record - calcCRC = crc16 ( (U08*)&mfgRecord.mfgData, sizeof(MFG_DATA_T) ); - recordCRC = mfgRecord.crc; + //calcCRC = crc16 ( (U08*)&mfgRecord.mfgData, sizeof(MFG_DATA_T) ); + //recordCRC = mfgRecord.crc; if ( calcCRC != recordCRC ) { hasCRCPassed = FALSE; @@ -1874,8 +1848,8 @@ } #ifndef LIMITED_NVDATA_CRC_CHECKS // Check CRC for service record - calcCRC = crc16 ( (U08*)&serviceRecord.serviceData, sizeof(SERVICE_DATA_T) ); - recordCRC = serviceRecord.crc; + //calcCRC = crc16 ( (U08*)&serviceRecord.serviceData, sizeof(SERVICE_DATA_T) ); + //recordCRC = serviceRecord.crc; if ( calcCRC != recordCRC ) { hasCRCPassed = FALSE; @@ -2661,8 +2635,8 @@ { // Sector 0 must be erased first enqueue ( NVDATAMGMT_ERASE_SECTOR, NVDATAMGMT_EEPROM, BANK7_SECTOR0_START_ADDRESS, 0, 0, 0 ); - enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, BANK7_SECTOR0_START_ADDRESS, (U08*)&mfgRecord, 0, sizeof(MFG_RECORD_T) ); - enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, CALIBRATION_RECORD_START_ADDRESS, (U08*)&calibrationRecord, 0, sizeof(CALIBRATION_RECORD_T) ); + //enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, BANK7_SECTOR0_START_ADDRESS, (U08*)&mfgRecord, 0, sizeof(MFG_RECORD_T) ); + //enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, CALIBRATION_RECORD_START_ADDRESS, (U08*)&calibrationRecord, 0, sizeof(CALIBRATION_RECORD_T) ); status = TRUE; }