fix sdcard.c dfs_fs.c
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@106 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
d3c6a6abb6
commit
597015a3fe
|
@ -3096,18 +3096,19 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
|||
|
||||
void rt_hw_sdcard_init()
|
||||
{
|
||||
if (SD_Init())
|
||||
if ( SD_Init() == SD_OK )
|
||||
{
|
||||
SD_Error status;
|
||||
rt_uint8_t *sector;
|
||||
|
||||
SD_EnableWideBusOperation(SDIO_BusWide_4b);
|
||||
|
||||
status = SD_GetCardInfo(&SDCardInfo);
|
||||
if (status != SD_OK) goto __return;
|
||||
|
||||
status = SD_SelectDeselect((u32) (SDCardInfo.RCA << 16));
|
||||
if (status != SD_OK) goto __return;
|
||||
|
||||
SD_EnableWideBusOperation(SDIO_BusWide_4b);
|
||||
SD_SetDeviceMode(SD_DMA_MODE);
|
||||
|
||||
/* get the first sector to read partition table */
|
||||
|
|
|
@ -139,8 +139,25 @@ rt_err_t dfs_filesystem_get_partition(struct dfs_partition* part, rt_uint8_t* bu
|
|||
*(dpt+14) << 16 | *(dpt+15) << 24;
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
rt_kprintf("part[%d], begin: %d, size: %d\n",
|
||||
pindex, part->offset * 512, part->size* 512);
|
||||
rt_kprintf("part[%d], begin: %d, size: ",
|
||||
pindex, part->offset * 512);
|
||||
if ( (part->size>>11) > 0 ) /* MB */
|
||||
{
|
||||
unsigned int part_size;
|
||||
part_size = part->size>>11;/* MB */
|
||||
if ( (part_size>>10) > 0) /* GB */
|
||||
{
|
||||
rt_kprintf("%d.%d%s",part_size>>10,part_size&0x3FF,"GB\r\n");/* GB */
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("%d.%d%s",part_size,(part->size>>1)&0x3FF,"MB\r\n");/* MB */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("%d%s",part->size>>1,"KB\r\n");/* KB */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue