forked from xuos/xiuos
feat add sd card auto-check-attach function for ok1052 and xidatong
This commit is contained in:
parent
137f2493b7
commit
6f859b91db
|
@ -44,7 +44,6 @@ menu "ok1052-c feature"
|
||||||
config MOUNT_SDCARD
|
config MOUNT_SDCARD
|
||||||
bool "mount cd card"
|
bool "mount cd card"
|
||||||
default n
|
default n
|
||||||
select BSP_USING_SDIO
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -41,30 +41,6 @@ extern int ExtSramInit(void);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FS_VFS) && defined(MOUNT_SDCARD)
|
|
||||||
#include <iot-vfs.h>
|
|
||||||
|
|
||||||
// SD card mount flag 1: OK
|
|
||||||
int sd_mount_flag = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: Mount SD card
|
|
||||||
* @return 0
|
|
||||||
*/
|
|
||||||
int MountSDCard(void)
|
|
||||||
{
|
|
||||||
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, FSTYPE_FATFS, "/") == 0)
|
|
||||||
{
|
|
||||||
sd_mount_flag = 1;
|
|
||||||
KPrintf("sd card mount to '/'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
KPrintf("sd card mount to '/' failed!");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
|
#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
|
||||||
#include "fsl_lpi2c.h"
|
#include "fsl_lpi2c.h"
|
||||||
#endif /* SDK_I2C_BASED_COMPONENT_USED */
|
#endif /* SDK_I2C_BASED_COMPONENT_USED */
|
||||||
|
|
|
@ -27,11 +27,14 @@
|
||||||
#include <clock_config.h>
|
#include <clock_config.h>
|
||||||
#include <fsl_gpio.h>
|
#include <fsl_gpio.h>
|
||||||
#include <fsl_common.h>
|
#include <fsl_common.h>
|
||||||
|
#include <connect_gpio.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SD_CARD_STACK_SIZE 2048
|
||||||
|
|
||||||
int Imxrt1052HwSdioInit(void);
|
int Imxrt1052HwSdioInit(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -10,4 +10,15 @@ if BSP_USING_SDIO
|
||||||
config SDIO_DEVICE_NAME
|
config SDIO_DEVICE_NAME
|
||||||
string "sdio device name"
|
string "sdio device name"
|
||||||
default "sdio_dev"
|
default "sdio_dev"
|
||||||
|
|
||||||
|
config MOUNT_SDCARD_FS
|
||||||
|
bool "mount cd card file system"
|
||||||
|
default n
|
||||||
|
select MOUNT_SDCARD
|
||||||
|
|
||||||
|
if MOUNT_SDCARD_FS
|
||||||
|
config MOUNT_SDCARD_FS_TYPE
|
||||||
|
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||||
|
default 0
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -104,9 +104,6 @@ static const sdmmchost_card_switch_voltage_func_t s_sdcard_voltage_switch = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! @brief SD card detect flag */
|
|
||||||
static volatile bool s_card_inserted = false;
|
|
||||||
|
|
||||||
/*! @brief Card descriptor. */
|
/*! @brief Card descriptor. */
|
||||||
static sd_card_t g_sd;
|
static sd_card_t g_sd;
|
||||||
static int sd_lock = -1;
|
static int sd_lock = -1;
|
||||||
|
@ -142,11 +139,6 @@ static void BoardPowerOnSdCard(void)
|
||||||
BOARD_USDHC_SDCARD_POWER_CONTROL(1);
|
BOARD_USDHC_SDCARD_POWER_CONTROL(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SdcardDetectCallBack(bool is_inserted, void *user_data)
|
|
||||||
{
|
|
||||||
s_card_inserted = is_inserted;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CardInformationLog(sd_card_t *card)
|
static void CardInformationLog(sd_card_t *card)
|
||||||
{
|
{
|
||||||
NULL_PARAM_CHECK(card);
|
NULL_PARAM_CHECK(card);
|
||||||
|
@ -282,10 +274,126 @@ static struct SdioDevDone dev_done =
|
||||||
SdioRead,
|
SdioRead,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(FS_VFS) && defined(MOUNT_SDCARD_FS)
|
||||||
|
#include <iot-vfs.h>
|
||||||
|
|
||||||
|
int sd_mount_flag = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: Mount SD card
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
static int MountSDCardFs(enum FilesystemType fs_type)
|
||||||
|
{
|
||||||
|
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0) {
|
||||||
|
sd_mount_flag = 1;
|
||||||
|
KPrintf("Sd card mount to '/'");
|
||||||
|
} else {
|
||||||
|
KPrintf("Sd card mount to '/' failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void SdCardAttach(void)
|
||||||
|
{
|
||||||
|
bool is_read_only;
|
||||||
|
static sd_card_t *card = &g_sd;
|
||||||
|
|
||||||
|
KPrintf("\r\nCard inserted.\r\n");
|
||||||
|
/* reset host once card re-plug in */
|
||||||
|
SD_HostReset(&(card->host));
|
||||||
|
/* power on the card */
|
||||||
|
SD_PowerOnCard(card->host.base, card->usrParam.pwr);
|
||||||
|
KPrintf("Power on done\n");
|
||||||
|
|
||||||
|
/* Init card. */
|
||||||
|
if (SD_CardInit(card)) {
|
||||||
|
KPrintf("\r\nSD card init failed.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* card information log */
|
||||||
|
CardInformationLog(card);
|
||||||
|
|
||||||
|
/* Check if card is readonly. */
|
||||||
|
is_read_only = SD_CheckReadOnly(card);
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD_FS
|
||||||
|
/*mount file system*/
|
||||||
|
MountSDCardFs(MOUNT_SDCARD_FS_TYPE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SdCardDetach(void)
|
||||||
|
{
|
||||||
|
/*unmount file system*/
|
||||||
|
KPrintf("\r\nCard detect extracted.\r\n");
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD_FS
|
||||||
|
UnmountFileSystem("/");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 SdCardReadCd(void)
|
||||||
|
{
|
||||||
|
BusType pin;
|
||||||
|
|
||||||
|
pin = BusFind(PIN_BUS_NAME);
|
||||||
|
|
||||||
|
pin->owner_haldev = BusFindDevice(pin, PIN_DEVICE_NAME);
|
||||||
|
|
||||||
|
struct PinStat PinStat;
|
||||||
|
|
||||||
|
struct BusBlockReadParam read_param;
|
||||||
|
read_param.buffer = (void *)&PinStat;
|
||||||
|
|
||||||
|
PinStat.pin = IMXRT_GET_PIN(2, 28);
|
||||||
|
|
||||||
|
return BusDevReadData(pin->owner_haldev, &read_param);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SdCardTask(void* parameter)
|
||||||
|
{
|
||||||
|
static int sd_card_status = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (!SdCardReadCd()) {
|
||||||
|
if (!sd_card_status) {
|
||||||
|
SdCardAttach();
|
||||||
|
sd_card_status = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (sd_card_status) {
|
||||||
|
SdCardDetach();
|
||||||
|
sd_card_status = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD
|
||||||
|
int MountSDCard()
|
||||||
|
{
|
||||||
|
int sd_card_task = 0;
|
||||||
|
sd_card_task = KTaskCreate("sd_card", SdCardTask, NONE,
|
||||||
|
SD_CARD_STACK_SIZE, 8);
|
||||||
|
if(sd_card_task < 0) {
|
||||||
|
KPrintf("sd_card_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
StartupKTask(sd_card_task);
|
||||||
|
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int Imxrt1052HwSdioInit(void)
|
int Imxrt1052HwSdioInit(void)
|
||||||
{
|
{
|
||||||
x_err_t ret = EOK;
|
x_err_t ret = EOK;
|
||||||
bool is_read_only;
|
|
||||||
|
|
||||||
static struct SdioBus sdio_bus;
|
static struct SdioBus sdio_bus;
|
||||||
static struct SdioDriver sdio_drv;
|
static struct SdioDriver sdio_drv;
|
||||||
|
@ -318,35 +426,6 @@ int Imxrt1052HwSdioInit(void)
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
KPrintf("\r\nPlease insert a card into board.\r\n");
|
|
||||||
|
|
||||||
/* power off card */
|
|
||||||
SD_PowerOffCard(card->host.base, card->usrParam.pwr);
|
|
||||||
|
|
||||||
if (SD_WaitCardDetectStatus(SD_HOST_BASEADDR, &s_sdcard_detect, true) == kStatus_Success) {
|
|
||||||
KPrintf("\r\nCard inserted.\r\n");
|
|
||||||
/* reset host once card re-plug in */
|
|
||||||
SD_HostReset(&(card->host));
|
|
||||||
/* power on the card */
|
|
||||||
SD_PowerOnCard(card->host.base, card->usrParam.pwr);
|
|
||||||
KPrintf("power on done\n");
|
|
||||||
} else {
|
|
||||||
KPrintf("\r\nCard detect fail.\r\n");
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init card. */
|
|
||||||
if (SD_CardInit(card)) {
|
|
||||||
KPrintf("\r\nSD card init failed.\r\n");
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* card information log */
|
|
||||||
CardInformationLog(card);
|
|
||||||
|
|
||||||
/* Check if card is readonly. */
|
|
||||||
is_read_only = SD_CheckReadOnly(card);
|
|
||||||
|
|
||||||
ret = SdioBusInit(&sdio_bus, SDIO_BUS_NAME);
|
ret = SdioBusInit(&sdio_bus, SDIO_BUS_NAME);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
KPrintf("Sdio bus init error %d\n", ret);
|
KPrintf("Sdio bus init error %d\n", ret);
|
||||||
|
|
|
@ -44,7 +44,6 @@ menu "xidatong feature"
|
||||||
config MOUNT_SDCARD
|
config MOUNT_SDCARD
|
||||||
bool "mount cd card"
|
bool "mount cd card"
|
||||||
default n
|
default n
|
||||||
select BSP_USING_SDIO
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -29,24 +29,6 @@ Modification:
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "pin_mux.h"
|
#include "pin_mux.h"
|
||||||
|
|
||||||
#if defined(FS_VFS) && defined(MOUNT_SDCARD)
|
|
||||||
#include <iot-vfs.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: Mount SD card
|
|
||||||
* @return 0
|
|
||||||
*/
|
|
||||||
int MountSDCard(void)
|
|
||||||
{
|
|
||||||
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, FSTYPE_FATFS, "/") == 0)
|
|
||||||
KPrintf("sd card mount to '/'");
|
|
||||||
else
|
|
||||||
KPrintf("sd card mount to '/' failed!");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
|
#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
|
||||||
#include "fsl_lpi2c.h"
|
#include "fsl_lpi2c.h"
|
||||||
#endif /* SDK_I2C_BASED_COMPONENT_USED */
|
#endif /* SDK_I2C_BASED_COMPONENT_USED */
|
||||||
|
|
|
@ -27,11 +27,14 @@
|
||||||
#include <clock_config.h>
|
#include <clock_config.h>
|
||||||
#include <fsl_gpio.h>
|
#include <fsl_gpio.h>
|
||||||
#include <fsl_common.h>
|
#include <fsl_common.h>
|
||||||
|
#include <connect_gpio.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SD_CARD_STACK_SIZE 2048
|
||||||
|
|
||||||
int Imxrt1052HwSdioInit(void);
|
int Imxrt1052HwSdioInit(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -10,4 +10,15 @@ if BSP_USING_SDIO
|
||||||
config SDIO_DEVICE_NAME
|
config SDIO_DEVICE_NAME
|
||||||
string "sdio device name"
|
string "sdio device name"
|
||||||
default "sdio_dev"
|
default "sdio_dev"
|
||||||
|
|
||||||
|
config MOUNT_SDCARD_FS
|
||||||
|
bool "mount cd card file system"
|
||||||
|
default n
|
||||||
|
select MOUNT_SDCARD
|
||||||
|
|
||||||
|
if MOUNT_SDCARD_FS
|
||||||
|
config MOUNT_SDCARD_FS_TYPE
|
||||||
|
int "choose file system type : FATFS(0) LWEXT4(3)"
|
||||||
|
default 0
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -104,9 +104,6 @@ static const sdmmchost_card_switch_voltage_func_t s_sdcard_voltage_switch = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! @brief SD card detect flag */
|
|
||||||
static volatile bool s_card_inserted = false;
|
|
||||||
|
|
||||||
/*! @brief Card descriptor. */
|
/*! @brief Card descriptor. */
|
||||||
static sd_card_t g_sd;
|
static sd_card_t g_sd;
|
||||||
static int sd_lock = -1;
|
static int sd_lock = -1;
|
||||||
|
@ -142,11 +139,6 @@ static void BoardPowerOnSdCard(void)
|
||||||
BOARD_USDHC_SDCARD_POWER_CONTROL(1);
|
BOARD_USDHC_SDCARD_POWER_CONTROL(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SdcardDetectCallBack(bool is_inserted, void *user_data)
|
|
||||||
{
|
|
||||||
s_card_inserted = is_inserted;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CardInformationLog(sd_card_t *card)
|
static void CardInformationLog(sd_card_t *card)
|
||||||
{
|
{
|
||||||
NULL_PARAM_CHECK(card);
|
NULL_PARAM_CHECK(card);
|
||||||
|
@ -282,10 +274,121 @@ static struct SdioDevDone dev_done =
|
||||||
SdioRead,
|
SdioRead,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(FS_VFS) && defined(MOUNT_SDCARD_FS)
|
||||||
|
#include <iot-vfs.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: Mount SD card
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
static int MountSDCardFs(enum FilesystemType fs_type)
|
||||||
|
{
|
||||||
|
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0)
|
||||||
|
KPrintf("Sd card mount to '/'");
|
||||||
|
else
|
||||||
|
KPrintf("Sd card mount to '/' failed!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void SdCardAttach(void)
|
||||||
|
{
|
||||||
|
bool is_read_only;
|
||||||
|
static sd_card_t *card = &g_sd;
|
||||||
|
|
||||||
|
KPrintf("\r\nCard inserted.\r\n");
|
||||||
|
/* reset host once card re-plug in */
|
||||||
|
SD_HostReset(&(card->host));
|
||||||
|
/* power on the card */
|
||||||
|
SD_PowerOnCard(card->host.base, card->usrParam.pwr);
|
||||||
|
KPrintf("Power on done\n");
|
||||||
|
|
||||||
|
/* Init card. */
|
||||||
|
if (SD_CardInit(card)) {
|
||||||
|
KPrintf("\r\nSD card init failed.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* card information log */
|
||||||
|
CardInformationLog(card);
|
||||||
|
|
||||||
|
/* Check if card is readonly. */
|
||||||
|
is_read_only = SD_CheckReadOnly(card);
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD_FS
|
||||||
|
/*mount file system*/
|
||||||
|
MountSDCardFs(MOUNT_SDCARD_FS_TYPE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SdCardDetach(void)
|
||||||
|
{
|
||||||
|
/*unmount file system*/
|
||||||
|
KPrintf("\r\nCard detect extracted.\r\n");
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD_FS
|
||||||
|
UnmountFileSystem("/");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 SdCardReadCd(void)
|
||||||
|
{
|
||||||
|
BusType pin;
|
||||||
|
|
||||||
|
pin = BusFind(PIN_BUS_NAME);
|
||||||
|
|
||||||
|
pin->owner_haldev = BusFindDevice(pin, PIN_DEVICE_NAME);
|
||||||
|
|
||||||
|
struct PinStat PinStat;
|
||||||
|
|
||||||
|
struct BusBlockReadParam read_param;
|
||||||
|
read_param.buffer = (void *)&PinStat;
|
||||||
|
|
||||||
|
PinStat.pin = IMXRT_GET_PIN(2, 28);
|
||||||
|
|
||||||
|
return BusDevReadData(pin->owner_haldev, &read_param);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SdCardTask(void* parameter)
|
||||||
|
{
|
||||||
|
static int sd_card_status = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (!SdCardReadCd()) {
|
||||||
|
if (!sd_card_status) {
|
||||||
|
SdCardAttach();
|
||||||
|
sd_card_status = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (sd_card_status) {
|
||||||
|
SdCardDetach();
|
||||||
|
sd_card_status = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MOUNT_SDCARD
|
||||||
|
int MountSDCard()
|
||||||
|
{
|
||||||
|
int sd_card_task = 0;
|
||||||
|
sd_card_task = KTaskCreate("sd_card", SdCardTask, NONE,
|
||||||
|
SD_CARD_STACK_SIZE, 8);
|
||||||
|
if(sd_card_task < 0) {
|
||||||
|
KPrintf("sd_card_task create failed ...%s %d.\n", __FUNCTION__,__LINE__);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
StartupKTask(sd_card_task);
|
||||||
|
|
||||||
|
return EOK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int Imxrt1052HwSdioInit(void)
|
int Imxrt1052HwSdioInit(void)
|
||||||
{
|
{
|
||||||
x_err_t ret = EOK;
|
x_err_t ret = EOK;
|
||||||
bool is_read_only;
|
|
||||||
|
|
||||||
static struct SdioBus sdio_bus;
|
static struct SdioBus sdio_bus;
|
||||||
static struct SdioDriver sdio_drv;
|
static struct SdioDriver sdio_drv;
|
||||||
|
@ -317,35 +420,6 @@ int Imxrt1052HwSdioInit(void)
|
||||||
KPrintf("\r\nSD host init fail\r\n");
|
KPrintf("\r\nSD host init fail\r\n");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
KPrintf("\r\nPlease insert a card into board.\r\n");
|
|
||||||
|
|
||||||
/* power off card */
|
|
||||||
SD_PowerOffCard(card->host.base, card->usrParam.pwr);
|
|
||||||
|
|
||||||
if (SD_WaitCardDetectStatus(SD_HOST_BASEADDR, &s_sdcard_detect, true) == kStatus_Success) {
|
|
||||||
KPrintf("\r\nCard inserted.\r\n");
|
|
||||||
/* reset host once card re-plug in */
|
|
||||||
SD_HostReset(&(card->host));
|
|
||||||
/* power on the card */
|
|
||||||
SD_PowerOnCard(card->host.base, card->usrParam.pwr);
|
|
||||||
KPrintf("power on done\n");
|
|
||||||
} else {
|
|
||||||
KPrintf("\r\nCard detect fail.\r\n");
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init card. */
|
|
||||||
if (SD_CardInit(card)) {
|
|
||||||
KPrintf("\r\nSD card init failed.\r\n");
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* card information log */
|
|
||||||
CardInformationLog(card);
|
|
||||||
|
|
||||||
/* Check if card is readonly. */
|
|
||||||
is_read_only = SD_CheckReadOnly(card);
|
|
||||||
|
|
||||||
ret = SdioBusInit(&sdio_bus, SDIO_BUS_NAME);
|
ret = SdioBusInit(&sdio_bus, SDIO_BUS_NAME);
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
|
|
Loading…
Reference in New Issue