pkg/fatfs: align to interface changes of FatFs R0.13a
This commit is contained in:
parent
facfa3b23a
commit
7ad1d77786
@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* mtd devices for use by FatFs should be provided by the application */
|
/* mtd devices for use by FatFs should be provided by the application */
|
||||||
extern mtd_dev_t *fatfs_mtd_devs[_VOLUMES];
|
extern mtd_dev_t *fatfs_mtd_devs[FF_VOLUMES];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns the status of the disk
|
* @brief returns the status of the disk
|
||||||
@ -45,7 +45,7 @@ extern mtd_dev_t *fatfs_mtd_devs[_VOLUMES];
|
|||||||
DSTATUS disk_status(BYTE pdrv)
|
DSTATUS disk_status(BYTE pdrv)
|
||||||
{
|
{
|
||||||
DEBUG("disk_status %d\n", pdrv);
|
DEBUG("disk_status %d\n", pdrv);
|
||||||
if (pdrv >= _VOLUMES) {
|
if (pdrv >= FF_VOLUMES) {
|
||||||
return STA_NODISK;
|
return STA_NODISK;
|
||||||
} else if (fatfs_mtd_devs[pdrv]->driver == NULL){
|
} else if (fatfs_mtd_devs[pdrv]->driver == NULL){
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
@ -66,7 +66,7 @@ DSTATUS disk_status(BYTE pdrv)
|
|||||||
DSTATUS disk_initialize(BYTE pdrv)
|
DSTATUS disk_initialize(BYTE pdrv)
|
||||||
{
|
{
|
||||||
DEBUG("disk_initialize %d\n", pdrv);
|
DEBUG("disk_initialize %d\n", pdrv);
|
||||||
if (pdrv >= _VOLUMES) {
|
if (pdrv >= FF_VOLUMES) {
|
||||||
return STA_NODISK;
|
return STA_NODISK;
|
||||||
} else if (fatfs_mtd_devs[pdrv]->driver == NULL){
|
} else if (fatfs_mtd_devs[pdrv]->driver == NULL){
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
@ -91,7 +91,7 @@ DSTATUS disk_initialize(BYTE pdrv)
|
|||||||
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
||||||
{
|
{
|
||||||
DEBUG("disk_read: %d, %lu, %d\n", pdrv, sector, count);
|
DEBUG("disk_read: %d, %lu, %d\n", pdrv, sector, count);
|
||||||
if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
|||||||
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
||||||
{
|
{
|
||||||
DEBUG("disk_write: %d, %lu, %d\n", pdrv, sector, count);
|
DEBUG("disk_write: %d, %lu, %d\n", pdrv, sector, count);
|
||||||
if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
|||||||
/**
|
/**
|
||||||
* @brief perform miscellaneous low-level control functions
|
* @brief perform miscellaneous low-level control functions
|
||||||
*
|
*
|
||||||
* @param[in] pdrv Physical drive nmuber (0.._VOLUMES-1)
|
* @param[in] pdrv Physical drive nmuber (0..FF_VOLUMES-1)
|
||||||
* @param[in out] cmd Control code
|
* @param[in out] cmd Control code
|
||||||
* @param[in] sector Buffer to send/receive control data
|
* @param[in] sector Buffer to send/receive control data
|
||||||
*
|
*
|
||||||
@ -160,18 +160,18 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
|||||||
*/
|
*/
|
||||||
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
||||||
{
|
{
|
||||||
if ((pdrv >= _VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
if ((pdrv >= FF_VOLUMES) || (fatfs_mtd_devs[pdrv]->driver == NULL)) {
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
#if (_FS_READONLY == 0)
|
#if (FF_FS_READONLY == 0)
|
||||||
case CTRL_SYNC:
|
case CTRL_SYNC:
|
||||||
/* r/w is always finished within r/w-functions of mtd */
|
/* r/w is always finished within r/w-functions of mtd */
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_USE_MKFS == 1)
|
#if (FF_USE_MKFS == 1)
|
||||||
case GET_SECTOR_COUNT:
|
case GET_SECTOR_COUNT:
|
||||||
*(DWORD *)buff = fatfs_mtd_devs[pdrv]->sector_count;
|
*(DWORD *)buff = fatfs_mtd_devs[pdrv]->sector_count;
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
@ -183,13 +183,13 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
|||||||
return RES_OK;
|
return RES_OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_MAX_SS != _MIN_SS)
|
#if (FF_MAX_SS != FF_MIN_SS)
|
||||||
case GET_SECTOR_SIZE:
|
case GET_SECTOR_SIZE:
|
||||||
*(DWORD *)buff = fatfs_mtd_devs[pdrv]->page_size;
|
*(DWORD *)buff = fatfs_mtd_devs[pdrv]->page_size;
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_USE_TRIM == 1)
|
#if (FF_USE_TRIM == 1)
|
||||||
case CTRL_TRIM:
|
case CTRL_TRIM:
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -73,7 +73,7 @@ static int _umount(vfs_mount_t *mountp)
|
|||||||
snprintf(volume_str, sizeof(volume_str), "%d:/", fs_desc->vol_idx);
|
snprintf(volume_str, sizeof(volume_str), "%d:/", fs_desc->vol_idx);
|
||||||
|
|
||||||
DEBUG("unmounting file system of volume '%s'\n", volume_str);
|
DEBUG("unmounting file system of volume '%s'\n", volume_str);
|
||||||
FRESULT res = f_mount(NULL, volume_str, 1);
|
FRESULT res = f_unmount(volume_str);
|
||||||
|
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
DEBUG("[OK]");
|
DEBUG("[OK]");
|
||||||
|
|||||||
@ -106,7 +106,7 @@ static int _mount(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
#if _MAX_SS == _MIN_SS
|
#if FF_MAX_SS == FF_MIN_SS
|
||||||
uint16_t sector_size = TEST_FATFS_FIXED_SECTOR_SIZE;
|
uint16_t sector_size = TEST_FATFS_FIXED_SECTOR_SIZE;
|
||||||
#else
|
#else
|
||||||
uint16_t sector_size = fs->ssize;
|
uint16_t sector_size = fs->ssize;
|
||||||
@ -349,7 +349,7 @@ static int _mkfs(int argc, char **argv)
|
|||||||
|
|
||||||
char volume_str[TEST_FATFS_MAX_VOL_STR_LEN];
|
char volume_str[TEST_FATFS_MAX_VOL_STR_LEN];
|
||||||
sprintf(volume_str, "%d:/", vol_idx);
|
sprintf(volume_str, "%d:/", vol_idx);
|
||||||
BYTE work[_MAX_SS];
|
BYTE work[FF_MAX_SS];
|
||||||
|
|
||||||
puts("formatting media...");
|
puts("formatting media...");
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ static vfs_mount_t _test_vfs_mount = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* provide mtd devices for use within diskio layer of fatfs */
|
/* provide mtd devices for use within diskio layer of fatfs */
|
||||||
mtd_dev_t *fatfs_mtd_devs[_VOLUMES];
|
mtd_dev_t *fatfs_mtd_devs[FF_VOLUMES];
|
||||||
|
|
||||||
#ifdef MODULE_MTD_NATIVE
|
#ifdef MODULE_MTD_NATIVE
|
||||||
/* mtd device for native is provided in boards/native/board_init.c */
|
/* mtd device for native is provided in boards/native/board_init.c */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user