/*-----------------------------------------------------------------------*/1/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */2/*-----------------------------------------------------------------------*/3/* If a working storage control module is available, it should be */4/* attached to the FatFs via a glue function rather than modifying it. */5/* This is an example of glue functions to attach various exsisting */6/* storage control modules to the FatFs module with a defined API. */7/*-----------------------------------------------------------------------*/89#include <string.h>1011#include <bdk.h>1213#include <libs/fatfs/diskio.h> /* FatFs lower layer API */1415/*-----------------------------------------------------------------------*/16/* Get Drive Status */17/*-----------------------------------------------------------------------*/18DSTATUS disk_status (19BYTE pdrv /* Physical drive nmuber to identify the drive */20)21{22return 0;23}2425/*-----------------------------------------------------------------------*/26/* Inidialize a Drive */27/*-----------------------------------------------------------------------*/28DSTATUS disk_initialize (29BYTE pdrv /* Physical drive nmuber to identify the drive */30)31{32return 0;33}3435/*-----------------------------------------------------------------------*/36/* Read Sector(s) */37/*-----------------------------------------------------------------------*/38DRESULT disk_read (39BYTE pdrv, /* Physical drive nmuber to identify the drive */40BYTE *buff, /* Data buffer to store read data */41DWORD sector, /* Start sector in LBA */42UINT count /* Number of sectors to read */43)44{45return sdmmc_storage_read(&sd_storage, sector, count, buff) ? RES_OK : RES_ERROR;46}4748/*-----------------------------------------------------------------------*/49/* Write Sector(s) */50/*-----------------------------------------------------------------------*/51DRESULT disk_write (52BYTE pdrv, /* Physical drive nmuber to identify the drive */53const BYTE *buff, /* Data to be written */54DWORD sector, /* Start sector in LBA */55UINT count /* Number of sectors to write */56)57{58return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;59}6061/*-----------------------------------------------------------------------*/62/* Miscellaneous Functions */63/*-----------------------------------------------------------------------*/64DRESULT disk_ioctl (65BYTE pdrv, /* Physical drive nmuber (0..) */66BYTE cmd, /* Control code */67void *buff /* Buffer to send/receive control data */68)69{70return RES_OK;71}727374