|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2011-11-10 18:16:16
|
显示全部楼层
static rt_size_t rt_ide_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
还有一个问题,CF卡驱动移植到RTT时,手册中也没有几个参数的含义?
size是指定扇区的地址还是要读取的个数?
pos是偏移量的位置还是偏移量?
已经实现了指定扇区地址上读写512B的底层函数
unsigned char WriteCompactFlashSector(unsigned long addr , unsigned char *buf)
unsigned char ReadCompactFlashSector(unsigned long addr , unsigned char *buf)
移植到rt_ide_read中是不是这样写
static rt_size_t rt_ide_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{
unsigned long count , offset , idx ;
unsigned char *pData ;
pData = ( unsigned char *)buffer ;
count = size / 512 ;
offset = (pos / 512) + part.offset ;
for(idx = 0 ; idx < count ; idx++)
{
ReadCompactFlashSector(size , pData) ;
}
ReadCompactFlashSector(offset , pData) ;
return count ;
} |
|