Index: NVDataMgmt.c =================================================================== diff -u -ra63f7d2ae7e000824aae3c17bddf9c391517d71f -r1dca03388e2ccf64fc0bbee3e77080462a17097f --- NVDataMgmt.c (.../NVDataMgmt.c) (revision a63f7d2ae7e000824aae3c17bddf9c391517d71f) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision 1dca03388e2ccf64fc0bbee3e77080462a17097f) @@ -78,8 +78,9 @@ #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_DATE_START_ADDRESS 0X00000050 // 80 ///< Service date record start address in RTC RAM (80). -#define LAST_DISINFECTION_DATE_ADDRESS 0x00000060 // 96 ///< Last disinfection date start address in RTC RAM (96). +#define SERVICE_DATE_START_ADDRESS 0X00000050 // 80 //TODO remove ///< Service date record start address in RTC RAM (80). +#define LAST_DISINFECTION_DATE_ADDRESS 0x00000060 // 96 //TODO remove ///< Last disinfection date start address in RTC RAM (96). +#define DG_SCHEDULER_ADDRESS 0x00000070 // 112 ///< DG scheduler dates start address (112). // Data addresses in EEPROM #define CALIBRATION_RECORD_START_ADDRESS ( BANK7_SECTOR0_START_ADDRESS + sizeof(MFG_RECORD_T) ) ///< Calibration record start address in EEPROM. @@ -92,9 +93,10 @@ #define NUM_OF_CONCENTRATE_PUMPS 2U ///< Number of concentrate pumps. #define NUM_OF_BYTES_PER_CAL_PAYLOAD 150U ///< Number of bytes per calibration payload. #define CAL_DATA_SEND_INTERVAL_COUNT ( MS_PER_SECOND / ( 5 * TASK_GENERAL_INTERVAL ) ) ///< Calibration data send time interval in counts. -#define CAL_DATA_RECEIVE_TIMEOUT_MS ( MS_PER_SECOND / 2 ) ///< Calibration data receive packets time out. +#define CAL_DATA_RECEIVE_TIMEOUT_MS ( 4 * MS_PER_SECOND ) ///< Calibration data receive all the data packets timeout in ms. +#define CAL_DATA_MAX_MESSAGE_DFFIRENCE 1 ///< Calibration data receive message different from the previous message. +#define CAL_DATA_FIRST_RECEIVING_MSG_NUM 1 ///< Calibration data first receiving message number - /// NVDataMgmt self-test states enumeration. typedef enum NVDataMgmt_Self_Test_States { @@ -116,61 +118,83 @@ /// NVDataMgmt Exec states enumeration. typedef enum NVDataMgmt_Exec_State { - NVDATAMGMT_EXEC_STATE_WAIT_FOR_POST = 0, ///< Exec state wait for POST - NVDATAMGMT_EXEC_STATE_IDLE, ///< Exec state Idle - NVDATAMGMT_EXEC_STATE_WRITE_TO_EEPROM, ///< Exec state write to EEPROM - NVDATAMGMT_EXEC_STATE_READ_FROM_EEPROM, ///< Exec state read from EEPROM - NVDATAMGMT_EXEC_STATE_ERASE_EEPROM, ///< Exec state erase EEPROM - NVDATAMGMT_EXEC_STATE_WRITE_TO_RTC, ///< Exec state write to RTC - NVDATAMGMT_EXEC_STATE_READ_FROM_RTC, ///< Exec state read from RTC - NUM_OF_NVDATAMGMT_EXEC_STATES ///< Total number of exec states + NVDATAMGMT_EXEC_STATE_WAIT_FOR_POST = 0, ///< Exec state wait for POST. + NVDATAMGMT_EXEC_STATE_IDLE, ///< Exec state Idle. + NVDATAMGMT_EXEC_STATE_WRITE_TO_EEPROM, ///< Exec state write to EEPROM. + NVDATAMGMT_EXEC_STATE_READ_FROM_EEPROM, ///< Exec state read from EEPROM. + NVDATAMGMT_EXEC_STATE_ERASE_EEPROM, ///< Exec state erase EEPROM. + NVDATAMGMT_EXEC_STATE_WRITE_TO_RTC, ///< Exec state write to RTC. + NVDATAMGMT_EXEC_STATE_READ_FROM_RTC, ///< Exec state read from RTC. + NUM_OF_NVDATAMGMT_EXEC_STATES ///< Total number of exec states. } NVDATAMGMT_EXEC_STATE_T; /// NVDataMgmt memory operation modes enumeration. typedef enum NVDataMgmt_Operation { - NVDATAMGMT_NONE = 0, ///< Default mode to prevent any accidental ops - NVDATAMGMT_WRITE, ///< Operation mode write - NVDATAMGMT_READ, ///< Operation mode read - NVDATAMGMT_ERASE_SECTOR, ///< Operation mode erase a sector (EEPROM) - NUM_OF_NVDATAMGMT_OPS_STATES ///< Total number of operation states + NVDATAMGMT_NONE = 0, ///< Default mode to prevent any accidental ops. + NVDATAMGMT_WRITE, ///< Operation mode write. + NVDATAMGMT_READ, ///< Operation mode read. + NVDATAMGMT_ERASE_SECTOR, ///< Operation mode erase a sector (EEPROM). + NUM_OF_NVDATAMGMT_OPS_STATES ///< Total number of operation states. } NVDATAMGMT_OPERATION_STATE_T; -/// NVDataMgmt memory locations enumeration. +/// NVDataMgmt memory locations enumeration typedef enum NVDataMgmt_Location { - NVDATAMGMT_EEPROM = 0, ///< Location EEPROM - NVDATAMGMT_RTC, ///< Location RTC (RAM) - NUM_OF_NVDATAMGMT_LOC_STATES ///< Total number of location states + NVDATAMGMT_EEPROM = 0, ///< Location EEPROM. + NVDATAMGMT_RTC, ///< Location RTC (RAM). + NUM_OF_NVDATAMGMT_LOC_STATES ///< Total number of location states. } NVDATAMGMT_LOCATION_STATE_T; -/// NVDataMgmt calibration states -typedef enum NVDataMgmt_Calibration_State +/// NVDataMgmt process records states +typedef enum NVDataMgmt_Process_Records_States { - NVDATAMGMT_CAL_STATE_IDLE = 0, ///< NVDataMgmt calibration state idle - NVDATAMGMT_CAL_STATE_SEND_RECORD, ///< NVDataMgmt calibration state send record - NUM_OF_NVDATAMGMT_CAL_STATES ///< Number of NVDataMgmt calibration state -} NVDATAMGMT_CAL_STATE_T; + NVDATAMGMT_PROCESS_RECORD_STATE_IDLE = 0, ///< NVDataMgmt process record idle state. + NVDATAMGMT_PROCESS_RECORD_STATE_SEND_RECORD, ///< NVDataMgmt process record send record state. + NUM_OF_NVDATAMGMT_PROCESS_RECORD_STATES ///< Number of NVDataMgmt process records state. +} PROCESS_RECORD_STATE_T; -typedef enum NVDataMgmt_Calibration_Status +/// NVDataMgmt receive records states +typedef enum NVDataMgmt_Receive_Records_States { - NVDATAMGMT_CAL_STATUS_NONE = 0, - NVDATAMGMT_CAL_STATUS_WRITE, - NVDATAMGMT_CAL_STATUS_READ, - NUM_OF_NVDATAMGMT_STATUS_STATES -}NVDATAMGMT_CAL_STATUS_T; + NVDATAMGMT_RECEIVE_RECORD_IDLE = 0, ///< NVDataMgmt receive record idle. + NVDATAMGMT_RECEIVE_RECORD_RECEIVE, ///< NVDataMgmt receive record receive. + NUM_OF_NVDATAMGMT_RECEIVE_RECORD_STATES ///< Number of NVDataMgmt receive record. +} RECEIVE_RECORD_STATE_T; +/// NVDataMgmt records' jobs states +typedef enum NVDataMgmt_Records_Jobs +{ + NVDATAMGMT_PROCESS_SECTOR_0_RECORDS = 0, ///< NVDataMgmt process sector 0 records (read/write). + NVDATAMGMT_PROCESS_SCHEDULING_RECORD, + NUM_OF_NVDATMGMT_RECORDS_JOBS +} RECORD_JOBS_STATE_T; + #pragma pack(push, 1) +typedef struct +{ + U32 startAddress; + U32 numberOfBytes; + U32 writeSize; +} PROCESS_RECORD_SPECS_T; + +typedef struct +{ + NVDATAMGMT_OPERATION_STATE_T memoryOperation; ///< Memory operation. + NVDATAMGMT_LOCATION_STATE_T memoryLocation; ///< Memory location. + RECORD_JOBS_STATE_T recordJob; ///< Record job (i.e sector 0) +} PROCESS_RECORD_JOB_T; + /// Memory operations structure. typedef struct { - NVDATAMGMT_OPERATION_STATE_T memoryOperation; ///< Memory operation - NVDATAMGMT_LOCATION_STATE_T memoryLocation; ///< Memory location - U32 startAddress; ///< Operation start address - U08 buffer [ MAX_JOB_DATA_SIZE_BYTES ]; ///< Buffer - READ_DATA_T* externalAddress; ///< External address of a buffer - U32 length; ///< Length of a buffer -} MEMORY_OPS_T; + NVDATAMGMT_OPERATION_STATE_T memoryOperation; ///< Memory operation. + NVDATAMGMT_LOCATION_STATE_T memoryLocation; ///< Memory location. + U32 startAddress; ///< Operation start address. + U08 buffer [ MAX_JOB_DATA_SIZE_BYTES ]; ///< Buffer. + READ_DATA_T* externalAddress; ///< External address of a buffer. + U32 length; ///< Length of a buffer. +} MEMORY_LOG_OPS_T; /// Log header structure. typedef struct @@ -296,23 +320,45 @@ //DG_PUMPS_CAL_RECORD_T pumpsCalRecord; ///< DG pumps U16 crc; ///< CRC for the DG cal record structure } DG_CALIBRATION_RECORD_T; + +/// Sector 0 records structure +typedef struct +{ + DG_CALIBRATION_RECORD_T test; + // TODO padding + +} SECTOR_0_RECORDS_T; + +/// DG scheduler record structure +typedef struct +{ + //TODO fill up +} DG_SCHEDULER_RECORD_T; #pragma pack(pop) +// TODO change the +const PROCESS_RECORD_SPECS_T RECORDS_SPECS [ NUM_OF_NVDATMGMT_RECORDS_JOBS ] = { + {BANK7_SECTOR0_START_ADDRESS, sizeof(DG_CALIBRATION_RECORD_T), MAX_EEPROM_WRITE_BUFFER_BYTES}, //NVDATAMGMT_PROCESS_SECTOR_0_RECORDS + {DG_SCHEDULER_ADDRESS, sizeof(DG_SCHEDULER_RECORD_T), 11 /*TODO can we increase this to 16?*/}}; //NVDATAMGMT_PROCESS_SCHEDULING_RECORD}; + // Calibration variables -static NVDATAMGMT_CAL_STATE_T NVDataMgmtExecCalState = NVDATAMGMT_CAL_STATE_IDLE; ///< NVDataMgmt calibration state. -static NVDATAMGMT_CAL_STATUS_T NVDataMgmtCalStatus = NVDATAMGMT_CAL_STATUS_NONE; ///< NVDataMgmt calibration status. +static PROCESS_RECORD_STATE_T NVDataMgmtExecProcessRecordState = NVDATAMGMT_PROCESS_RECORD_STATE_IDLE; ///< NVDataMgmt exec process record state. static DG_CALIBRATION_RECORD_T dgCalibrationRecord; ///< DG calibration record. +static RECEIVE_RECORD_STATE_T NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; ///< NVDataMgmt exec receive record state. static BOOL isPublishCalRequested = FALSE; ///< Calibration state machine flag. static U32 calPublishMessageCount = 1; ///< Calibration data publish message counter. static U32 calPublishTotalMessages = 1; ///< Calibration data total number of messages to be sent. static U32 calSendDataIntervalCounter = 0; ///< Calibration data send to CAN bust interval counter. static U32 previousCalMessageNum = 0; ///< Calibration previous message number. static U32 dgCalRecordUpdateAddress = 0; ///< DG calibration record update address. -static U32 calDataReceiveTime = 0; ///< Time stamp the calibration/service was received. +static U32 calDataReceiveStartTime = 0; ///< Time stamp the calibration/service was received. +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. // Private variables -static MEMORY_OPS_T jobQueue [ QUEUE_MAX_SIZE ]; ///< Job queue buffer -static MEMORY_OPS_T currentJob; ///< Current job +static MEMORY_LOG_OPS_T jobQueue [ QUEUE_MAX_SIZE ]; ///< Job queue buffer +static MEMORY_LOG_OPS_T currentJob; ///< Current job 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 @@ -357,8 +403,8 @@ static NVDATAMGMT_EXEC_STATE_T handleExecWriteToRAMState ( void ); static NVDATAMGMT_EXEC_STATE_T handleExecReadFromRAMState ( void ); -static NVDATAMGMT_CAL_STATE_T handleExecCalIdleState( void ); -static NVDATAMGMT_CAL_STATE_T handleExecCalSendRecordState( void ); +static PROCESS_RECORD_STATE_T handleExecProcessRecordIdleState( void ); +static PROCESS_RECORD_STATE_T handleExecProcessRecordSendRecordState( void ); // Queue functions @@ -393,12 +439,14 @@ NVDataMgmtSelfTestState = NVDATAMGMT_SELF_TEST_STATE_START; NVDataMgmtExecState = NVDATAMGMT_EXEC_STATE_WAIT_FOR_POST; NVDataMgmtSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; - NVDataMgmtExecCalState = NVDATAMGMT_CAL_STATE_IDLE; - NVDataMgmtCalStatus = NVDATAMGMT_CAL_STATUS_NONE; + NVDataMgmtExecProcessRecordState = NVDATAMGMT_PROCESS_RECORD_STATE_IDLE; + NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; queueRearIndex = QUEUE_START_INDEX; queueFrontIndex = QUEUE_START_INDEX; queueCount = 0; dgCalRecordUpdateAddress = 0; + recordQueueRearIndex = QUEUE_START_INDEX; + recordQueueFrontIndex = QUEUE_START_INDEX; Fapi_initializeFlashBanks( ROUNDED_HCLK_FREQ ); Fapi_setActiveFlashBank( Fapi_FlashBank7 ); @@ -584,38 +632,50 @@ /*********************************************************************//** * @brief - * The execNVDataMgmtCalibration runs the NVDataMgmt calibration related + * The execNVDataMgmtSendRecord runs the NVDataMgmt send records related * tasks. * @details Inputs: NVDataMgmtExecCalState * @details Outputs: NVDataMgmtExecCalState, alarm if exec state was invalid * @return none *************************************************************************/ -void execNVDataMgmtCalibration( void ) +void execNVDataMgmtSendRecord( void ) { - switch ( NVDataMgmtExecCalState ) + switch ( NVDataMgmtExecProcessRecordState ) { - case NVDATAMGMT_CAL_STATE_IDLE: + case NVDATAMGMT_PROCESS_RECORD_STATE_IDLE: - NVDataMgmtExecCalState = handleExecCalIdleState(); + NVDataMgmtExecProcessRecordState = handleExecProcessRecordIdleState(); break; - case NVDATAMGMT_CAL_STATE_SEND_RECORD: + case NVDATAMGMT_PROCESS_RECORD_STATE_SEND_RECORD: - NVDataMgmtExecCalState = handleExecCalSendRecordState(); + NVDataMgmtExecProcessRecordState = handleExecProcessRecordSendRecordState(); break; default: #ifdef _DG_ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, - NVDataMgmtExecCalState ); + NVDataMgmtExecProcessRecordState ); #else SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_NVDATAMGMT_EXEC_CAL_STATE, - NVDataMgmtExecCalState ); + NVDataMgmtExecProcessRecordState ); #endif - NVDataMgmtExecCalState = NVDATAMGMT_CAL_STATE_IDLE; + NVDataMgmtExecProcessRecordState = NVDATAMGMT_PROCESS_RECORD_STATE_IDLE; break; } + + // Check if the exec receive records is not idle + if ( NVDataMgmtExecReceiveRecordState != NVDATAMGMT_RECEIVE_RECORD_IDLE ) + { + // Check if the data receiving process has timed out. The exec receive record + // state machine is asynchronous so it is checked in this state machine + if ( didTimeout( calDataReceiveStartTime, CAL_DATA_RECEIVE_TIMEOUT_MS ) ) + { + // TODO schedule a read + NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; + } + } } /*********************************************************************//** @@ -631,7 +691,7 @@ BOOL status = FALSE; // Check if the state machine is in idle state and then set the request - if ( NVDataMgmtExecCalState == NVDATAMGMT_CAL_STATE_IDLE ) + if ( NVDataMgmtExecProcessRecordState == NVDATAMGMT_PROCESS_RECORD_STATE_IDLE ) { isPublishCalRequested = TRUE; status = TRUE; @@ -660,11 +720,20 @@ { BOOL status = TRUE; + // If the calibration message number is the first message number and receive exec state is idle, switch to idle + if ( CAL_DATA_FIRST_RECEIVING_MSG_NUM == currentMessage && NVDataMgmtExecReceiveRecordState == NVDATAMGMT_RECEIVE_RECORD_IDLE ) + { + NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_RECEIVE; + calDataReceiveStartTime = getMSTimerCount(); + previousCalMessageNum = 0; + dgCalRecordUpdateAddress = 0; + } + // Check if there is still a message left to be received - if ( currentMessage <= totalMessages ) + if ( NVDataMgmtExecReceiveRecordState == NVDATAMGMT_RECEIVE_RECORD_RECEIVE && currentMessage <= totalMessages ) { // Check if the current message is different from the previous message by 1 - if ( ( currentMessage - previousCalMessageNum ) == 1 ) + if ( CAL_DATA_MAX_MESSAGE_DFFIRENCE == ( currentMessage - previousCalMessageNum ) ) { // Define a pointer that points to the DG calibration record U08* ptr = (U08*)&dgCalibrationRecord; @@ -678,23 +747,22 @@ // and 0 everything out since we are done writing if ( currentMessage == totalMessages ) { - previousCalMessageNum = 0; - dgCalRecordUpdateAddress = 0; - // Get the CRC of the structure without the last 16 bits which is the CRC itself - U16 calcCRC = crc16 ( (U08*)&dgCalibrationRecord, sizeof(DG_CALIBRATION_RECORD_T) - sizeof(U16) ); + U16 calcCRC = crc16 ( (U08*)&dgCalibrationRecord, sizeof(DG_CALIBRATION_RECORD_T) - sizeof(U16) ); U16 recordCRC = dgCalibrationRecord.crc; if ( calcCRC != recordCRC ) { + // TODO schedule a read // CRC failed, request a read to read the data back from NV memory - NVDataMgmtCalStatus = NVDATAMGMT_CAL_STATUS_READ; + NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; status = FALSE; } else { + // TODO schedule a write // CRC passed, request a write to write the data to NV memory - NVDataMgmtCalStatus = NVDATAMGMT_CAL_STATUS_WRITE; + NVDataMgmtExecReceiveRecordState = NVDATAMGMT_RECEIVE_RECORD_IDLE; } } else @@ -704,19 +772,8 @@ // Now the current message is the previous message previousCalMessageNum = currentMessage; - - // Data received, set the timer for the next time - calDataReceiveTime = getMSTimerCount(); } } - // TODO do we have to cancel if one the receives timed out? - // If the next data packet was not received in time, cancel the receiving procedure and - // request a read of the data from NV memory - else if ( didTimeout( calDataReceiveTime, CAL_DATA_RECEIVE_TIMEOUT_MS ) ) - { - NVDataMgmtCalStatus = NVDATAMGMT_CAL_STATUS_READ; - status = FALSE; - } } return status; @@ -1521,14 +1578,13 @@ NVDATAMGMT_EXEC_STATE_T state = NVDATAMGMT_EXEC_STATE_IDLE; // If cal status is not none, process it - if ( NVDataMgmtCalStatus != NVDATAMGMT_CAL_STATUS_NONE ) + //if ( NVDataMgmtCalStatus != NVDATAMGMT_RECEIVE_READY ) { } - // Check if the queue is not empty and the calibration/service status is none // Processing calibration and service status have priority - if ( !isQueueEmpty() && NVDataMgmtCalStatus == NVDATAMGMT_CAL_STATUS_NONE ) + if ( !isQueueEmpty() ) { dequeue(); NVDATAMGMT_OPERATION_STATE_T ops = currentJob.memoryOperation; @@ -1695,17 +1751,17 @@ /*********************************************************************//** * @brief - * The handleExecCalIdleState handles the idle state of the exec cal state - * machine. + * The handleExecProcessRecordIdleState handles the idle state of the + * exec cal state machine. * @details Inputs: isPublishCalRequested, isPublishCalRequested, * calPublishTotalMessages, calPublishMessageCount, calSendDataIntervalCounter * @details Outputs: isPublishCalRequested, calPublishTotalMessages, * calPublishMessageCount, calSendDataIntervalCounter * @return next state of the state machine *************************************************************************/ -static NVDATAMGMT_CAL_STATE_T handleExecCalIdleState( void ) +static PROCESS_RECORD_STATE_T handleExecProcessRecordIdleState( void ) { - NVDATAMGMT_CAL_STATE_T state = NVDATAMGMT_CAL_STATE_IDLE; + PROCESS_RECORD_STATE_T state = NVDATAMGMT_PROCESS_RECORD_STATE_IDLE; if ( isPublishCalRequested ) { @@ -1719,25 +1775,25 @@ // of the send calibration record function, the first packet of data is sent calSendDataIntervalCounter = CAL_DATA_SEND_INTERVAL_COUNT; - state = NVDATAMGMT_CAL_STATE_SEND_RECORD; + state = NVDATAMGMT_PROCESS_RECORD_STATE_SEND_RECORD; } return state; } /*********************************************************************//** * @brief - * The handleExecCalSendRecordState handles the send calibration record - * state of the state machine. + * The handleExecProcessRecordSendRecordState handles the send calibration + * record state of the state machine. * @details Inputs: dgCalibrationRecord, calPublishTotalMessages, * calPublishMessageCount, calSendDataIntervalCounter * @details Outputs: calPublishTotalMessages, calPublishMessageCount, * calSendDataIntervalCounter * @return next state of the state machine *************************************************************************/ -static NVDATAMGMT_CAL_STATE_T handleExecCalSendRecordState( void ) +static PROCESS_RECORD_STATE_T handleExecProcessRecordSendRecordState( void ) { - NVDATAMGMT_CAL_STATE_T state = NVDATAMGMT_CAL_STATE_SEND_RECORD; + PROCESS_RECORD_STATE_T state = NVDATAMGMT_PROCESS_RECORD_STATE_SEND_RECORD; // If the current message number is less than the total, keep sending if ( calPublishMessageCount < calPublishTotalMessages ) @@ -1767,7 +1823,7 @@ } else { - state = NVDATAMGMT_CAL_STATE_IDLE; + state = NVDATAMGMT_PROCESS_RECORD_STATE_IDLE; } return state;