Fix diskio.c, etc.

This commit is contained in:
TuxSH 2018-05-15 23:54:33 +02:00
parent bf3eea7031
commit 9a86ffec68
3 changed files with 4 additions and 5 deletions

View file

@ -86,7 +86,6 @@ const char *VolumeStr[FF_VOLUMES] = { FKNAM, FKNAM, FKNAM, FKNAM, FKNAM, FKNAM,
/* For diskio.c code */ /* For diskio.c code */
device_partition_t *g_volume_to_devparts[FF_VOLUMES] = { NULL }; device_partition_t *g_volume_to_devparts[FF_VOLUMES] = { NULL };
#include <stdio.h>
int fsdev_mount_device(const char *name, const device_partition_t *devpart, bool initialize_immediately) { int fsdev_mount_device(const char *name, const device_partition_t *devpart, bool initialize_immediately) {
fsdev_fsdevice_t *device = NULL; fsdev_fsdevice_t *device = NULL;
FRESULT rc; FRESULT rc;

View file

@ -72,7 +72,7 @@ DRESULT disk_read (
if (devpart == NULL) { if (devpart == NULL) {
return RES_PARERR; return RES_PARERR;
} else if (devpart->reader != NULL) { } else if (devpart->reader != NULL) {
int rc = devpart->reader(devpart, buff, sector, count); int rc = device_partition_read_data(devpart, buff, sector, count);
return rc == 0 ? 0 : RES_ERROR; return rc == 0 ? 0 : RES_ERROR;
} else { } else {
return RES_ERROR; return RES_ERROR;
@ -97,7 +97,7 @@ DRESULT disk_write (
if (devpart == NULL) { if (devpart == NULL) {
return RES_PARERR; return RES_PARERR;
} else if (devpart->writer != NULL) { } else if (devpart->writer != NULL) {
int rc = devpart->writer(devpart, buff, sector, count); int rc = device_partition_write_data(devpart, buff, sector, count);
return rc == 0 ? 0 : RES_ERROR; return rc == 0 ? 0 : RES_ERROR;
} else { } else {
return RES_ERROR; return RES_ERROR;

View file

@ -45,13 +45,13 @@ static int mmc_partition_initialize(device_partition_t *devpart) {
int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller); int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller);
if (rc == 0) { if (rc == 0) {
sdmmc_set_write_enable(mmcpart->mmc, SDMMC_WRITE_ENABLED); sdmmc_set_write_enable(mmcpart->mmc, SDMMC_WRITE_ENABLED);
g_sd_mmc_initialized = true; devpart->initialized = g_sd_mmc_initialized = true;
} }
return rc; return rc;
} else if (mmcpart->mmc == &g_nand_mmc && !g_nand_mmc_initialized) { } else if (mmcpart->mmc == &g_nand_mmc && !g_nand_mmc_initialized) {
int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller); int rc = sdmmc_init(mmcpart->mmc, mmcpart->controller);
if (rc == 0) { if (rc == 0) {
g_nand_mmc_initialized = true; devpart->initialized = g_nand_mmc_initialized = true;
} }
return rc; return rc;
} }