update get “geometry” source

in function internal,get "geometry" form paramater "dev->user_data",  not use public variable "SDCfg"
This commit is contained in:
yuht 2016-01-06 09:54:39 +08:00
parent 3e890570c9
commit 585475991c
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;