Merge branch 'Branch_S550_Fast_Emmc' of gitlab.sifar.tech:linux-em-group/s530-ntk into Branch_S550_Fast_Emmc

This commit is contained in:
payton 2024-01-12 17:49:45 +08:00
commit f00e46bffd
5 changed files with 187 additions and 175 deletions

View File

@ -924,7 +924,7 @@
#define HUNTING_MCU_UART ENABLE
#define HUNTING_IR_LED_940 ENABLE
#define SF_EXIF_MN_BUF_SIZE 256
#define SF_BASE_VERSION "7MR5RCwE102"
#define SF_BASE_VERSION "7MR5RCwE103"
#define HW_S530 DISABLE
#define DCF_DIR_NAME "MEDIA" /* 100MEDIA */
#define DCF_FILE_NAME "SYGW" /* SYFW0001.JPG */

View File

@ -691,54 +691,6 @@ int get_storage_type(void)
}
return mmc_dev->dev_type;
}
static void update_storage_sd_card(void)
{
const int storageType = get_storage_type();
const UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
UINT64 diskSize = 0;
UINT64 diskFree = 0;
if (MMC_DEV_NO == storageType)
{
return;
}
else if (MMC_DEV_SD == storageType)
{
if (cardStatus == CARD_REMOVED)
{
return;
}
else
{
diskSize = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
if (0 == diskSize)
{
return;/*sd card error*/
}
if (diskFree < (FREE_SIZE_MB*1024*1024))
{
return;/*sd card full*/
}
}
}
else if (MMC_DEV_EMMC == storageType)
{
diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
diskFree = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE);
if (0 == diskSize)
{
return;/*emmc error*/
}
if (diskFree < (FREE_SIZE_MB*1024*1024))
{
return;/*emmc full*/
}
}
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
set_normal_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum));
}
unsigned int check_sd_size(UINT64 diskSize)
{
@ -779,8 +731,20 @@ unsigned int check_sd_size(UINT64 diskSize)
}
return 0;
}
static void update_sd_card_status(lv_obj_t* obj)
static void update_sd_emmc_status(void)
{
UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
UINT64 diskSizeSd = 0;
UINT64 diskFreeSd = 0;
UINT64 diskSizeEmmc = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
UINT64 diskFreeEmmc = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE);
char * textLabel;
// char * textLabelError;
UINT16 idLeft;
UINT16 idRight;
BOOL setWarning = false;
lv_plugin_res_id res[] = {
LV_PLUGIN_IMG_ID_SF_SD_NO,
LV_PLUGIN_IMG_ID_SF_SD_2GB,
@ -793,76 +757,143 @@ static void update_sd_card_status(lv_obj_t* obj)
LV_PLUGIN_IMG_ID_SF_SD_256GB,
LV_PLUGIN_IMG_ID_SF_SD_FULL
};
UINT64 diskSize = 0;
UINT64 diskFree = 0;
unsigned int index = 0;
UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
if (cardStatus != CARD_REMOVED)
{
diskSize = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
//printf("[%s]SD Card disk size : %lld, disk free : %lld\n", __FUNCTION__, diskSize, diskFree);
if (0 == diskSize)
{
//printf("[%s]SD CARD ERROR :%lld\n", __FUNCTION__, diskSize);
lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_DIS);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "SD Card Error");
return;
}
else if (diskFree < (FREE_SIZE_MB*1024*1024))
{
//printf("[%s]SD CARD FULL :%lld\n", __FUNCTION__, diskFree);
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_SD_FULL);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "SD Card FULL");
return;
}
else
{
//printf("[%s]SD CARD NORMAL :%lld\n", __FUNCTION__, diskFree);
index = check_sd_size(diskSize);
}
}
else
{
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "No SD Card");
}
lv_plugin_img_set_src(obj, res[index]);
}
static void update_emmc_status(lv_obj_t* obj)
{
UINT64 diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
UINT64 diskFree = FileSys_GetDiskInfoEx('B', FST_INFO_FREE_SPACE);
//SF_ST_MMC_DEV *mmc_dev = SF_GetMMCDev();
//printf("[%s]EMMC disk size : %lld, disk free : %lld\n", __FUNCTION__, diskSize, diskFree);
//if (MMC_DEV_SPACE_STATE_NO_ENOUGH == mmc_dev->space_state)
if (0 == diskSize)
{
//printf("[%s]EMMC ERROR :%lld\n", __FUNCTION__, diskSize);
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "EMMC Error");
if(CARD_REMOVED == cardStatus)
{/*no sd card*/
if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024))
{/*emmc normal*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
idRight = LV_PLUGIN_IMG_ID_SF_SD_NO;
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (0 == diskSizeEmmc)
{/*emmc error*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_NO;
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
textLabel = "SD CARD Error";
// textLabelError = "EMMC Error, Please format it";
setWarning = true;
}
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024))
{/*emmc full*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_NO;
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
textLabel = "No SD Card";
// textLabelError = "";
setWarning = true;
}
else{
return;
}
}
else if(diskFree < (FREE_SIZE_MB*1024*1024))
{
//printf("[%s]EMMC FULL :%lld\n", __FUNCTION__, diskFree);
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_EMMC_FULL);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "EMMC FULL");
else{
diskSizeSd = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
diskFreeSd = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
{/*emmc normal sd normal*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
idRight = res[check_sd_size(diskSizeSd)];
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && 0 == diskSizeSd)
{/*emmc normal sd error*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (diskSizeEmmc > 0 && diskFreeEmmc >= (FREE_SIZE_MB*1024*1024) && diskFreeSd < (FREE_SIZE_MB*1024*1024))
{/*emmc normal sd full*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_EMMC;
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (0 == diskSizeEmmc && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
{/*emmc error sd normal*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (0 == diskSizeEmmc && 0 == diskSizeSd)
{/*emmc error sd error*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_DIS;
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
textLabel = "SD CARD Error";
// textLabelError = "EMMC and SD Card Error, Please format it";
setWarning = true;
}
else if (0 == diskSizeEmmc && 0 != diskSizeSd && diskFreeSd <= (FREE_SIZE_MB*1024*1024))
{/*emmc error sd full*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
idRight = LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS;
textLabel = "SD CARD Full";
// textLabelError = "EMMC Error, Please format it";
setWarning = true;
}
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && diskSizeSd > 0 && diskFreeSd >= (FREE_SIZE_MB*1024*1024))
{/*emmc full sd normal*/
idLeft = res[check_sd_size(diskSizeSd)];
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
textLabel = Get_FreePicNumString(g_uiFreePicNum);
// textLabelError = "";
setWarning = false;
}
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && 0 == diskSizeSd)
{/*emmc full sd error*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_DIS;
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
textLabel = "SD CARD Error";
// textLabelError = "SD Card Error, Please format it";
setWarning = true;
}
else if (diskFreeEmmc < (FREE_SIZE_MB*1024*1024) && diskFreeSd < (FREE_SIZE_MB*1024*1024))
{/*emmc full sd full*/
idLeft = LV_PLUGIN_IMG_ID_SF_SD_FULL;
idRight = LV_PLUGIN_IMG_ID_SF_EMMC_FULL;
textLabel = "SD CARD Full";
// textLabelError = "";
setWarning = true;
}
else
{
return;
}
}
lv_plugin_img_set_src(image_8_scr_uiflowphoto, idLeft);
lv_plugin_img_set_src(image_9_scr_uiflowphoto, idRight);
if (setWarning)
{
set_warning_label_text(label_6_scr_uiflowphoto);
}
//else if (MMC_DEV_MOUNT_STATE_UNMOUNTED == mmc_dev->moumted_state)
else
{
//printf("[%s]EMMC NORMAL :%lld\n", __FUNCTION__, diskFree);
lv_plugin_img_set_src(obj, LV_PLUGIN_IMG_ID_SF_SD_EMMC);
set_normal_label_text(label_6_scr_uiflowphoto);
}
lv_label_set_text(label_6_scr_uiflowphoto, textLabel);
}
static void update_storage_message(void)
{
if (1 == first_check_storage)
@ -880,7 +911,8 @@ static void update_storage_message(void)
if (g_SysStrg_Chg)
{
set_normal_label_text(label_6_scr_uiflowphoto);
if (cnt < 3){
if (cnt < 3)
{
printf("[================%d================]\n", cnt);
cnt++;
set_normal_label_text(label_6_scr_uiflowphoto);
@ -890,57 +922,13 @@ static void update_storage_message(void)
{
g_SysStrg_Chg = false;
cnt = 0;
first_check_storage = 0;
}
return;
}
if (MMC_DEV_SD == get_storage_type())
{
//printf("[%s]SD storage\n", __FUNCTION__);
update_emmc_status(image_9_scr_uiflowphoto);
update_sd_card_status(image_8_scr_uiflowphoto);
update_storage_sd_card();
}
else if (MMC_DEV_EMMC == get_storage_type())
{
//printf("[%s]EMMC storage\n", __FUNCTION__);
update_sd_card_status(image_9_scr_uiflowphoto);
update_emmc_status(image_8_scr_uiflowphoto);
update_storage_sd_card();
}
else
{
//printf("[%s]NO EMMC NO SD\n", __FUNCTION__);
const UINT32 cardStatus = System_GetState(SYS_STATE_CARD);
UINT64 diskSize = FileSys_GetDiskInfoEx('B', FST_INFO_DISK_SIZE);
if(0 == diskSize)
{
lv_plugin_img_set_src(image_8_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_EMMC_DIS);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "EMMC Error");
}
else
{
lv_plugin_img_set_src(image_8_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_EMMC_FULL);
set_warning_label_text(label_6_scr_uiflowphoto);
lv_label_set_text(label_6_scr_uiflowphoto, "EMMC FULL");
}
if (CARD_REMOVED == cardStatus)
{
lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_NO);
}
else
{
lv_plugin_img_set_src(image_9_scr_uiflowphoto, LV_PLUGIN_IMG_ID_SF_SD_DIS);
}
}
update_sd_emmc_status();
}
static void update_camera_message(void)
{
UIMenuStoreInfo *puiPara = sf_ui_para_get();
@ -2053,7 +2041,11 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m
case NVTEVT_STORAGE_CHANGE:
//#NT#2023/11/21#Eric - begin
//#NT#Support IVOT_N12144_CO-148_1120_4
g_SysStrg_Chg = true;
if(CARD_REMOVED == System_GetState(SYS_STATE_CARD))
{
g_SysStrg_Chg = true;
}
//#NT#2023/11/21#Eric - end
UIFlowPhoto_OnStorageChange(obj, msg);
break;
@ -2093,7 +2085,7 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m
UIStorageCheck(STORAGE_CHECK_FULL, &g_uiFreePicNum);
printf("[*x]====UI_StorageCheck: g_uiFreePicNum = 0x%ld\r\n", g_uiFreePicNum);
DBG_DUMP("UI_StorageCheck: g_uiFreePicNum = 0x%ld\r\n", g_uiFreePicNum);
lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum));
//lv_label_set_text(label_6_scr_uiflowphoto, Get_FreePicNumString(g_uiFreePicNum));
break;
}
@ -2295,7 +2287,10 @@ void UIFlowPhotoEventCallback(lv_obj_t* obj, lv_event_t event)
UIFlowPhoto_ScrOpen(obj);//LV_ALIGN_IN_RIGHT_MID
if (sf_get_mcu_update_flag() == SF_TRUE) {
lv_obj_set_hidden(container_mcu_upgrade_scr_uiflowphoto, false);
if((access("/mnt/sd/Mupgrade.bin", F_OK) == 0) || (access("/mnt/sd2/Mupgrade.bin", F_OK) == 0))
{
lv_obj_set_hidden(container_mcu_upgrade_scr_uiflowphoto, false);
}
}
#define PASSWORD_OPENED 1

