论坛元老
 
- 积分
- 4072
- 金钱
- 4072
- 注册时间
- 2017-11-15
- 在线时间
- 330 小时
|
发表于 2018-2-28 10:37:10
|
显示全部楼层
经过跟踪代码,发现,[mw_shl_code=c,true]DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
result = RAM_disk_read(buff, sector, count);
// translate the reslut code here
return res;
case DEV_MMC :
// translate the arguments here
result = MMC_disk_read(buff, sector, count);
// translate the reslut code here
return res;
case DEV_USB :
// translate the arguments here
result = USB_disk_read(buff, sector, count);
// translate the reslut code here
return res;
}
return RES_PARERR;
}[/mw_shl_code]
上面是原本的,改成下面
[mw_shl_code=applescript,true]DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
// result = RAM_disk_read(buff, sector, count);
// translate the reslut code here
return res;
case DEV_MMC :
// translate the arguments here
if(count==1)
{
SD_ReadBlock(sector << 9 ,buff2,SECTOR_SIZE);
memcpy(buff,buff2,SECTOR_SIZE);
}
else
{
SD_ReadMultiBlocks(sector << 9 ,buff2,SECTOR_SIZE,count);
memcpy(buff,buff2,SECTOR_SIZE * count);
}
// translate the reslut code here
return RES_OK;
case DEV_USB :
// translate the arguments here
// result = USB_disk_read(buff, sector, count);
// translate the reslut code here
return res;
}
return RES_PARERR;
}[/mw_shl_code]
并不可行,发现传入的参数是0。
然后索性改成
[mw_shl_code=applescript,true]
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
if(count==1)
{
SD_ReadBlock(sector << 9 ,buff2,SECTOR_SIZE);
memcpy(buff,buff2,SECTOR_SIZE);
}
else
{
SD_ReadMultiBlocks(sector << 9 ,buff2,SECTOR_SIZE,count);
memcpy(buff,buff2,SECTOR_SIZE * count);
}
// translate the reslut code here
return RES_OK;
}[/mw_shl_code]
就可以了。现在比较疑惑的是,怎么改这个传入参数。没有看到你说的lun; |
|