forked from xuos/xiuos
json file download needs to check whether the sd card is mounted successfully
This commit is contained in:
@@ -274,6 +274,8 @@ static struct SdioDevDone dev_done =
|
||||
SdioRead,
|
||||
};
|
||||
|
||||
static bool is_mount_ok = false;
|
||||
|
||||
#if defined(FS_VFS) && defined(MOUNT_SDCARD_FS)
|
||||
#include <iot-vfs.h>
|
||||
|
||||
@@ -283,11 +285,14 @@ static struct SdioDevDone dev_done =
|
||||
*/
|
||||
static int MountSDCardFs(enum FilesystemType fs_type)
|
||||
{
|
||||
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0)
|
||||
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0){
|
||||
KPrintf("Sd card mount to '/'");
|
||||
else
|
||||
is_mount_ok = true;
|
||||
} else {
|
||||
KPrintf("Sd card mount to '/' failed!");
|
||||
|
||||
is_mount_ok = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -329,6 +334,7 @@ static void SdCardDetach(void)
|
||||
|
||||
#ifdef MOUNT_SDCARD_FS
|
||||
UnmountFileSystem("/");
|
||||
is_mount_ok = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -350,9 +356,10 @@ static uint8 SdCardReadCd(void)
|
||||
return BusDevReadData(pin->owner_haldev, &read_param);
|
||||
}
|
||||
|
||||
static int sd_card_status = 0;
|
||||
static void SdCardTask(void* parameter)
|
||||
{
|
||||
static int sd_card_status = 0;
|
||||
|
||||
while (1) {
|
||||
if (!SdCardReadCd()) {
|
||||
if (!sd_card_status) {
|
||||
@@ -368,11 +375,6 @@ static void SdCardTask(void* parameter)
|
||||
}
|
||||
}
|
||||
|
||||
int GetSdCardStatus(void)
|
||||
{
|
||||
return sd_card_status;
|
||||
}
|
||||
|
||||
#ifdef MOUNT_SDCARD
|
||||
int MountSDCard()
|
||||
{
|
||||
@@ -390,6 +392,13 @@ int MountSDCard()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GetSdMountStatus(void)
|
||||
{
|
||||
if(!is_mount_ok)
|
||||
KPrintf("The SD card was not mounted successfully or not inserted, please check!\r\n");
|
||||
return is_mount_ok;
|
||||
}
|
||||
|
||||
int Imxrt1052HwSdioInit(void)
|
||||
{
|
||||
x_err_t ret = EOK;
|
||||
|
||||
Reference in New Issue
Block a user