diff --git a/code/application/source/cardv/SrcCode/System/SF_SysStrgMng.c b/code/application/source/cardv/SrcCode/System/SF_SysStrgMng.c index 2005c6407..0bb5a243e 100755 --- a/code/application/source/cardv/SrcCode/System/SF_SysStrgMng.c +++ b/code/application/source/cardv/SrcCode/System/SF_SysStrgMng.c @@ -271,15 +271,18 @@ void SF_StrgRegister(SF_MESSAGE_BUF_S *pMessageBuf) else { sf_mmc_dev[MMC_DEV_EMMC]->node = MMC_DEV_NODE_STATE_NO_EXIST; + sf_set_emmc_err(1); } if(pMessageBuf->arg1 == CMD_SD_STRG_CB_MOUNT_FINISH) { sf_mmc_dev[MMC_DEV_EMMC]->moumted_state = MMC_DEV_MOUNT_STATE_MOUNTED; + sf_set_emmc_err(0); } else if(pMessageBuf->arg1 == CMD_SD_STRG_CB_UNMOUNT_FINISH) { sf_mmc_dev[MMC_DEV_EMMC]->moumted_state = MMC_DEV_MOUNT_STATE_UNMOUNTED; + sf_set_emmc_err(1); } } diff --git a/code/application/source/sf_app/code/include/sf_device.h b/code/application/source/sf_app/code/include/sf_device.h index af217b258..76bb27591 100644 --- a/code/application/source/sf_app/code/include/sf_device.h +++ b/code/application/source/sf_app/code/include/sf_device.h @@ -70,6 +70,8 @@ SINT32 sf_in_update(void); void sf_set_card_statu(UINT32 val); UINT32 sf_get_card_statu(void); BOOL sf_system_check_bt_ko(void); +void sf_set_emmc_err(BOOL val); +BOOL sf_is_emmc_err(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/app/sf_common.c b/code/application/source/sf_app/code/source/app/sf_common.c index f0023a4ab..b2239180e 100755 --- a/code/application/source/sf_app/code/source/app/sf_common.c +++ b/code/application/source/sf_app/code/source/app/sf_common.c @@ -616,6 +616,7 @@ static SINT32 sfStrgDevOnActionMount(int dev_id, int result) { printf("EMMC has Mounted!\r\n"); sf_strg_dev_register(MMC_DEV_EMMC, MMC_DEV_MOUNT_STATE_MOUNTED); + sf_set_emmc_err(0); } // if(SF_MCU_STARTUP_ONKEY == startup) // { @@ -693,6 +694,7 @@ static SINT32 sfStrgDevSdHandler(int cb_evt, int dev_id, int result) static SINT32 sfStrgDevEmmcHandler(int cb_evt, int dev_id, int result) { + sf_set_emmc_err(1); switch(cb_evt) { case CMD_SD_STRG_CB_UNKNOWN: diff --git a/code/application/source/sf_app/code/source/app/sf_device.c b/code/application/source/sf_app/code/source/app/sf_device.c index 885bbbbfb..9bde3eeb3 100755 --- a/code/application/source/sf_app/code/source/app/sf_device.c +++ b/code/application/source/sf_app/code/source/app/sf_device.c @@ -45,6 +45,7 @@ static SINT32 IsCardFull = 0; static SINT32 isGoing2Pir = 0; static SINT32 IsCard = 0; static int formatSD = CMD_FORMAT_SD_ERR; +static BOOL IsEmmcErr = TRUE; SF_THREAD_S PirMonitorTskCfg = { @@ -547,7 +548,7 @@ SINT32 sf_is_card_full(void) void sf_set_card_full(SINT32 vol) { UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); - if((0 == puiPara->SendType) && (!sf_get_mode_flag())) + if((0 == puiPara->SendType) && (!sf_get_mode_flag()) &&(sf_is_emmc_err())) { MLOGW("The memory sending function has been enabled, but the identification is not effective. IsCardFull:%d\n",vol); IsCardFull = 0; @@ -726,6 +727,17 @@ SINT32 sf_in_update(void) return (regValue & 0xFF) ? 0:1; } +BOOL sf_is_emmc_err(void) +{ + //printf("[%s]:%d IsEmmcFull:%d\n", __FUNCTION__, __LINE__, IsEmmcFull); + return IsEmmcErr; +} +void sf_set_emmc_err(BOOL vol) +{ + //printf("[%s]:%d IsEmmcFull:%d\n", __FUNCTION__, __LINE__, IsEmmcFull); + IsEmmcErr = vol; +} + #ifdef __cplusplus #if __cplusplus } diff --git a/code/lib/source/sifar/code/include/sf_sd_common.h b/code/lib/source/sifar/code/include/sf_sd_common.h index 426ef4bc0..925fcf06b 100644 --- a/code/lib/source/sifar/code/include/sf_sd_common.h +++ b/code/lib/source/sifar/code/include/sf_sd_common.h @@ -21,5 +21,7 @@ BOOL sf_in_card_exist(void); BOOL sf_in_emmc_exist(void); void sf_set_card_statu(UINT32 val); UINT32 sf_get_card_statu(void); +void sf_set_emmc_err(BOOL val); +BOOL sf_is_emmc_err(void); #endif diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 9247552eb..e4053b2ce 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -3591,7 +3591,7 @@ INT32 sf_mem_write_photo(UINT32 buf, UINT32 size) { UINT32 fd = 0; UIMenuStoreInfo *puiPara = sf_ui_para_get(); - if(0 == puiPara->SendType) + if((0 == puiPara->SendType) && sf_is_emmc_err()) { MLOGD("filesys not ready, store data into mem\n"); system("rm -rf /tmp/MEMPHOTO.JPG"); 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 00cba5f21..ad9193807 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 @@ -49,7 +49,7 @@ SF_CALLBACK_SD_CMD g_fpSd_Exist_CB = NULL; static int formatSD = CMD_FORMAT_SD_ERR; static BOOL IsCardFull = TRUE; static BOOL IsEmmcFull = TRUE; - +static BOOL IsEmmcErr = TRUE; void sf_sd_exist_reg_cb(SF_CALLBACK_SD_CMD fpCB) { g_fpSd_Exist_CB = fpCB; @@ -104,4 +104,15 @@ BOOL sf_is_emmc_full(void) void sf_set_emmc_card_full(BOOL val) { IsEmmcFull = val; -} \ No newline at end of file +} + +BOOL sf_is_emmc_err(void) +{ + //printf("[%s]:%d IsEmmcFull:%d\n", __FUNCTION__, __LINE__, IsEmmcFull); + return IsEmmcErr; +} +void sf_set_emmc_err(BOOL val) +{ + //printf("[%s]:%d IsEmmcFull:%d\n", __FUNCTION__, __LINE__, IsEmmcFull); + IsEmmcErr = val; +}