rt-thread-official/bsp/lpc54114-lite/drivers/drv_sdcard.c

28 lines
472 B
C
Raw Normal View History

/*
2021-03-17 02:26:35 +08:00
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/
2021-03-17 02:26:35 +08:00
#include "drv_sdcard.h"
2021-03-17 02:26:35 +08:00
#include "drv_spi.h"
#include "spi_msd.h"
#define RT_SDCARD_CS_PIN (3)
int rt_hw_sdcard_init(void)
{
2021-03-17 02:26:35 +08:00
rt_err_t ret;
ret = lpc_spi_bus_attach_device("spi2", "spi21", RT_SDCARD_CS_PIN);
if(ret != RT_EOK)
{
2021-03-17 02:26:35 +08:00
return ret;
}
2021-03-17 02:26:35 +08:00
ret = msd_init("sd0", "spi21");
2021-03-17 02:26:35 +08:00
return ret;
}
2021-03-17 02:26:35 +08:00
INIT_DEVICE_EXPORT(rt_hw_sdcard_init);