Prechádzať zdrojové kódy

sensor history not save in flash

zhangbo 3 rokov pred
rodič
commit
f29b4c8df0

+ 8 - 9
app/bmc/Api.c

@@ -222,6 +222,10 @@ int Init_IPMI_FRU_SDR_SEL(void)
 		printf("g_BMCInfo.pSEL Malloc failed!\r\n");
 	}
 	
+	/************** Sensor History ****************/
+	memset(gSensorHistoryInfo, 0, sizeof(SensorHistoryInfo_T)*SENSOR_NUMBERS);
+	//FlushSensorHistoryToFlash();
+	
 	GetIPMIFromFlash();
 	if(strncmp(g_BMCInfo.IpmiConfig.FirstPowerOnStr, FirstPowerOnStr, sizeof(FirstPowerOnStr)) != 0)
 	{
@@ -280,11 +284,6 @@ int Init_IPMI_FRU_SDR_SEL(void)
 			pSDR	+= sizeof(HdrFullSensorRec_T);
 		}
 
-		
-		
-		
-		
-		
 		g_BMCInfo.IpmiConfig.SELConfig.SelReservationID = 0;;
 	    g_BMCInfo.IpmiConfig.SELConfig.LastEvtTS		=	0;
 	    g_BMCInfo.IpmiConfig.SELConfig.PartialAddRecordID	=	0;
@@ -305,9 +304,7 @@ int Init_IPMI_FRU_SDR_SEL(void)
 		g_BMCInfo.CurrentNoUser = 1;
 		g_BMCInfo.pUserInfo = NULL;
 
-		/************** Sensor History ****************/
-		memset(gSensorHistoryInfo, 0, sizeof(SensorHistoryInfo_T)*SENSOR_NUMBERS);
-		FlushSensorHistoryToFlash();
+		
 
 		/**************   Lan info ********************/
 		//LAN地址
@@ -366,7 +363,7 @@ int Init_IPMI_FRU_SDR_SEL(void)
 	    g_BMCInfo.IpmiConfig.SELConfig.selalmostfull	=	0;
 
 	    //Init SensorHistory
-		GetSensorHistoryFromFlash();
+		//GetSensorHistoryFromFlash();
 
 	    UpdateUserInfoTble();
 		g_BMCInfo.CurrentNoUser = 0;
@@ -1124,6 +1121,7 @@ int FlushSensorHistoryToFlash()
 	uint32_t 	offset = 0;
 	uint32_t	sensorSize = SENSOR_NUMBERS*sizeof(SensorHistoryInfo_T);
 
+	printf("FlushSensorHistoryToFlash()\n" );
 	pthread_mutex_lock(&Flash_Mutex);
 	while(sensorSize > 0)
 	{
@@ -1145,6 +1143,7 @@ int GetSensorHistoryFromFlash()
 {
 	uint32_t	sensorSize = SENSOR_NUMBERS*sizeof(SensorHistoryInfo_T);
 
+	printf("GetSensorHistoryFromFlash()\n");
 	pthread_mutex_lock(&Flash_Mutex);
 	sf_read(5, SENSOR_HISTORY_FLASH_ADDR, (uint8_t*)gSensorHistoryInfo, sensorSize);
 	pthread_mutex_unlock(&Flash_Mutex);

+ 1 - 1
app/bmc/msghndlr/SensorEvent/SensorDevice/SensorMonitor.c

@@ -239,7 +239,7 @@ MonitorTSensors ( SensorInfo_T*     pSensorInfo)
 		pSensorInfo->SensorReading = SensorReading;
 		
 		//keep sensor history
-		//if((g_BMCInfo.CurTimerSecond%180 == 0))	//3 minutes
+		if((g_BMCInfo.CurTimerSecond%180 == 0))	//3 minutes
 		{
 			for(index=0; index<SENSOR_NUMBERS;index++)
 			{