Browse Source

调试信息上传已完成,UTC+8已完成。

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
b5a0db468d
3 changed files with 21 additions and 41 deletions
  1. 1 1
      inc/hal_module_adapter.h
  2. 1 1
      src/TcpTask.c
  3. 19 39
      src/hal_module_adapter.c

+ 1 - 1
inc/hal_module_adapter.h

@@ -192,7 +192,7 @@ BOOL NB_ADC_Get(UINT32* adcValue, ADC_CHANNEL_TYPE adcChannel);
 void Debug_Del_Logfile(void);
 void Debug_Read_Logfile(UINT8 * rbuf,UINT16 FileSize);
 void Debug_printf(const UINT8 *format, ...);
-void Debug_GetSize(UINT16 *FileSize);
+UINT16 Debug_GetSize();
 #endif
 #ifdef BL_FILE_LOG
 void bluejoy_printf(BlLogLevel level, const UINT8 *format, ...);

+ 1 - 1
src/TcpTask.c

@@ -527,7 +527,7 @@ static void TcpDataInfoAssembleSend()
         DebugMsgtoTcpType DebugMsgInfo;
         UINT8 *SendBuffer = PNULL;
         UINT16 BufferLen = 0;
-        Debug_GetSize(BufferLen);
+        BufferLen = Debug_GetSize();
         UINT8 rbuf[BufferLen];
         #ifdef USING_PRINTF
             printf("BufferLen:%d!\n",BufferLen);

+ 19 - 39
src/hal_module_adapter.c

@@ -267,7 +267,7 @@ static void Debug_Write_Logfile(UINT8 * buf)
 {
 	UINT32 Count;
 	OSAFILE file;
-	osMutexAcquire(DebugFileMux, osWaitForever)
+	osMutexAcquire(DebugFileMux, osWaitForever);
 	file = OsaFopen("DebugFile","wb");
 	if(file!=NULL)
 	{
@@ -303,63 +303,43 @@ void Debug_printf(const UINT8 *format, ...)
 	va_end(args);
 	Debug_Write_Logfile(buf);
 }
-void Debug_GetSize(UINT16 *FileSize)
+UINT16 Debug_GetSize()
 {
+	UINT16 FileSize;
 	OSAFILE file;
+	osMutexAcquire(DebugFileMux, osWaitForever);
 	file = OsaFopen("DebugFile","rb");
 	FileSize = OsaFsize(file);
 	OsaFclose(file);
+	osMutexRelease(DebugFileMux);
+	return FileSize;
 }
 void Debug_Read_Logfile(UINT8 * rbuf,UINT16 FileSize)
 {
-	int32_t err;
 	UINT32 Count;
 	OSAFILE file;
-	UINT8 * flag_p;
-	UINT16 pri_l; 
 	printf("%s start\r\n",__FUNCTION__);
-	while(DebugFileNux){
-		 osDelay(10/portTICK_PERIOD_MS);
-	}
-	DebugFileNux=1;
+	osMutexAcquire(DebugFileMux, osWaitForever);
 	file = OsaFopen("DebugFile","rb");
-	if(file==NULL){
-		printf("blLog not exst!\r\n");
-		DebugFileNux=0;
-		return;
-	}
-	if(OsaFseek(file, 0, SEEK_SET) != 0)
+	if(file!=NULL)
 	{
-	    printf("Seek file failed [%d] \r\n",__LINE__);
-	    OsaFclose(file);
-	    DebugFileNux=0;
-	    return;
+		if(OsaFseek(file, 0, SEEK_SET) == 0)
+		{
+			memset(rbuf,0,FileSize);
+			Count = OsaFread(rbuf, 1, FileSize, file);
+			printf("%s",rbuf);
+		}
+		OsaFclose(file);
 	}
-	memset(rbuf,0,FileSize);
-	Count = OsaFread(rbuf, 1, FileSize, file);
-	printf("%s",rbuf);
-				
-	OsaFclose(file);
-	DebugFileNux=0;
 	printf("%s end! \r\n",__FUNCTION__);
+	osMutexRelease(DebugFileMux);
+	return;
 }
 void Debug_Del_Logfile(void)
 {
-	UINT32 ret;
-	//printf("%s start! \r\n",__FUNCTION__);
-	while(DebugFileNux){
-		 osDelay(10/portTICK_PERIOD_MS);
-	}
-	DebugFileNux=1;
+	osMutexAcquire(DebugFileMux, osWaitForever);
 	OsaFremove("DebugFile");
-	DebugFileNux=0;
-	FaultDisplay(LED_TURN_OFF);
-	 osDelay(1000/portTICK_PERIOD_MS);
-	FaultDisplay(LED_TURN_ON);
-	 osDelay(1000/portTICK_PERIOD_MS);
-	FaultDisplay(LED_TURN_OFF);
-	 osDelay(1000/portTICK_PERIOD_MS);
-	FaultDisplay(LED_TURN_ON);
+	osMutexRelease(DebugFileMux);
 }
 #endif
 #ifdef BL_FILE_LOG