View File

@ -529,6 +529,10 @@ static void UIFlowPlay_IconImageSize(BOOL bShow)
printf("This is picture.\n");
lv_obj_set_hidden(container_play_scr_uiflowplay, true);
snprintf(item1_Buf, 32, "%lux%lu", OriImgWidth, OriImgHeight);
#if HUNTING_CAMERA_MCU == ENABLE
sf_mem_free();
#endif
}
@ -1368,6 +1372,11 @@ static void UIFlowPlay_ScrOpen(lv_obj_t* obj)
/* open all files */
UIFlowPlay_OpenFile(obj);
#if HUNTING_CAMERA_MCU == ENABLE
sf_set_menu_open(TRUE);
#endif
}
static void UIFlowPlay_ChildScrClose(lv_obj_t* obj, const void * data)
@ -2448,7 +2457,7 @@ static void UIFlowPlay_Key(lv_obj_t* obj, uint32_t key)
if (0 != uiFileSeq)
{
stop_play();
UIFlowPlay_OnKeyUp(obj);
//UIFlowPlay_OnKeyUp(obj);
}
show_Selection_page(obj);

View File

@ -336,7 +336,7 @@ static BOOL Check_OTA(VOID)
void Load_MenuInfo(void)
{
#if (PST_FUNC == ENABLE)
#if 0
#if 0
MODELEXT_HEADER *head = NULL;
BININFO *pBinInfo = (BININFO *)Dx_GetModelExtCfg(MODELEXT_TYPE_BIN_INFO, &head);
PPSTORE_SECTION_HANDLE pSection;
@ -407,7 +407,7 @@ void Load_MenuInfo(void)
UINT32 result;
UINT32 uiFWUpdate = 0;
UINT32 uiTmpBoot = 0;
#if 1 //cmdline for ota
FILE *fp = NULL;
UINT32 u32size = 0;
@ -498,8 +498,7 @@ void Load_MenuInfo(void)
#endif
#else //for #if (PST_FUNC == ENABLE)
if(Check_OTA() == TRUE){
if(Check_OTA() == TRUE){
DBG_DUMP("OTA success, reset system param\n");
// #if HUNTING_CAMERA_MCU == ENABLE
@ -539,7 +538,7 @@ void Load_MenuInfo(void)
unsigned long long partition_ofs= 0, partition_size = 0;
int ret = -1;
UINT32 sectorCnt = 0;
FILE *fd_mmc = NULL;
FILE *fd_mmc = NULL;
INT32 rw_len = 0;
void *pTempbuf = NULL;
@ -581,10 +580,10 @@ void Load_MenuInfo(void)
}
#elif defined(_EMBMEM_SPI_NAND_)
unsigned long long partition_ofs= 0, partition_size = 0;
int ret = -1;
FILE *nandump_fp = NULL;
FILE *nandump_fp = NULL;
INT32 rw_len = 0;
UINT32 sectorCnt = 0;
void *tmpInfo = NULL;
@ -711,7 +710,8 @@ EXIT:
ret = -1;
goto EXIT;
}
printf("[%s:%d]((UIMenuStoreInfo*)tmpInfo)->uhInfoSize=%lu,sizeof(currentInfo)=%lu\n",
__FUNCTION__, __LINE__, ((UIMenuStoreInfo*)tmpInfo)->uhInfoSize, sizeof(currentInfo));
if(((UIMenuStoreInfo*)tmpInfo)->uhInfoSize == sizeof(currentInfo)){
#if HUNTING_CAMERA_MCU == ENABLE
@ -1072,12 +1072,20 @@ EXIT:
#if HUNTING_CAMERA_MCU == ENABLE
sf_power_on_para_check_init();
#endif
/* check if sys param changed */
if(memcmp(&currentInfo, &origInfo, sizeof(currentInfo)) == 0){
/* check if sys param changed */
int sflSize = sizeof(currentInfo) - ((int)&currentInfo.TimelapseTime - (int)&currentInfo);
printf("sizeof(currentInfo)=%d, (int)&currentInfo.TimelapseTime=%d, (int)&currentInfo=%d, sflSize=%d,\n",
sizeof(currentInfo), (int)&currentInfo.TimelapseTime, (int)&currentInfo, sflSize);
if(memcmp(&currentInfo.TimelapseTime, &origInfo.TimelapseTime, sflSize) == 0)
{
DBG_DUMP("menu info is not changed\n");
goto EXIT;
}
sectorCnt = (sizeof(currentInfo) / _EMBMEM_BLK_SIZE_) + ((sizeof(currentInfo) % _EMBMEM_BLK_SIZE_)? 1 : 0);
ret = UIInfo_GetStrgPartitionInfo(&partition_ofs, &partition_size, PARTITION_PATH_SYS);
@ -2402,4 +2410,4 @@ void sf_power_on_para_check_init(void)
sf_set_pir_sensitivity(puiPara->PirSensitivity);
#endif
#endif
}
}

View File

@ -945,7 +945,7 @@
#define HUNTING_MCU_UART ENABLE
#define HUNTING_IR_LED_940 ENABLE
#define SF_EXIF_MN_BUF_SIZE 256
#define SF_BASE_VERSION "7MR5RCwE102"
#define SF_BASE_VERSION "7MR5RCwE103"
#define DCF_DIR_NAME "MEDIA" /* 100MEDIA */
#define DCF_FILE_NAME "SYGW" /* SYFW0001.JPG */
#define SF_EMMC_DCF_FILE_NAME "SYBX" /* SYBX0001.JPG */