You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qmk_firmware/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.c

47 lines
1.2 KiB

/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for Petit FatFs (C)ChaN, 2009 */
/*-----------------------------------------------------------------------*/
#include "diskio.h"
#include <string.h>
#include "../DataflashManager.h"
/*-----------------------------------------------------------------------*/
/* Initialize Disk Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (void)
{
DSTATUS stat;
stat = RES_OK;
return stat;
}
/*-----------------------------------------------------------------------*/
/* Read Partial Sector */
/*-----------------------------------------------------------------------*/
DRESULT disk_readp (
void* dest, /* Pointer to the destination object */
DWORD sector, /* Sector number (LBA) */
WORD sofs, /* Offset in the sector */
WORD count /* Byte count (bit15:destination) */
)
{
DRESULT res;
uint8_t BlockTemp[512];
DataflashManager_ReadBlocks_RAM(sector, 1, BlockTemp);
memcpy(dest, &BlockTemp[sofs], count);
res = RES_OK;
return res;
}