From dc00b1cae7fbec86e5bc1f5e3c08d76b00cc8700 Mon Sep 17 00:00:00 2001 From: payton Date: Fri, 1 Dec 2023 14:30:10 +0800 Subject: [PATCH] =?UTF-8?q?1.rtos=E4=B8=8Blog=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/cardv/SrcCode/System/sys_filesys.c | 82 ++++++++++++++++++- .../source/cardv/SrcCode/System/sys_filesys.h | 3 +- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c index 817f049e1..468644420 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c @@ -13,6 +13,8 @@ #include "PrjCfg.h" #include "DxHunting.h" #if HUNTING_CAMERA_MCU == ENABLE +#include "PrjInc.h" +#include "wdt.h" #include #endif #if (HUNTING_CAMERA_MODEL == ENABLE) @@ -63,10 +65,17 @@ static void card_insert_job(void) if(TRUE == sf_check_card_full()) { printf("ERR card full\r\n"); + fastboot_set_done(BOOT_INIT_FILESYSOK); + } + else + { + fastboot_set_done(BOOT_INIT_FILESYSOK); + sf_log_confg(); + sf_log_open(); } #endif - fastboot_set_done(BOOT_INIT_FILESYSOK); + //fastboot_set_done(BOOT_INIT_FILESYSOK); printf("filesys_init e\r\n"); } @@ -167,3 +176,74 @@ void filesys_init(void) #endif FileDB_InstallID(); } +#if HUNTING_CAMERA_MCU == ENABLE + +static int SF_SX_TIMER_DET_SYSTEM_ERROR_ID = -1; +_ALIGNED(64) static CHAR gLogFile_Buff[LOGFILE_BUFFER_SIZE]= {0}; + +void sfSystem_DetErr(void); +SX_TIMER_ITEM(sfSystem_DetErr, sfSystem_DetErr,50, FALSE) + +void sfSystem_DetErr(void) +{ + +} +void sf_log_confg(void) +{ + #if (LOGFILE_FUNC==ENABLE) + UIMenuStoreInfo *puiPara = sf_ui_para_get(); + if(puiPara->DebugMode) + { + LOGFILE_CFG cfg = {0}; + cfg.ConType = LOGFILE_CON_UART|LOGFILE_CON_STORE; + cfg.TimeType = LOGFILE_TIME_TYPE_DATETIME; + cfg.LogBuffAddr = (UINT32)gLogFile_Buff; + cfg.LogBuffSize = sizeof(gLogFile_Buff); + + LogFile_Config(&cfg); + + SF_SX_TIMER_DET_SYSTEM_ERROR_ID = SxTimer_AddItem(&Timer_sfSystem_DetErr); + + } + #endif +} + +void sf_log_open(void) +{ +#if (LOGFILE_FUNC==ENABLE) + + UIMenuStoreInfo *puiPara = sf_ui_para_get(); + + if ((puiPara->DebugMode) && SxTimer_GetFuncActive(SF_SX_TIMER_DET_SYSTEM_ERROR_ID) == 0) + { + LOGFILE_OPEN logOpenParm = {0}; + UINT32 maxFileNum = 32; + UINT32 maxFileSize = 0x100000; // 1MB + CHAR rootDir[LOGFILE_ROOT_DIR_MAX_LEN + 1] = "A:\\LOG\\"; + #if defined(_CPU2_LINUX_) + CHAR rootDir2[LOGFILE_ROOT_DIR_MAX_LEN + 1] = "A:\\Novatek\\LOG2\\"; + #endif + CHAR sysErrRootDir[LOGFILE_ROOT_DIR_MAX_LEN + 1] = "A:\\SYS\\"; + + logOpenParm.maxFileNum = maxFileNum; + logOpenParm.maxFileSize = maxFileSize; + logOpenParm.isPreAllocAllFiles = FALSE; + logOpenParm.isSaveLastTimeSysErrLog = wdt_getResetNum()>0 ? TRUE : FALSE; + logOpenParm.lastTimeSysErrLogBuffAddr = mempool_logfile; + logOpenParm.lastTimeSysErrLogBuffSize = POOL_SIZE_LOGFILE; + logOpenParm.isZeroFile = TRUE; + strncpy(logOpenParm.rootDir, rootDir, LOGFILE_ROOT_DIR_MAX_LEN); + #if defined(_CPU2_LINUX_) + strncpy(logOpenParm.rootDir2, rootDir2, LOGFILE_ROOT_DIR_MAX_LEN); + #endif + strncpy(logOpenParm.sysErrRootDir, sysErrRootDir, LOGFILE_ROOT_DIR_MAX_LEN); + LogFile_Open(&logOpenParm); + + //start scan + SxTimer_SetFuncActive(SF_SX_TIMER_DET_SYSTEM_ERROR_ID, TRUE); + sf_para_print(); + } +#endif +} + +#endif \ No newline at end of file diff --git a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.h b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.h index f2ac616cd..acbddd5ea 100644 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.h +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.h @@ -2,5 +2,6 @@ #define SYS_FILESYS_H void filesys_init(void); - +void sf_log_open(void); +void sf_log_confg(void); #endif \ No newline at end of file