update SD card driver for auto initial.
This commit is contained in:
parent
5183697fd4
commit
020d05ca92
|
@ -221,7 +221,7 @@ SD_Error SD_PowerON(void)
|
|||
SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No;
|
||||
SDIO_CmdInitStructure.SDIO_CPSM = SDIO_CPSM_Enable;
|
||||
|
||||
for(i = 0;i < 74; i++)
|
||||
for(i = 0; i < 74; i++)
|
||||
{
|
||||
SDIO_SendCommand(&SDIO_CmdInitStructure);
|
||||
errorstatus = CmdError();
|
||||
|
@ -3159,7 +3159,7 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
|||
return RT_EOK;
|
||||
}
|
||||
|
||||
void rt_hw_sdcard_init()
|
||||
int rt_hw_sdcard_init(void)
|
||||
{
|
||||
/* SDIO POWER */
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
@ -3191,7 +3191,7 @@ void rt_hw_sdcard_init()
|
|||
if (sector == RT_NULL)
|
||||
{
|
||||
rt_kprintf("allocate partition sector buffer failed\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
status = SD_ReadBlock(0, (uint32_t*)sector, 512);
|
||||
if (status == SD_OK)
|
||||
|
@ -3229,18 +3229,19 @@ void rt_hw_sdcard_init()
|
|||
rt_device_register(&sdcard_device, "sd0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__return:
|
||||
rt_kprintf("sdcard init failed\n");
|
||||
GPIO_SetBits(GPIOC,GPIO_Pin_6); /* SD card power down */
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_sdcard_init);
|
||||
|
||||
void SDIO_IRQHandler(void)
|
||||
{
|
||||
extern int SD_ProcessIRQSrc(void);
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
|
|
Loading…
Reference in New Issue