1.rtos下的Logfile功能
This commit is contained in:
		
							parent
							
								
									09be0f47b7
								
							
						
					
					
						commit
						cc4e643ce4
					
				| 
						 | 
				
			
			@ -486,7 +486,7 @@ void System_OnStrgExit_FS(void)
 | 
			
		|||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
        LogFile_Close();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -640,7 +640,7 @@ INT32 System_OnStrgRemove(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
 | 
			
		|||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
			LogFile_Suspend();
 | 
			
		||||
			LogFile_Close();
 | 
			
		||||
| 
						 | 
				
			
			@ -787,7 +787,7 @@ INT32 System_OnStrgAttach(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
 | 
			
		|||
        #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    	UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
 | 
			
		||||
		if ((puiPara->DebugMode) && SxTimer_GetFuncActive(SX_TIMER_DET_SYSTEM_ERROR_ID) == 0)
 | 
			
		||||
		if ((puiPara->AutoLogSwitch) && SxTimer_GetFuncActive(SX_TIMER_DET_SYSTEM_ERROR_ID) == 0)
 | 
			
		||||
        #else
 | 
			
		||||
        if (SxTimer_GetFuncActive(SX_TIMER_DET_SYSTEM_ERROR_ID) == 0)
 | 
			
		||||
        #endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,6 +114,48 @@ extern void eac_set_phypower(BOOL b_en);
 | 
			
		|||
#if (defined(_NVT_ETHREARCAM_TX_)) && (ETHCAM_EIS == ENABLE)
 | 
			
		||||
extern int gyro_init(void);
 | 
			
		||||
#endif
 | 
			
		||||
_ALIGNED(64) static CHAR gLogFile_Buff[LOGFILE_BUFFER_SIZE]= {0};
 | 
			
		||||
 | 
			
		||||
void sf_log_confgs(void)
 | 
			
		||||
{
 | 
			
		||||
    #if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
	{
 | 
			
		||||
        DBG_WRN("SwTimer_Init\n");
 | 
			
		||||
        SwTimer_Init();         // sw timer
 | 
			
		||||
        {
 | 
			
		||||
            LOGFILE_OPEN    logOpenParm = {0};
 | 
			
		||||
            LOGFILE_CFG   cfg = {0};
 | 
			
		||||
            UINT32          maxFileNum = 32;
 | 
			
		||||
            UINT32          maxFileSize = 0x100000; // 1MB
 | 
			
		||||
            CHAR            rootDir[LOGFILE_ROOT_DIR_MAX_LEN + 1] = "A:\\LOG\\";
 | 
			
		||||
            CHAR            sysErrRootDir[LOGFILE_ROOT_DIR_MAX_LEN + 1] = "A:\\SYS\\";
 | 
			
		||||
            cfg.ConType = LOGFILE_CON_MEM | LOGFILE_CON_UART;
 | 
			
		||||
            cfg.TimeType = LOGFILE_TIME_TYPE_DATETIME;
 | 
			
		||||
            cfg.LogBuffAddr = (UINT32)gLogFile_Buff;
 | 
			
		||||
            cfg.LogBuffSize = sizeof(gLogFile_Buff);
 | 
			
		||||
 | 
			
		||||
            DBG_WRN("LogFile_Config\n");
 | 
			
		||||
            LogFile_Config(&cfg);
 | 
			
		||||
 | 
			
		||||
            logOpenParm.maxFileNum = maxFileNum;
 | 
			
		||||
            logOpenParm.maxFileSize = maxFileSize;
 | 
			
		||||
            logOpenParm.isPreAllocAllFiles = FALSE;
 | 
			
		||||
            logOpenParm.isSaveLastTimeSysErrLog  = FALSE;
 | 
			
		||||
            logOpenParm.lastTimeSysErrLogBuffAddr = 0;
 | 
			
		||||
            logOpenParm.lastTimeSysErrLogBuffSize = 0;
 | 
			
		||||
            logOpenParm.isZeroFile = TRUE;
 | 
			
		||||
            strncpy(logOpenParm.rootDir, rootDir, LOGFILE_ROOT_DIR_MAX_LEN);
 | 
			
		||||
            strncpy(logOpenParm.sysErrRootDir, sysErrRootDir, LOGFILE_ROOT_DIR_MAX_LEN);
 | 
			
		||||
 | 
			
		||||
            DBG_WRN("LogFile_Open\n");
 | 
			
		||||
            LogFile_Open(&logOpenParm);
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
    #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void insmod_system(void)
 | 
			
		||||
{
 | 
			
		||||
#if (HUNTING_CAMERA_MODEL == ENABLE)
 | 
			
		||||
| 
						 | 
				
			
			@ -196,14 +238,14 @@ static void insmod_system(void)
 | 
			
		|||
    		DBG_ERR("open hwclock failed!\n");
 | 
			
		||||
    	}
 | 
			
		||||
    	else{
 | 
			
		||||
            #if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
 | 
			
		||||
            #if 1//HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
 | 
			
		||||
    		struct tm current_time = {0};
 | 
			
		||||
    		struct tm current_time2 = {0};
 | 
			
		||||
 | 
			
		||||
    		current_time.tm_year = 2001;
 | 
			
		||||
    		current_time.tm_mon = 12;
 | 
			
		||||
    		current_time.tm_mday = 30;
 | 
			
		||||
    		current_time.tm_hour = 6;
 | 
			
		||||
    		current_time.tm_year = 2023;
 | 
			
		||||
    		current_time.tm_mon = 1;
 | 
			
		||||
    		current_time.tm_mday = 1;
 | 
			
		||||
    		current_time.tm_hour = 8;
 | 
			
		||||
    		current_time.tm_min = 0;
 | 
			
		||||
    		current_time.tm_sec = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -216,6 +258,7 @@ static void insmod_system(void)
 | 
			
		|||
            #endif
 | 
			
		||||
 | 
			
		||||
    	}
 | 
			
		||||
 | 
			
		||||
    	vos_perf_list_mark("b_sys", __LINE__, 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1153,13 +1196,7 @@ void rtos_main(void)
 | 
			
		|||
        #if (POWERON_FAST_BOOT_MSG == DISABLE)
 | 
			
		||||
    	fastboot_msg_en(DISABLE);
 | 
			
		||||
        #endif
 | 
			
		||||
        #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
        UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
        if(puiPara->DebugMode == 0)
 | 
			
		||||
        {
 | 
			
		||||
            //fastboot_msg_en(DISABLE);
 | 
			
		||||
        }
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
		VK_TASK_HANDLE vkt_boot = vos_task_create(fastboot_thread, fastboot,  "boot",  9, 10240);
 | 
			
		||||
    	vos_task_resume(vkt_boot);
 | 
			
		||||
    	fastboot_wait_done(BOOT_FLOW_BOOT);
 | 
			
		||||
| 
						 | 
				
			
			@ -1169,12 +1206,6 @@ void rtos_main(void)
 | 
			
		|||
        #if (POWERON_FAST_BOOT_MSG == DISABLE)
 | 
			
		||||
    	fastboot_msg_en(ENABLE);
 | 
			
		||||
        #endif
 | 
			
		||||
        #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
        if(puiPara->DebugMode == 0)
 | 
			
		||||
        {
 | 
			
		||||
           // fastboot_msg_en(ENABLE);
 | 
			
		||||
        }
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
#if (FASTBOOT_KEYSCAN_FUNC == ENABLE)   // enable for keyscan / usb function, but need modify lds file
 | 
			
		||||
		flow_system_init();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -267,7 +267,7 @@ void sf_log_confg(void)
 | 
			
		|||
{
 | 
			
		||||
    #if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
	{
 | 
			
		||||
		LOGFILE_CFG   cfg = {0};
 | 
			
		||||
		cfg.ConType = LOGFILE_CON_UART|LOGFILE_CON_STORE;
 | 
			
		||||
| 
						 | 
				
			
			@ -289,7 +289,7 @@ void sf_log_open(void)
 | 
			
		|||
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
 | 
			
		||||
    if ((puiPara->DebugMode) && SxTimer_GetFuncActive(SF_SX_TIMER_DET_SYSTEM_ERROR_ID) == 0)
 | 
			
		||||
    if ((puiPara->AutoLogSwitch) && SxTimer_GetFuncActive(SF_SX_TIMER_DET_SYSTEM_ERROR_ID) == 0)
 | 
			
		||||
    {
 | 
			
		||||
        LOGFILE_OPEN    logOpenParm = {0};
 | 
			
		||||
        UINT32          maxFileNum = 32;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -750,7 +750,7 @@ UINT32 BackgroundFormat(void)
 | 
			
		|||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
        LogFile_Suspend();
 | 
			
		||||
        LogFile_Close();
 | 
			
		||||
| 
						 | 
				
			
			@ -788,7 +788,7 @@ UINT32 BackgroundFormat(void)
 | 
			
		|||
		//#NT#Support logfile function
 | 
			
		||||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
		LogFile_ReOpen();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -826,7 +826,7 @@ UINT32 BackgroundFormatCard(void)
 | 
			
		|||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
        LogFile_Suspend();
 | 
			
		||||
        LogFile_Complete();
 | 
			
		||||
| 
						 | 
				
			
			@ -864,7 +864,7 @@ UINT32 BackgroundFormatCard(void)
 | 
			
		|||
		//#NT#Support logfile function
 | 
			
		||||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
		LogFile_ReOpen();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -894,7 +894,7 @@ UINT32 BackgroundFormatNand(void)
 | 
			
		|||
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
        LogFile_Suspend();
 | 
			
		||||
        LogFile_Complete();
 | 
			
		||||
| 
						 | 
				
			
			@ -932,7 +932,7 @@ UINT32 BackgroundFormatNand(void)
 | 
			
		|||
		//#NT#Support logfile function
 | 
			
		||||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
    #if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
    if(puiPara->DebugMode)
 | 
			
		||||
    if(puiPara->AutoLogSwitch)
 | 
			
		||||
    {
 | 
			
		||||
		LogFile_ReOpen();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -321,6 +321,7 @@ static void MovieFast_ShutDown(void)
 | 
			
		|||
        {
 | 
			
		||||
            DBG_DUMP("LogFile_Close ...\n");
 | 
			
		||||
            LogFile_Suspend();
 | 
			
		||||
            LogFile_DumpToFile("A:\\Log.txt");
 | 
			
		||||
            LogFile_Close();
 | 
			
		||||
        }
 | 
			
		||||
        #endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2179,10 +2179,11 @@ static void PhotoFast_ShutDown(void)
 | 
			
		|||
        // DBG_DUMP("wait filesys close ...\n");
 | 
			
		||||
        #if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
        UIMenuStoreInfo *puiPara = sf_ui_para_get();
 | 
			
		||||
        if(puiPara->DebugMode)
 | 
			
		||||
        if(puiPara->AutoLogSwitch)
 | 
			
		||||
        {
 | 
			
		||||
            DBG_DUMP("LogFile_Close ...\n");
 | 
			
		||||
            LogFile_Suspend();
 | 
			
		||||
            LogFile_DumpToFile("A:\\Log.txt");
 | 
			
		||||
            LogFile_Close();
 | 
			
		||||
        }
 | 
			
		||||
        #endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -156,6 +156,8 @@ SECTIONS
 | 
			
		|||
        libzlib.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        libmem.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        libDbgUt.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        liblogfile.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        libSxTimer.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        /* driver */
 | 
			
		||||
        libdrv_portable.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
        libdrv_drtc.a (.text* .data* .data1* .rodata* .rodata1* .reginfo* .init* .exit*)
 | 
			
		||||
| 
						 | 
				
			
			@ -515,3 +517,6 @@ EXTERN("h264Enc_queryMemSize")
 | 
			
		|||
EXTERN("aud_set_default_setting")
 | 
			
		||||
EXTERN("eac_set_ad_config")
 | 
			
		||||
EXTERN("eac_set_phypower")
 | 
			
		||||
EXTERN("SwTimer_Init")
 | 
			
		||||
EXTERN("LogFile_Config")
 | 
			
		||||
EXTERN("LogFile_Open")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user