diff --git a/code/application/source/cardv/SrcCode/System/SysStrg_Exe.c b/code/application/source/cardv/SrcCode/System/SysStrg_Exe.c index fe4a9b0f2..e940a5390 100644 --- a/code/application/source/cardv/SrcCode/System/SysStrg_Exe.c +++ b/code/application/source/cardv/SrcCode/System/SysStrg_Exe.c @@ -75,6 +75,7 @@ #include #include #include "sf_sd_common.h" +#include #endif #if (LOGFILE_FUNC==ENABLE) #include "LogFile.h" diff --git a/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_Exe.c b/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_Exe.c index 9306ca6bf..31608796d 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_Exe.c +++ b/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_Exe.c @@ -37,6 +37,7 @@ #endif #include "vendor_videoout.h" #include "IOCfg.h" +#include "sf_mmc_dev.h" #define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER /////////////////////////////////////////////////////////////////////////////// @@ -1217,6 +1218,11 @@ BOOL MovieExe_CheckSNFull(void) static void MovieExe_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName) { + MMC_DEV_TYPE mmc_dev = sf_mmc_check_workable_dev(); + if(mmc_dev == MMC_DEV_NO) + { + DBG_ERR("No Strg dev can use!\n"); + } #if USE_FILEDB static struct tm CurDateTime = {0}; @@ -1226,10 +1232,19 @@ static void MovieExe_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName) g_FileSerialNum = FILE_SN_MAX; Ux_PostEvent(NVTEVT_CB_MOVIE_FULL, 0); } - GxTime_GetTime(&CurDateTime); #if(SENSOR_CAPS_COUNT>=2 || ((defined(_NVT_ETHREARCAM_RX_)) && (ETH_REARCAM_CAPS_COUNT >= 2))) - char NH_endChar='A'; + char NH_endChar='A'; + + if(mmc_dev == MMC_DEV_SD) + { + NH_endChar='A'; + } + else if(mmc_dev == MMC_DEV_EMMC) + { + NH_endChar='B'; + } + if(id < _CFG_REC_ID_MAX){ NH_endChar+=id; }else if(id <_CFG_CLONE_ID_MAX){ @@ -1247,8 +1262,16 @@ static void MovieExe_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName) CurDateTime.tm_hour, CurDateTime.tm_min, CurDateTime.tm_sec, g_FileSerialNum); #endif #elif USE_DCF + UINT32 dcf_path = 1; - UINT32 dcf_path = 1; /* 0:emmc 1:sd */ + if(mmc_dev == MMC_DEV_SD) + { + dcf_path = 1; /* 0:emmc 1:sd */ + } + else if(mmc_dev == MMC_DEV_EMMC) + { + dcf_path = 0; /* 0:emmc 1:sd */ + } UINT32 nextFolderID = 0, nextFileID = 0; if (DCF_GetDBInfoEx(dcf_path, DCF_INFO_IS_9999)) { diff --git a/code/application/source/sf_app/Makefile b/code/application/source/sf_app/Makefile index 0ee1de076..877ed739e 100755 --- a/code/application/source/sf_app/Makefile +++ b/code/application/source/sf_app/Makefile @@ -298,6 +298,7 @@ SRC = \ ./code/source/qrcodeMng/sf_qrcode.c \ ./code/source/qrcodeMng/split.c \ ./code/source/storeMng/sf_storeMng.c \ + ./code/source/storeMng/sf_mmc_dev.c \ ./code/source/ttyusb/sf_hal_ttyusb.c \ ./code/source/4gMng/sf_4g_lpa.c \ ./code/source/4gMng/sf_4G_sms_lpa_cmd.c \ diff --git a/code/application/source/sf_app/code/include/sf_mmc_dev.h b/code/application/source/sf_app/code/include/sf_mmc_dev.h index 16cbb8c7a..67d3ba384 100755 --- a/code/application/source/sf_app/code/include/sf_mmc_dev.h +++ b/code/application/source/sf_app/code/include/sf_mmc_dev.h @@ -76,7 +76,7 @@ typedef struct MMC_DEV_LOOP_STATE loop_state; }SF_ST_MMC_DEV; - +MMC_DEV_TYPE sf_mmc_check_workable_dev(void); #endif diff --git a/code/application/source/sf_app/code/source/storeMng/sf_mmc_dev.c b/code/application/source/sf_app/code/source/storeMng/sf_mmc_dev.c index 852a6462a..acce9090b 100755 --- a/code/application/source/sf_app/code/source/storeMng/sf_mmc_dev.c +++ b/code/application/source/sf_app/code/source/storeMng/sf_mmc_dev.c @@ -16,6 +16,11 @@ #include "sf_fileMng.h" #include "sf_storeMng.h" +#include "sf_mmc_dev.h" +#include + + + typedef struct { int event; @@ -24,12 +29,12 @@ typedef struct }STRG_CB_PARAM; -static SF_ST_MMC_DEV sf_mmc_dev[SF_ST_MMC_DEV] = {0}; +static SF_ST_MMC_DEV sf_mmc_dev[MMC_DEV_MAX_NUM] = {0}; -SINT32 sf_mmc_dev_space_check_full(const char *mountPath, SF_STORE_ATTR_S *pstoreattrs) +SINT32 sf_mmc_dev_space_check_full(const char *mountPath) { + SF_STORE_ATTR_S *pstoreattrs = NULL; SF_COMM_CHECK_POINTER(pstoreattrs,SF_FAILURE); - SINT32 fd = -1; UINT32 Isfull = 0; fd = open(mountPath, O_RDONLY,0); @@ -65,10 +70,10 @@ SINT32 sf_mmc_dev_space_check_full(const char *mountPath, SF_STORE_ATTR_S *pstor MLOGD("SDStatus = %d,SDFree = %d MB,SDTotalSize = %d MB\n", pstoreattrs->SDStatus, pstoreattrs->SDFree,pstoreattrs->SDTotalSize); - if(pstoreattrs.SDStatus != 0) - return pstoreattrs.SDStatus; + if(pstoreattrs->SDStatus != 0) + return pstoreattrs->SDStatus; - Isfull = (pstoreattrs.SDFree <= SD_WARNING_SPACE)?1:0; + Isfull = (pstoreattrs->SDFree <= SD_WARNING_SPACE)?1:0; return Isfull; } @@ -86,7 +91,7 @@ static int sf_mmc_dev_node_check(const char *devName) if (tryCnt < 0) { - HAL_MMC_LOG("no found %s\n", devName); + printf("no found %s\n", devName); return -1; } return ret; @@ -96,7 +101,7 @@ void sf_mmc_dev_register(SF_MESSAGE_BUF_S *pMessageBuf) { STRG_CB_PARAM strg_cb_param; - UIMenuStoreInfo *puiPara = sf_ui_para_get(); + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); strg_cb_param.event = pMessageBuf->arg1; strg_cb_param.dev_id = pMessageBuf->arg2; strg_cb_param.mounted_status = pMessageBuf->arg3; diff --git a/code/lib/source/sifar/Makefile b/code/lib/source/sifar/Makefile index 6f2ab65bf..12a051898 100755 --- a/code/lib/source/sifar/Makefile +++ b/code/lib/source/sifar/Makefile @@ -84,6 +84,7 @@ SRC = \ $(APP_DIR)/source/sf_app/code/source/qrcodeMng/sf_base64.c \ $(APP_DIR)/source/sf_app/code/source/paramMng/sf_param_common.c \ $(APP_DIR)/source/sf_app/code/source/commMng/sf_message_queue.c \ + $(APP_DIR)/source/sf_app/code/source/storeMng/sf_mmc_dev.c \ $(APP_DIR)/source/sf_app/code/source/commMng/sf_share_mem.c \ $(APP_DIR)/source/sf_app/code/source/fileMng/sf_fileMng.c \ $(APP_DIR)/source/sf_app/code/source/wifi/sf_data_transfer.c \ diff --git a/code/lib/source/sifar/code/source/common/sf_sd_common.c b/code/lib/source/sifar/code/source/common/sf_sd_common.c index 981b5d3e1..39a4ae4c9 100644 --- a/code/lib/source/sifar/code/source/common/sf_sd_common.c +++ b/code/lib/source/sifar/code/source/common/sf_sd_common.c @@ -43,6 +43,7 @@ #include #include "UIInfo/UIInfo.h" #include +#include "sf_sd_common.h" SF_CALLBACK_SD_CMD g_fpSd_Exist_CB = NULL; static int formatSD = CMD_FORMAT_SD_ERR; 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 ce0bf9376..e90e46ac0 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c @@ -21,6 +21,7 @@ #if (HUNTING_CAMERA_MODEL == ENABLE) #include "IOCfg.h" +#include "sf_sd_common.h" #define GPIO_CARD_INSERT_LEVEL (FALSE) // low active #define MAX_OPENED_FILE_NUM 10 diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c index fc41998b8..d190fff89 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c @@ -38,7 +38,7 @@ #include "UIAppPhoto_Param.h" #include "sys_fwload.h" #include "../lfqueue/lfqueue.h" - +#include "sf_sd_common.h" #include #include diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c index c847c3385..1b6b1a91e 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c @@ -41,6 +41,8 @@ #if HUNTING_CAMERA_MCU == ENABLE #include #include "sf_led.h" +#include "sf_sd_common.h" + #endif #if POWERON_FAST_SLICE_ENC == ENABLE @@ -884,7 +886,7 @@ void PhotoFast_FileNaming_SetSortBySN(CHAR *pDelimStr, UINT32 nDelimCount, UINT3 INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path) { FST_FILE fp; - INT32 rt; + INT32 rt = 0; UINT32 Length; CHAR FilePath[NMC_TOTALFILEPATH_MAX_LEN]; diff --git a/rtos/code/driver/na51089/include/sf_sd_common.h b/rtos/code/driver/na51089/include/sf_sd_common.h index 1789534b8..53e57b379 100755 --- a/rtos/code/driver/na51089/include/sf_sd_common.h +++ b/rtos/code/driver/na51089/include/sf_sd_common.h @@ -20,6 +20,8 @@ #ifndef _SF_SD_COMM_H_ #define _SF_SD_COMM_H_ +#define MMC_DEV_MAX_NUM (2) + typedef enum { MMC_DEV_SD = 0, @@ -63,4 +65,6 @@ typedef struct //MMC_DEV_LOOP_STATE loop_state; }SF_RTOS_ST_MMC_DEV; +int sf_rtos_mmc_dev_register(int devid, int mounted_state); +MMC_DEV_TYPE sf_rtos_mmc_check_workable_dev(void); #endif \ No newline at end of file diff --git a/rtos/code/driver/na51089/source/mcu/sf_sd_common.c b/rtos/code/driver/na51089/source/mcu/sf_sd_common.c index eaa2ef96b..b914a508b 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_sd_common.c +++ b/rtos/code/driver/na51089/source/mcu/sf_sd_common.c @@ -43,11 +43,15 @@ //#include #include "UIInfo/UIInfo.h" #include +#include "sf_sd_common.h" static BOOL IsCardFull = FALSE; SF_CALLBACK_SD_CMD g_fpSd_Exist_CB = NULL; extern BOOL DrvCARD_DetStrgCard(void); +static SF_RTOS_ST_MMC_DEV sf_mmc_dev[MMC_DEV_MAX_NUM] = {0}; + + BOOL sf_is_card_full(void) { //printf("[%s]:%d IsCardFull:%d\n", __FUNCTION__, __LINE__, IsCardFull); @@ -172,6 +176,8 @@ int sf_rtos_mmc_dev_register(int devid, int mounted_state) else{ sf_mmc_dev[devid].space_state = MMC_DEV_SPACE_STATE_NO_ENOUGH; } + + return 0; } MMC_DEV_TYPE sf_rtos_mmc_check_workable_dev(void) @@ -186,9 +192,9 @@ MMC_DEV_TYPE sf_rtos_mmc_check_workable_dev(void) } else { - if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) + //if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) { - workable_dev = MMC_DEV_EMMC; + //workable_dev = MMC_DEV_EMMC; } } } @@ -200,9 +206,9 @@ MMC_DEV_TYPE sf_rtos_mmc_check_workable_dev(void) } else { - if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) + //if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) { - workable_dev = MMC_DEV_SD; + //workable_dev = MMC_DEV_SD; } } } @@ -223,9 +229,9 @@ MMC_DEV_TYPE sf_rtos_mmc_check_workable_dev(void) } else { - if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) + //if(sf_mmc_dev[MMC_DEV_SD].loop_state == MMC_DEV_LOOP_STATE_ON) { - workable_dev = MMC_DEV_EMMC; + //workable_dev = MMC_DEV_EMMC; } } }