rtos和linux下存储文件路径加入存储设备切换逻辑
This commit is contained in:
		
							parent
							
								
									85230bb460
								
							
						
					
					
						commit
						2a20d7fd2a
					
				| 
						 | 
				
			
			@ -75,6 +75,7 @@
 | 
			
		|||
#include <sf_message_queue.h>
 | 
			
		||||
#include <sf_param_struct.h>
 | 
			
		||||
#include "sf_sd_common.h"
 | 
			
		||||
#include <sf_mmc_dev.h>
 | 
			
		||||
#endif
 | 
			
		||||
#if (LOGFILE_FUNC==ENABLE)
 | 
			
		||||
#include "LogFile.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
 | 
			
		||||
	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)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,11 @@
 | 
			
		|||
#include "sf_fileMng.h"
 | 
			
		||||
#include "sf_storeMng.h"
 | 
			
		||||
 | 
			
		||||
#include "sf_mmc_dev.h"
 | 
			
		||||
#include <sf_param_common.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,7 @@
 | 
			
		|||
#include <io/gpio.h>
 | 
			
		||||
#include "UIInfo/UIInfo.h"
 | 
			
		||||
#include <FileSysTsk.h>
 | 
			
		||||
#include "sf_sd_common.h"
 | 
			
		||||
 | 
			
		||||
SF_CALLBACK_SD_CMD g_fpSd_Exist_CB = NULL;
 | 
			
		||||
static int formatSD = CMD_FORMAT_SD_ERR;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@
 | 
			
		|||
#include "UIAppPhoto_Param.h"
 | 
			
		||||
#include "sys_fwload.h"
 | 
			
		||||
#include "../lfqueue/lfqueue.h"
 | 
			
		||||
 | 
			
		||||
#include "sf_sd_common.h"
 | 
			
		||||
 | 
			
		||||
#include <sys_linuxboot.h>
 | 
			
		||||
#include <libfdt.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,8 @@
 | 
			
		|||
#if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
#include <sf_mcu.h>
 | 
			
		||||
#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];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -43,11 +43,15 @@
 | 
			
		|||
//#include <io/gpio.h>
 | 
			
		||||
#include "UIInfo/UIInfo.h"
 | 
			
		||||
#include <FileSysTsk.h>
 | 
			
		||||
#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;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user