Index: NVDataMgmt.c =================================================================== diff -u -r8119125ec55f7e9c9c8f011544b3f2fb8a4f8308 -rea50b65284ae5683fd7e6b89fd8134cf46777722 --- NVDataMgmt.c (.../NVDataMgmt.c) (revision 8119125ec55f7e9c9c8f011544b3f2fb8a4f8308) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision ea50b65284ae5683fd7e6b89fd8134cf46777722) @@ -1733,7 +1733,7 @@ U08* bufferAddress = specs.structAddressPtr; U32 maxBufferLength = specs.maxReadBufferSize / EEPROM_OPS_SIZE_OF_CONVERTER; - Fapi_doMarginRead ( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength, Fapi_NormalRead ); + Fapi_doMarginRead( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength, Fapi_NormalRead ); currentTime = getMSTimerCount(); state = NVDATAMGMT_SELF_TEST_STATE_READ_CAL_RECORD; } @@ -1761,7 +1761,7 @@ U08* bufferAddress = specs.structAddressPtr; U32 maxBufferLength = specs.maxReadBufferSize / EEPROM_OPS_SIZE_OF_CONVERTER; - Fapi_doMarginRead ( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength, Fapi_NormalRead ); + Fapi_doMarginRead( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength, Fapi_NormalRead ); currentTime = getMSTimerCount(); state = NVDATAMGMT_SELF_TEST_STATE_READ_SYS_RECORD; } @@ -1785,7 +1785,7 @@ { if ( RTC_RAM_STATE_READY == getRTCRAMState() ) { - PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS [ NVDATAMGMT_SERVICE_RECORD ]; + PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS[ NVDATAMGMT_SERVICE_RECORD ]; U32 startAddress = specs.startAddress; U32 maxBufferLength = specs.maxReadBufferSize; @@ -1814,7 +1814,7 @@ if ( ( RTC_RAM_STATUS_IDLE == getRTCRAMStatus() ) || ( TRUE == timeoutStatus ) ) { - PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS [ NVDATAMGMT_SERVICE_RECORD ]; + PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS[ NVDATAMGMT_SERVICE_RECORD ]; U08* bufferAddress = specs.structAddressPtr; U32 maxBufferLength = specs.maxReadBufferSize; @@ -1823,7 +1823,7 @@ #ifdef _DG_ if ( RTC_RAM_STATE_READY == getRTCRAMState() ) { - PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS [ NVDATAMGMT_SCHEDULED_RUNS_RECORD ]; + PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS[ NVDATAMGMT_SCHEDULED_RUNS_RECORD ]; U32 startAddress = specs.startAddress; U32 maxBufferLength = specs.maxReadBufferSize; @@ -1853,11 +1853,11 @@ static NVDATAMGMT_SELF_TEST_STATE_T handleSelfTestReadScheduledRunsRecord( void ) { NVDATAMGMT_SELF_TEST_STATE_T state = NVDATAMGMT_SELF_TEST_STATE_READ_SCHEDULED_RUNS_RECORD; - BOOL timeoutStatus = didCommandTimeout ( ALARM_ID_RTC_RAM_OPS_ERROR, (U08*)&state ); + BOOL timeoutStatus = didCommandTimeout( ALARM_ID_RTC_RAM_OPS_ERROR, (U08*)&state ); if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS [ NVDATAMGMT_SCHEDULED_RUNS_RECORD ]; + PROCESS_RECORD_SPECS_T specs = RECORDS_SPECS[ NVDATAMGMT_SCHEDULED_RUNS_RECORD ]; U08* bufferAddress = specs.structAddressPtr; U32 maxBufferLength = specs.maxReadBufferSize; @@ -1881,16 +1881,16 @@ static NVDATAMGMT_SELF_TEST_STATE_T handleSelfTestReadHDTreatmentTime ( void ) { NVDATAMGMT_SELF_TEST_STATE_T state = NVDATAMGMT_SELF_TEST_STATE_READ_TREATMENT_TIME; - BOOL timeoutStatus = didCommandTimeout ( ALARM_ID_RTC_RAM_OPS_ERROR, (U08*)&state ); + BOOL timeoutStatus = didCommandTimeout( ALARM_ID_RTC_RAM_OPS_ERROR, (U08*)&state ); // If the RTC RAM is ready, read the results if ( getRTCRAMStatus() == RTC_RAM_STATUS_IDLE || timeoutStatus == TRUE ) { - getDataFromRAM ( (U08*)&hdUsageInfoGroup, sizeof(HD_USAGE_INFO_RECORD_T) ); + getDataFromRAM( (U08*)&hdUsageInfoGroup, sizeof(HD_USAGE_INFO_RECORD_T) ); // If the RAM is ready, request a read for the log records (RAM) if ( getRTCRAMState() == RTC_RAM_STATE_READY ) { - readFromRAM ( LOG_RECORD_START_ADDRESS, sizeof(LOG_RECORD_T) ); + readFromRAM( LOG_RECORD_START_ADDRESS, sizeof(LOG_RECORD_T) ); currentTime = getMSTimerCount(); state = NVDATAMGMT_SELF_TEST_STATE_READ_LOG_RECORD; } @@ -2088,25 +2088,25 @@ { if ( ops == NVDATAMGMT_ERASE_SECTOR ) { - Fapi_issueAsyncCommandWithAddress ( Fapi_EraseSector, (U32*)startAddress ); + Fapi_issueAsyncCommandWithAddress( Fapi_EraseSector, (U32*)startAddress ); state = NVDATAMGMT_EXEC_STATE_ERASE_EEPROM; } else if ( ops == NVDATAMGMT_WRITE && location == NVDATAMGMT_EEPROM ) { - Fapi_issueProgrammingCommand ( (U32*)startAddress, (U08*)bufferAddress, maxBufferLength, 0x00, 0, Fapi_DataOnly ); + Fapi_issueProgrammingCommand( (U32*)startAddress, (U08*)bufferAddress, maxBufferLength, 0x00, 0, Fapi_DataOnly ); state = NVDATAMGMT_EXEC_STATE_WRITE_TO_EEPROM; } else if ( ops == NVDATAMGMT_READ && location == NVDATAMGMT_EEPROM ) { - Fapi_doMarginRead ( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength, Fapi_NormalRead ); + Fapi_doMarginRead( (U32*)startAddress, (U32*)bufferAddress, maxBufferLength / EEPROM_OPS_SIZE_OF_CONVERTER, Fapi_NormalRead ); state = NVDATAMGMT_EXEC_STATE_READ_FROM_EEPROM; } else if ( ops == NVDATAMGMT_WRITE && location == NVDATAMGMT_RTC ) { if ( getRTCRAMState() == RTC_RAM_STATE_READY ) { currentTime = getMSTimerCount(); - writeToRAM ( startAddress, bufferAddress, maxBufferLength ); + writeToRAM( startAddress, bufferAddress, maxBufferLength ); state = NVDATAMGMT_EXEC_STATE_WRITE_TO_RTC; } } @@ -2150,13 +2150,11 @@ { currentTime = getMSTimerCount(); U32 startAddress = jobSpecs.startAddress + recordAddressOffset; + U32 maxBufferLength = ( jobSpecs.maxWriteBufferSize / EEPROM_OPS_SIZE_OF_CONVERTER ); // Clear the buffer from the previous content memset( writtenRecordCheckBuffer, 0, sizeof(writtenRecordCheckBuffer)); - // The length should be divided by 4 - U32 maxBufferLength = jobSpecs.maxWriteBufferSize / EEPROM_OPS_SIZE_OF_CONVERTER; - // Issue a FAPI read command but only the bytes that were written, so use maxWriteBufferSize Fapi_doMarginRead ( (U32*)startAddress, (U32*)writtenRecordCheckBuffer, maxBufferLength, Fapi_NormalRead );