Merge pull request #605 from yuht/patch-12

[BSP] update get “geometry” source
This commit is contained in:
Bernard Xiong 2016-01-06 17:40:26 +08:00
commit e2d596ae0f
1 changed files with 6 additions and 4 deletions

View File

@ -461,11 +461,13 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
struct rt_device_blk_geometry *geometry;
geometry = (struct rt_device_blk_geometry *)args;
if (geometry == RT_NULL) return -RT_ERROR;
geometry->bytes_per_sector = SDCfg.sectorsize;
geometry->block_size = SDCfg.blocksize;
geometry->sector_count = SDCfg.sectorcnt;
if (dev->user_data == RT_NULL) return -RT_ERROR;
geometry->bytes_per_sector = ((SDCFG *)dev->user_data)->sectorsize;
geometry->block_size = ((SDCFG *)dev->user_data)->blocksize;
geometry->sector_count = ((SDCFG *)dev->user_data)->sectorcnt;
}
return RT_EOK;