115 lines
2.5 KiB
C
Executable File
115 lines
2.5 KiB
C
Executable File
/**************************************************************************
|
|
*
|
|
* Copyright (c) 2009-2018 by SiFar Technology, Inc.
|
|
*
|
|
* This software is copyrighted by and is the property of SiFar
|
|
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
|
* This software may only be used in accordance with the corresponding
|
|
* license agreement. Any unauthorized use, duplication, distribution,
|
|
* or disclosure of this software is expressly forbidden.
|
|
*
|
|
* This Copyright notice MUST not be removed or modified without prior
|
|
* written consent of SiFar Technology, Inc..
|
|
*
|
|
* SiFar Technology, Inc. reserves the right to modify this software without notice.
|
|
*
|
|
* Author: Payton
|
|
* Ver: 1.0.0 2023.02.14
|
|
* Description: sd code
|
|
*
|
|
**************************************************************************/
|
|
|
|
|
|
//#include <linux/module.h>
|
|
#include <sf_mcu.h>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
//#include <linux/input.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
#include <sys/stat.h>
|
|
//#include <sys/ioctl.h>
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <kwrap/util.h>
|
|
#include <sys/wait.h>
|
|
#include <errno.h>
|
|
#include <kwrap/debug.h>
|
|
#include <time.h>
|
|
//#include <io/gpio.h>
|
|
#include "UIInfo.h"
|
|
#include <FileSysTsk.h>
|
|
|
|
static BOOL IsCardFull = FALSE;
|
|
SF_CALLBACK_SD_CMD g_fpSd_Exist_CB = NULL;
|
|
extern BOOL DrvCARD_DetStrgCard(void);
|
|
|
|
BOOL sf_is_card_full(void)
|
|
{
|
|
//printf("[%s]:%d IsCardFull:%d\n", __FUNCTION__, __LINE__, IsCardFull);
|
|
return IsCardFull;
|
|
|
|
}
|
|
|
|
|
|
UINT32 sf_check_card_full(void)
|
|
{
|
|
UINT64 diskFree = 0;
|
|
UINT32 ret = 0;
|
|
|
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
|
if(!sf_in_card_exist())
|
|
{
|
|
return 1;
|
|
}
|
|
/*check disk free size*/
|
|
diskFree = FileSys_GetDiskInfo(FST_INFO_FREE_SPACE);
|
|
diskFree = diskFree/1024;
|
|
|
|
if(diskFree < 30) /* 30MB */
|
|
{
|
|
ret = TRUE;
|
|
if(0 == puiPara->SdLoopSwitch)
|
|
{
|
|
IsCardFull = TRUE;
|
|
}
|
|
//printf("%s:%d sd card is full diskFree=%lu",__FUNCTION__,__LINE__,diskFree);
|
|
}
|
|
else
|
|
{
|
|
ret = FALSE;
|
|
//printf("%s:%d sd card no full diskFree=%lu",__FUNCTION__,__LINE__,diskFree);
|
|
}
|
|
//printf("%s:%d sd card diskFree(%lu)",__FUNCTION__,__LINE__,diskFree);
|
|
|
|
return ret;
|
|
}
|
|
|
|
void sf_sd_exist_reg_cb(SF_CALLBACK_SD_CMD fpCB)
|
|
{
|
|
g_fpSd_Exist_CB = fpCB;
|
|
}
|
|
|
|
BOOL sf_in_card_exist(void)
|
|
{
|
|
return DrvCARD_DetStrgCard();
|
|
/*
|
|
if(g_fpSd_Exist_CB)
|
|
{
|
|
return g_fpSd_Exist_CB();
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|