DRESULT disk_read ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to read (1..255) */ ) { DRESULT res; int result; switch (drv) { case ATA : result = ATA_disk_read(buff, sector, count); // translate the reslut code here return res; case MMC : result = MMC_disk_read(buff, sector, count); // translate the reslut code here return res; case USB : result = USB_disk_read(buff, sector, count); // translate the reslut code here return res; } return RES_PARERR; }
DRESULT disk_read ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to read (1..128) */ ) { DRESULT res; int result; switch (drv) { #ifdef PAKAI_ATA case ATA : // translate the arguments here result = ATA_disk_read(buff, sector, count); // translate the reslut code here return res; #endif #ifdef PAKAI_MMC case MMC : // translate the arguments here result = MMC_disk_read(buff, sector, count); // translate the reslut code here return res; #endif #ifdef PAKAI_USB_STORAGE case USB : // translate the arguments here result = USB_disk_read(buff, sector, count); // translate the reslut code here return res; #endif case SDC : return res; case ROM : return res; } return RES_PARERR; }
DRESULT disk_read ( BYTE pdrv, /* Physical drive nmuber to identify the drive */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address in LBA */ UINT count /* Number of sectors to read */ ) { DRESULT res = RES_OK; int result; #if 0 switch (pdrv) { case ATA : // translate the arguments here result = ATA_disk_read(buff, sector, count); // translate the reslut code here return res; case MMC : // translate the arguments here result = MMC_disk_read(buff, sector, count); // translate the reslut code here return res; case USB : // translate the arguments here result = USB_disk_read(buff, sector, count); // translate the reslut code here return res; } #else result = (g_tFatDrvs[pdrv].DrvRead)(buff, sector, count); if(0 == result) return res; // 成功 #endif return RES_PARERR; }
DRESULT disk_read ( BYTE pdrv, /* Physical drive nmuber to identify the drive */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address in LBA */ UINT count /* Number of sectors to read */ ) { DRESULT res; int result; switch (pdrv) { case ATA : // translate the arguments here result = ATA_disk_read(buff, sector, count); // translate the reslut code here return res; case MMC : // translate the arguments here result = MMC_disk_read(buff, sector, count); // translate the reslut code here return res; case USB : // translate the arguments here result = USB_disk_read(buff, sector, count); // translate the reslut code here return res; } return RES_PARERR; }
DRESULT disk_read_fs ( BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ DWORD count /* Number of sectors to read (1..128) */ ) { #ifndef CONFIG_ALLWINNER DRESULT res; #endif int result; unsigned int start_block; #ifndef CONFIG_ALLWINNER switch (pdrv) { case ATA : // translate the arguments here result = ATA_disk_read(buff, sector, count); // translate the reslut code here return res; case MMC : // translate the arguments here result = MMC_disk_read(buff, sector, count); // translate the reslut code here return res; case USB : // translate the arguments here result = USB_disk_read(buff, sector, count); // translate the reslut code here return res; } return RES_PARERR; #else // result = sunxi_test_mmc_read(sector+0x12000, count, buff); start_block = sunxi_partition_get_offset_byname(PART_NAME[pdrv]); if (!start_block) { printf("[disk_read_fs] no the partition\n"); return RES_ERROR; } // printf("read part %s\n", PART_NAME[pdrv]); // result = sunxi_test_nand_read((unsigned int)(sector+start_block),(unsigned int)count,buff); result = sunxi_flash_read(sector+start_block,count, buff); if(!result) { printf("read all error: start=%lx, addr=0x%x count=0x%x\n", sector, (unsigned int)buff,(unsigned int)count); return 1; } return RES_OK; #endif }