DRESULT disk_write ( BYTE drv, /* Physical drive nmuber (0..) */ const BYTE *buff, /* Data to be written */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to write (1..255) */ ) { if (drv == RAM) return RAM_disk_write(buff, sector, count); if (drv == MMC) return MMC_disk_write(buff, sector, count); return RES_PARERR; }
DRESULT disk_write ( BYTE pdrv, /* Physical drive nmuber to identify the drive */ const BYTE *buff, /* Data to be written */ DWORD sector, /* Start sector in LBA */ UINT count /* Number of sectors to write */ ) { DRESULT res; int result; switch (pdrv) { case DEV_RAM : // translate the arguments here result = RAM_disk_write(buff, sector, count); // translate the reslut code here return res; case DEV_MMC : // translate the arguments here result = MMC_disk_write(buff, sector, count); // translate the reslut code here return res; case DEV_USB : // translate the arguments here result = USB_disk_write(buff, sector, count); // translate the reslut code here return res; } return RES_PARERR; }