Adds the diskio interface for the FAT file system. This revision uses RAM to emulate disk storage. Origin: Original Jira: ZEP-285 Change-Id: I7a30c8761d5ed9b564f1d1e08482c5ef199d7372 Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
75 lines
3.2 KiB
C
75 lines
3.2 KiB
C
/*-----------------------------------------------------------------------*/
|
|
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
|
|
/*-----------------------------------------------------------------------*/
|
|
/* If a working storage control module is available, it should be */
|
|
/* attached to the FatFs via a glue function rather than modifying it. */
|
|
/* This is an example of glue functions to attach various exsisting */
|
|
/* storage control modules to the FatFs module with a defined API. */
|
|
/*-----------------------------------------------------------------------*/
|
|
/*----------------------------------------------------------------------------/
|
|
/ FatFs - Generic FAT file system module R0.12a /
|
|
/-----------------------------------------------------------------------------/
|
|
/
|
|
/ Copyright (C) 2016, ChaN, all right reserved.
|
|
/
|
|
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
|
/ source and binary forms, with or without modification, are permitted provided
|
|
/ that the following condition is met:
|
|
|
|
/ 1. Redistributions of source code must retain the above copyright notice,
|
|
/ this condition and the following disclaimer.
|
|
/
|
|
/ This software is provided by the copyright holder and contributors "AS IS"
|
|
/ and any warranties related to this software are DISCLAIMED.
|
|
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
|
/ by use of this software.
|
|
/----------------------------------------------------------------------------*/
|
|
|
|
#include <diskio.h> /* FatFs lower layer API */
|
|
#include <fs/fat_diskio.h>
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Get Drive Status */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DSTATUS disk_status(uint8_t pdrv)
|
|
{
|
|
return fat_disk_status();
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Inidialize a Drive */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DSTATUS disk_initialize(uint8_t pdrv)
|
|
{
|
|
return fat_disk_initialize();
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Read Sector(s) */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DRESULT disk_read(uint8_t pdrv, uint8_t *buff, unsigned long sector,
|
|
uint32_t count)
|
|
{
|
|
return fat_disk_read(buff, sector, count);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Write Sector(s) */
|
|
/*-----------------------------------------------------------------------*/
|
|
DRESULT disk_write(uint8_t pdrv,
|
|
const uint8_t *buff, unsigned long sector, uint32_t count)
|
|
{
|
|
return fat_disk_write(buff, sector, count);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------*/
|
|
/* Miscellaneous Functions */
|
|
/*-----------------------------------------------------------------------*/
|
|
|
|
DRESULT disk_ioctl(uint8_t pdrv, uint8_t cmd, void *buff)
|
|
{
|
|
return fat_disk_ioctl(cmd, buff);
|
|
}
|