|
@@ -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
|