diff --git a/rtos/code/application/source/cardv/SrcCode/System/rtos-main.c b/rtos/code/application/source/cardv/SrcCode/System/rtos-main.c index 2b09d76d2..758ea9946 100644 --- a/rtos/code/application/source/cardv/SrcCode/System/rtos-main.c +++ b/rtos/code/application/source/cardv/SrcCode/System/rtos-main.c @@ -911,7 +911,9 @@ void Nvti2c_DevPowerOnReset(UINT32 GpioI2cCLK, UINT32 GpioI2cDAT) static void fastboot(void) { VK_TASK_HANDLE handle_photo_filenaming = 0; + VK_TASK_HANDLE handle_photo_filenaming2 = 0; VK_TASK_HANDLE handle_movie_filenaming = 0; + VK_TASK_HANDLE handle_movie_filenaming2 = 0; VK_TASK_HANDLE handle_movie_moviemode = 0; #if (FASTBOOT_USB_FUNC == ENABLE) VK_TASK_HANDLE handle_usb_msdcmode = 0; @@ -977,7 +979,7 @@ static void fastboot(void) #endif // wait all text-code loaded - fwload_wait_done(CODE_SECTION_10); + fwload_wait_done(CODE_SECTION_05); handle_photo_filenaming = vos_task_create(PhotoFast_InitFileNamingThread, "init_fn", NULL, 10, DEFAULT_STASK_SIZE); if(!handle_photo_filenaming){ @@ -986,6 +988,13 @@ static void fastboot(void) else vos_task_resume(handle_photo_filenaming); + handle_photo_filenaming2 = vos_task_create(PhotoFast_InitFileNamingThread2, "init_fn", NULL, 10, DEFAULT_STASK_SIZE); + if(!handle_photo_filenaming2){ + DBG_ERR("create PhotoFast_InitFileNamingThread2 failed\n"); + } + else + vos_task_resume(handle_photo_filenaming2); + break; case DX_HUNTING_MODE_MOVIE2: case DX_HUNTING_MODE_MOVIE: @@ -1013,6 +1022,12 @@ static void fastboot(void) else vos_task_resume(handle_movie_filenaming); + handle_movie_filenaming2 = vos_task_create(MovieFast_InitFileNamingThread2, "init_fn2", NULL, 10, 8192); + if (!handle_movie_filenaming2) { + DBG_ERR("create MovieFast_InitFileNamingThread2 failed\r\n"); + } + else + vos_task_resume(handle_movie_filenaming2); handle_movie_moviemode = vos_task_create(MovieFast_InitMovieModeThread, "init_movie", NULL, 10, 8192); if (!handle_movie_moviemode) { diff --git a/rtos/code/application/source/cardv/SrcCode/System/sys_fastboot.h b/rtos/code/application/source/cardv/SrcCode/System/sys_fastboot.h index 5dd833bb8..935fdba72 100644 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_fastboot.h +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_fastboot.h @@ -2,13 +2,16 @@ #define SYS_FASTBOOT_H typedef enum _BOOT_INIT_ { - BOOT_INIT_SYSTEM, + BOOT_INIT_INVALID = -1, + BOOT_INIT_SYSTEM = 0, BOOT_INIT_SENSOR, BOOT_INIT_CAPTURE, BOOT_INIT_DISPLAY, BOOT_INIT_STORAGE, BOOT_INIT_FILESYSOK, + BOOT_INIT_FILESYSOK_2, BOOT_INIT_FILENAMINGOK, + BOOT_INIT_FILENAMINGOK_2, BOOT_INIT_MEIDA_ENCODER, BOOT_INIT_MEIDA_DECODER, BOOT_INIT_BOOTLOGO, 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 6511fedcf..c2f2138e7 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_filesys.c @@ -26,7 +26,7 @@ #define GPIO_CARD_INSERT_LEVEL (FALSE) // low active #define MAX_OPENED_FILE_NUM 10 -static THREAD_HANDLE task_hdl; +static THREAD_HANDLE task_hdl, task_hdl2; static void card_insert_job(void) { @@ -34,7 +34,7 @@ static void card_insert_job(void) int ret; FILE_TSK_INIT_PARAM Param = {0}; - FS_HANDLE StrgDXH, StrgDXH2; + FS_HANDLE StrgDXH; printf("filesys_init b\r\n"); memset(&Param, 0, sizeof(FILE_TSK_INIT_PARAM)); @@ -44,49 +44,6 @@ static void card_insert_job(void) StrgDXH = (FS_HANDLE)sdio_getStorageObject(STRG_OBJ_FAT1); #endif -#if FS_MULTI_STRG_FUNC - StrgDXH2 = (FS_HANDLE)sdio2_getStorageObject(STRG_OBJ_FAT1); - - - DBG_WRN("sdio2_getStorageObject\n"); - { - UINT32 totoal_sectors = 0; -// UINT32 uiPhyAddr = 0; -// UINT32 uiPhySize = 0; -// unsigned long long partition_ofs= 0, partition_size = 0; -// unsigned long long usr_area_size = 0; - STORAGE_OBJ* pStrg = sdio2_getStorageObject(STRG_OBJ_FAT1); -// void *strg_mem = malloc(0x300); - -// pStrg->SetParam(STRG_SET_MEMORY_REGION, (UINT32)strg_mem, 0x300); - pStrg->Open(); //for initial emmc speed up, should open first, and then set partition - pStrg->GetParam(STRG_GET_DEVICE_PHY_SECTORS, (UINT32)&totoal_sectors, 0); - if (totoal_sectors == 0) { - DBG_WRN("totoal_sectors couldn't be zero\n"); - } - - DBG_WRN("storage_partition_init: totoal_sectors = %d\r\n", totoal_sectors); - pStrg->SetParam(STRG_SET_PARTITION_SECTORS, 16, totoal_sectors - 16); -// pStrg->Close(); - - //set the FAT size -// ret = storage_get_partition_addr(&partition_ofs, &partition_size, PARTITION_PATH_ROOTFSL1); -// usr_area_size = (unsigned long long)totoal_sectors*(unsigned long long)_EMBMEM_BLK_SIZE_; -// uiPhyAddr = partition_ofs/_EMBMEM_BLK_SIZE_; -// uiPhySize = (usr_area_size - partition_ofs)/_EMBMEM_BLK_SIZE_; -// if (ret == 0) { -// pStrg = EMB_GETSTRGOBJ(STRG_OBJ_FW_FAT); -// pStrg->SetParam(STRG_SET_MEMORY_REGION, (UINT32)strg_mem, STRG_MEM_SIZE); -// pStrg->SetParam(STRG_SET_PARTITION_SECTORS, uiPhyAddr, uiPhySize); -// } else { -// DBG_ERR("Cat get the %s path info\r\n", PARTITION_PATH_ROOTFSL1); -// } - } - - -#endif - - uiPoolAddr = mempool_filesys; Param.FSParam.WorkBuf = uiPoolAddr; Param.FSParam.WorkBufSize = (POOL_SIZE_FILESYS); @@ -108,21 +65,33 @@ static void card_insert_job(void) FileSys_SetParamEx('A', FST_PARM_UPDATE_FSINFO , TRUE); SF_RtosStrgRegister(0, ret); -#if HUNTING_CAMERA_MCU == ENABLE - //if(TRUE == sf_check_card_full()) - //{ - //DBG_WRN("ERR card full\r\n"); - fastboot_set_done(BOOT_INIT_FILESYSOK); - //} - //else - //{ - - // sf_log_confg(); - // sf_log_open(); - //} -#endif + printf("filesys_init e\r\n"); +} + +static void card_insert_job2(void) +{ #if FS_MULTI_STRG_FUNC + UINT32 uiPoolAddr; + int ret; + FILE_TSK_INIT_PARAM Param = {0}; + FS_HANDLE StrgDXH2; + UINT32 start_sector = 16 ; /* linux cmd fdisk can list partition info */ + UINT32 totoal_sectors = 0; + StrgDXH2 = (FS_HANDLE)sdio2_getStorageObject(STRG_OBJ_FAT1); + STORAGE_OBJ* pStrg = sdio2_getStorageObject(STRG_OBJ_FAT1); + + printf("filesys2_init b\r\n"); + memset(&Param, 0, sizeof(FILE_TSK_INIT_PARAM)); + + pStrg->Open(); + pStrg->GetParam(STRG_GET_DEVICE_PHY_SECTORS, (UINT32)&totoal_sectors, 0); + if (totoal_sectors == 0) { + DBG_WRN("totoal_sectors couldn't be zero\n"); + } + + pStrg->SetParam(STRG_SET_PARTITION_SECTORS, start_sector, totoal_sectors - start_sector); + uiPoolAddr = mempool_filesys + POOL_SIZE_FILESYS; Param.FSParam.WorkBuf = uiPoolAddr; Param.FSParam.WorkBufSize = (POOL_SIZE_FILESYS); @@ -132,22 +101,19 @@ static void card_insert_job(void) strncpy(Param.FSParam.szMountPath, "/mnt/sd2", sizeof(Param.FSParam.szMountPath) - 1); //only used by FsLinux Param.FSParam.szMountPath[sizeof(Param.FSParam.szMountPath) - 1] = '\0'; Param.FSParam.MaxOpenedFileNum = MAX_OPENED_FILE_NUM; -// if (FST_STA_OK != FileSys_Init(FileSys_GetOPS_uITRON())) { -// printf("FileSys_Init failed\r\n"); -// } DBG_WRN("Open B:\n"); ret = FileSys_OpenEx('B', StrgDXH2, &Param); if (FST_STA_OK != ret) { printf("FileSys_Open err %d\r\n", ret); } - // call the function to wait init finish + FileSys_WaitFinishEx('B'); SF_RtosStrgRegister(1, ret); -// FileSys_SetParamEx('B', FST_PARM_UPDATE_FSINFO , TRUE); + fastboot_set_done(BOOT_INIT_FILESYSOK_2); + printf("filesys2_init e\r\n"); + #endif - //fastboot_set_done(BOOT_INIT_FILESYSOK); - DBG_WRN("filesys_init e\r\n"); } #if !defined(_EMBMEM_EMMC_) @@ -200,6 +166,15 @@ static void sys_detect_card_task(void) THREAD_RETURN(0); #endif } + +static void sys_detect_card_task2(void) +{ + THREAD_ENTRY(); + card_insert_job2(); + THREAD_RETURN(0); +} + + #endif void filesys_init(void) @@ -231,6 +206,9 @@ void filesys_init(void) if(DrvGPIO_GetHuntingWorkMode() != HUNTING_NORMAL_MODE){ task_hdl = vos_task_create(sys_detect_card_task, 0, "SysDetectCard", 12, 4096); vos_task_resume(task_hdl); + + task_hdl2 = vos_task_create(sys_detect_card_task2, 0, "SysDetectCard2", 12, 4096); + vos_task_resume(task_hdl2); } #endif 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 d5ca7334d..63e0abaf7 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.c @@ -101,11 +101,11 @@ static lfqueue_t write_queue = {0}; #define STKSIZE_MOVIEFAST_CMDTSK 8192 #define MOVIEFAST_REC_SEC 10 -//local variable -static DCF_HANDLE g_dcf_hdl = 0; + +DCF_HANDLE g_dcf_hdl = -1; #if (FS_MULTI_STRG_FUNC) -static DCF_HANDLE g_dcf_hdl2 = 0; +DCF_HANDLE g_dcf_hdl2 = -1; #endif static ID MOVIEFAST_FLG_ID = 0; @@ -875,6 +875,50 @@ static DCF_HANDLE MovieFast_Get_DCF_Handle(void) DBG_WRN("photofast DCF_GET_HANDLE, %d\n", mmc_dev->dcf_handle); return mmc_dev->dcf_handle; } +INT32 MovieFast_Wait_FileSys(UINT32 timeout_ms) +{ + DCF_HANDLE handle = MovieFast_Get_DCF_Handle(); + BOOT_INIT boot_init = BOOT_INIT_INVALID; + + if(handle == g_dcf_hdl){ + boot_init = BOOT_INIT_FILESYSOK; + } +#if (FS_MULTI_STRG_FUNC) + else if(handle == g_dcf_hdl2){ + boot_init = BOOT_INIT_FILESYSOK_2; + } +#endif + + + if(boot_init != BOOT_INIT_INVALID) + return fastboot_wait_done_timeout(boot_init, timeout_ms); + else{ + DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); + return E_SYS; + } +} + +INT32 MovieFast_Wait_FileNaming(UINT32 timeout_ms) +{ + DCF_HANDLE handle = MovieFast_Get_DCF_Handle(); + BOOT_INIT boot_init = BOOT_INIT_INVALID; + + if(handle == g_dcf_hdl){ + boot_init = BOOT_INIT_FILENAMINGOK; + } +#if (FS_MULTI_STRG_FUNC) + else if(handle == g_dcf_hdl2){ + boot_init = BOOT_INIT_FILENAMINGOK_2; + } +#endif + + if(boot_init != BOOT_INIT_INVALID) + return fastboot_wait_done_timeout(boot_init, timeout_ms); + else{ + DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); + return E_SYS; + } +} static void MovieFast_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName) { @@ -1018,7 +1062,7 @@ static void MovieFast_WriteFile_Task(void* arg) lfqueue_t* queue = (lfqueue_t*)arg; MOVIEFAST_WRITE_QUEUE_PARAM* param; - fastboot_wait_done(BOOT_INIT_FILESYSOK); + MovieFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS); #if HUNTING_CAMERA_MCU == ENABLE if(TRUE == sf_is_card_full()) { @@ -1183,7 +1227,7 @@ static void MovieFast_UserEventCb(UINT32 id, MOVIE_USER_CB_EVENT event_id, UINT3 case MOVIE_USER_CB_EVENT_FILENAMING_EMR_CB: { CHAR *pFileName = (CHAR *) value; - if(fastboot_wait_done_timeout(BOOT_INIT_FILENAMINGOK, FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) == E_OK){ + if(MovieFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) == E_OK){ MovieFast_FileNamingCB(id, pFileName); } else{ @@ -1213,64 +1257,101 @@ int MovieFast_GetWaterLogoSource(const UINT32 recWidth,WATERLOGO_BUFFER *waterSr return E_OK; } +static void MovieFast_FileNaming_Init(void) +{ + static UINT8 is_init = 0; + + if(is_init == 1) + return; + + is_init = 1; + + DCF_InstallID(); + DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FOLDER, TRUE); + DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FILE, TRUE); + DCF_SetParm(DCF_PRMID_SET_VALID_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_MP4|DCF_FILE_TYPE_MOV); + DCF_SetParm(DCF_PRMID_SET_DEP_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_WAV|DCF_FILE_TYPE_MPO); + DCF_SetDirFreeChars(DCF_DIR_NAME); + DCF_SetFileFreeChars(DCF_FILE_TYPE_ANYFORMAT, DCF_FILE_NAME); +} THREAD_RETTYPE MovieFast_InitFileNamingThread(void *arg) { if(DrvGPIO_GetPhotoMovieModeFromMonitor() != DX_HUNTING_MODE_PHOTO_MOVIE ){ - if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ - goto EXIT; - } - - DCF_InstallID(); - DCF_OPEN_PARM dcfParm = { .Drive = 'A', .WorkbuffAddr = mempool_dcf, .WorkbuffSize = POOL_SIZE_DCF_BUFFER, }; - g_dcf_hdl = DCF_Open(&dcfParm); - DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FOLDER, TRUE); - DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FILE, TRUE); - DCF_SetParm(DCF_PRMID_SET_VALID_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_MP4|DCF_FILE_TYPE_MOV); - DCF_SetParm(DCF_PRMID_SET_DEP_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_WAV|DCF_FILE_TYPE_MPO); - DCF_SetDirFreeChars(DCF_DIR_NAME); - DCF_SetFileFreeChars(DCF_FILE_TYPE_ANYFORMAT, DCF_FILE_NAME); - DCF_ScanObj(); + fastboot_wait_done(BOOT_INIT_FILESYSOK); -#if (FS_MULTI_STRG_FUNC) - { - DCF_OPEN_PARM dcfParm = { - .Drive = 'B', - .WorkbuffAddr = mempool_dcf + POOL_SIZE_DCF_BUFFER, - .WorkbuffSize = POOL_SIZE_DCF_BUFFER, - }; - g_dcf_hdl2 = DCF_Open(&dcfParm); - if(g_dcf_hdl2 < 0){ - DBG_ERR("get dcf handle error!\n"); - } + MovieFast_FileNaming_Init(); - - DBG_WRN("DCF_ScanObjEx emmc handle=%d\n", g_dcf_hdl2); - DCF_ScanObjEx(g_dcf_hdl2); + if(g_dcf_hdl == -1){ + g_dcf_hdl = DCF_Open(&dcfParm); + DCF_ScanObjEx(g_dcf_hdl); + } + else{ + DBG_WRN("dcf handle1 is already opened\n"); } -#endif - - SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl); - SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2); #if HUNTING_CAMERA_MCU == ENABLE if(TRUE != sf_is_card_full()) #endif { + SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2); fastboot_set_done(BOOT_INIT_FILENAMINGOK); } } -EXIT: THREAD_RETURN(0); } + +THREAD_RETTYPE MovieFast_InitFileNamingThread2(void *arg) +{ + if(DrvGPIO_GetPhotoMovieModeFromMonitor() != DX_HUNTING_MODE_PHOTO_MOVIE ){ + +#if (FS_MULTI_STRG_FUNC) + + DCF_OPEN_PARM dcfParm = { + .Drive = 'B', + .WorkbuffAddr = mempool_dcf + POOL_SIZE_DCF_BUFFER, + .WorkbuffSize = POOL_SIZE_DCF_BUFFER, + }; + + fastboot_wait_done(BOOT_INIT_FILESYSOK_2); + + MovieFast_FileNaming_Init(); + + if(g_dcf_hdl2== -1){ + g_dcf_hdl2 = DCF_Open(&dcfParm); + if(g_dcf_hdl2 < 0){ + DBG_ERR("get dcf handle error!\n"); + } + } + else{ + DBG_WRN("dcf handle2 is already opened\n"); + } + + DBG_WRN("DCF_ScanObjEx emmc handle=%d\n", g_dcf_hdl2); + DCF_ScanObjEx(g_dcf_hdl2); + + #if HUNTING_CAMERA_MCU == ENABLE + if(TRUE != sf_is_card_full()) + #endif + { + SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl); + fastboot_set_done(BOOT_INIT_FILENAMINGOK_2); + } +#endif + } + + THREAD_RETURN(0); +} + + extern void Set_NIGHTMODE(UINT32 id, UINT8 isSnapVideo); extern void Set_AEMODE(UINT32 id); extern void setet_preset_param(void); diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.h b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.h index eb48373b0..2f6f312b1 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.h +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieFast/MovieFast.h @@ -11,6 +11,7 @@ #define FIX_RECORD_NOISE ENABLE extern THREAD_RETTYPE MovieFast_InitFileNamingThread(void *arg); +extern THREAD_RETTYPE MovieFast_InitFileNamingThread2(void *arg); extern THREAD_RETTYPE MovieFast_InitMovieModeThread(void *arg); typedef enum diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieStamp/MovieStamp.c b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieStamp/MovieStamp.c index 0a980b8c8..dc8c8a853 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/MovieStamp/MovieStamp.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/MovieStamp/MovieStamp.c @@ -194,6 +194,10 @@ static ER FontConv_LVGL(FONT_CONV_IN *pIn, FONT_CONV_OUT *pOut) draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; draw_cfg.string.align = LV_USER_CFG_STAMP_TEXT_ALIGN; + draw_cfg.mode = LV_USER_FONT_CONV_DRAW_TEXT; + extern uint32_t palette_define[]; + draw_cfg.img.palette = palette_define; + /************************************************ * Color setting convertion flow * lv user format argb4444 -> lv format 8888 -> lv format by LV_COLOR_DEPTH (332 or 8888) 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 486d71eeb..4d5a4014c 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.c @@ -89,10 +89,15 @@ static MEM_RANGE g_photo_fast_fdb_pool = { static CHAR g_photo_fast_write_file_Path[NMC_TOTALFILEPATH_MAX_LEN] = {0}; static INT32 g_photo_fast_id_mapping[PHOTO_CAP_ID_MAX] = {-1,-1}; static PHOTO_FILENAME_CB *g_fpPhotoFastFileNameCB = NULL; -static DCF_HANDLE g_dcf_hdl = 0; + + +/*************************************************** + * Get from MovieFast + **************************************************/ +extern DCF_HANDLE g_dcf_hdl; #if (FS_MULTI_STRG_FUNC) -static DCF_HANDLE g_dcf_hdl2 = 0; +extern DCF_HANDLE g_dcf_hdl2; #endif static HD_PATH_ID g_video_enc_path[PHOTO_ENC_JPG_TYPE_MAX_ID] = {0}; @@ -707,51 +712,82 @@ HD_RESULT PhotoFast_get_hd_common_buf(PPHOTOFAST_HD_COM_BUF p_hd_comm_buf) return HD_OK; } -INT32 PhotoFast_FileNaming_Open(void) +static void PhotoFast_FileNaming_Init(void) { + static UINT8 is_init = 0; + + if(is_init == 1) + return; + + is_init = 1; + DCF_InstallID(); - - DCF_OPEN_PARM dcfParm = { - .Drive = 'A', - .WorkbuffAddr = mempool_dcf, - .WorkbuffSize = POOL_SIZE_DCF_BUFFER, - }; - g_dcf_hdl = DCF_Open(&dcfParm); - if(g_dcf_hdl < 0){ - DBG_ERR("get dcf handle error!\n"); - } - DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FOLDER, TRUE); DCF_SetParm(DCF_PRMID_REMOVE_DUPLICATE_FILE, TRUE); DCF_SetParm(DCF_PRMID_SET_VALID_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_MP4|DCF_FILE_TYPE_MOV); DCF_SetParm(DCF_PRMID_SET_DEP_FILE_FMT, DCF_FILE_TYPE_JPG|DCF_FILE_TYPE_WAV|DCF_FILE_TYPE_MPO); DCF_SetDirFreeChars(DCF_DIR_NAME); DCF_SetFileFreeChars(DCF_FILE_TYPE_ANYFORMAT, DCF_FILE_NAME); - DCF_ScanObj(); +} +INT32 PhotoFast_FileNaming_Open(void) +{ + DCF_OPEN_PARM dcfParm = { + .Drive = 'A', + .WorkbuffAddr = mempool_dcf, + .WorkbuffSize = POOL_SIZE_DCF_BUFFER, + }; + + PhotoFast_FileNaming_Init(); + + if(g_dcf_hdl == -1){ + g_dcf_hdl = DCF_Open(&dcfParm); + if(g_dcf_hdl < 0){ + DBG_ERR("get dcf handle error!\n"); + } + + DCF_ScanObjEx(g_dcf_hdl); + SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl); + } + else{ + DBG_WRN("dcf handle1 is already opened\n"); + } + + return 0; +} + +INT32 PhotoFast_FileNaming_Open2(void) +{ #if (FS_MULTI_STRG_FUNC) - { - DCF_OPEN_PARM dcfParm = { - .Drive = 'B', - .WorkbuffAddr = mempool_dcf + POOL_SIZE_DCF_BUFFER, - .WorkbuffSize = POOL_SIZE_DCF_BUFFER, - }; + + DCF_OPEN_PARM dcfParm = { + .Drive = 'B', + .WorkbuffAddr = mempool_dcf + POOL_SIZE_DCF_BUFFER, + .WorkbuffSize = POOL_SIZE_DCF_BUFFER, + }; + + PhotoFast_FileNaming_Init(); + + if(g_dcf_hdl2 == -1){ g_dcf_hdl2 = DCF_Open(&dcfParm); if(g_dcf_hdl2 < 0){ DBG_ERR("get dcf handle error!\n"); } + DBG_WRN("DCF_ScanObjEx emmc handle=%d\n", g_dcf_hdl2); DCF_ScanObjEx(g_dcf_hdl2); - SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl); SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2); } + else{ + DBG_WRN("dcf handle2 is already opened\n"); + } + #endif - - return 0; } + INT32 PhotoFast_FileNaming_Close(void) { if(DrvGPIO_GetPhotoMovieModeFromMonitor() != DX_HUNTING_MODE_PHOTO_MOVIE ){ @@ -903,6 +939,50 @@ DCF_HANDLE PhotoFast_Get_DCF_Handle() DBG_WRN("photofast DCF_GET_HANDLE, %d\n", mmc_dev->dcf_handle); return mmc_dev->dcf_handle; } +INT32 PhotoFast_Wait_FileSys(UINT32 timeout_ms) +{ + DCF_HANDLE handle = PhotoFast_Get_DCF_Handle(); + BOOT_INIT boot_init = BOOT_INIT_INVALID; + + if(handle == g_dcf_hdl){ + boot_init = BOOT_INIT_FILESYSOK; + } +#if (FS_MULTI_STRG_FUNC) + else if(handle == g_dcf_hdl2){ + boot_init = BOOT_INIT_FILESYSOK_2; + } +#endif + + + if(boot_init != BOOT_INIT_INVALID) + return fastboot_wait_done_timeout(boot_init, timeout_ms); + else{ + DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); + return E_SYS; + } +} + +INT32 PhotoFast_Wait_FileNaming(UINT32 timeout_ms) +{ + DCF_HANDLE handle = PhotoFast_Get_DCF_Handle(); + BOOT_INIT boot_init = BOOT_INIT_INVALID; + + if(handle == g_dcf_hdl){ + boot_init = BOOT_INIT_FILENAMINGOK; + } +#if (FS_MULTI_STRG_FUNC) + else if(handle == g_dcf_hdl2){ + boot_init = BOOT_INIT_FILENAMINGOK_2; + } +#endif + + if(boot_init != BOOT_INIT_INVALID) + return fastboot_wait_done_timeout(boot_init, timeout_ms); + else{ + DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); + return E_SYS; + } +} INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path) { @@ -956,27 +1036,6 @@ INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, DCF_AddDBfileEx(handle, FilePath); DBG_DUMP("%s added to DCF\r\n", FilePath); } - -#if 0//FS_MULTI_STRG_FUNC - - if (DCF_GetDBInfoEx(g_dcf_hdl2, DCF_INFO_IS_9999)) { - DBG_ERR("Exceed max dcf file!\r\n"); - return FST_STA_NOFREE_SPACE; - } - else { - if (Fmt == HD_CODEC_TYPE_RAW){ - fileType = DCF_FILE_TYPE_RAW; - } - else{ - fileType = DCF_FILE_TYPE_JPG; - } - //DCF_GetNextIDEx(g_dcf_hdl2, &nextFolderID,&nextFileID); - DCF_MakeObjPathEx(g_dcf_hdl2, nextFolderID, nextFileID, fileType, FilePath2); - DCF_AddDBfileEx(g_dcf_hdl2, FilePath2); - DBG_DUMP("%s added to DCF2\r\n", FilePath2); - } -#endif - } else{ strncpy(FilePath, Path, sizeof(FilePath)); @@ -1484,6 +1543,18 @@ THREAD_RETTYPE PhotoFast_InitFileNamingThread(void *arg) THREAD_RETURN(0); } + +THREAD_RETTYPE PhotoFast_InitFileNamingThread2(void *arg) +{ + + fastboot_wait_done(BOOT_INIT_FILESYSOK_2); + PhotoFast_FileNaming_Open2(); + fastboot_set_done(BOOT_INIT_FILENAMINGOK_2); + + THREAD_RETURN(0); +} + + #include "kwrap/util.h" //extern void DrvGPIO_IRLed_Turn_Onoff(BOOL onoff); extern void DrvGOIO_Turn_Onoff_IRCUT(UINT8 onoff); diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.h b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.h index 280e32b9c..8ea0e3bbc 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.h +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFast.h @@ -53,6 +53,7 @@ typedef struct _PHOTOFAST_ENC_SET{ extern void PhotoFast_Cal_Jpg_Size(USIZE *psrc, USIZE *pdest , URECT *pdestwin); extern ER PhotoFast_Scale_YUV(VF_GFX_SCALE *pscale, HD_VIDEO_FRAME *psrc, PHOTOFAST_HD_COM_BUF *pComBufInfo, USIZE *pdest_sz, URECT *pdestwin, HD_VIDEO_PXLFMT pxl_fmt); extern THREAD_RETTYPE PhotoFast_InitFileNamingThread(void *arg); +extern THREAD_RETTYPE PhotoFast_InitFileNamingThread2(void *arg); extern THREAD_RETTYPE PhotoFast_EncodeBsPullThread(void *arg); extern THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg); extern void PhotoFast_PhotoClose(void); @@ -64,5 +65,7 @@ UINT32 PhotoFast_GetTriggerFrmCnt(VOID); extern UINT32 PhotoFast_GetTickBufSize(void); ER PhotoFast_Movie_Init(void); DCF_HANDLE PhotoFast_Get_DCF_Handle(void); +INT32 PhotoFast_Wait_FileSys(UINT32 timeout_ms); +INT32 PhotoFast_Wait_FileNaming(UINT32 timeout_ms); #endif //_UIAPP_PHOTO_H_ diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c index c9e94f248..af71e4420 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c @@ -1772,11 +1772,11 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* path); - if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ + if(PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ goto EXIT; } - if(fastboot_wait_done_timeout(BOOT_INIT_FILENAMINGOK, FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){ + if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ goto EXIT; } @@ -2248,7 +2248,7 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data) if(param->cnt >= param->max_cnt) break; #if SF_NO_SD_SEND == ENABLE - if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, 1) != E_OK){ + if(PhotoFast_Wait_FileSys(1) != E_OK){ goto EXIT; } #endif @@ -2274,6 +2274,8 @@ EXIT: memset(queue_ele_out, 0, sizeof(PhotoFast_SliceEncode_Queue23_Param)); queue_ele_out->comm.terminate = 1; lfqueue_enq(param->queue23, (void*) queue_ele_out); + extern void flow_preview_set_stop_flag(BOOL flag); + flow_preview_set_stop_flag(TRUE); } DBG_DUMP("task2 job finished\n"); @@ -2317,7 +2319,9 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data) ******************************************************************/ extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path); #if SF_NO_SD_SEND == ENABLE - if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK || fastboot_wait_done_timeout(BOOT_INIT_FILENAMINGOK, FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){ + if( + PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK || + PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ DBG_WRN("filesys not ready, store data into mem\n"); @@ -2333,11 +2337,11 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data) } else #else - if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ + if(PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ goto EXIT; } - if(fastboot_wait_done_timeout(BOOT_INIT_FILENAMINGOK, FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){ + if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ goto EXIT; } #endif diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h index dbd85a1fa..67367d511 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h @@ -33,7 +33,7 @@ INT32 PhotoFast_SliceEncode_Close(void); INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME *p_video_frame); INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info, const HD_VIDEO_FRAME src_frame); INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt); - +HD_DIM PhotoFast_SliceEncode_Get_Curr_Photo_Size(VOID); #if POWERON_FAST_SLICE_ENC_VER2 == ENABLE INT32 PhotoFast_SliceEncode2_Open(