From 51b680c3bd396d6f32623d6fc49a113d4b75d440 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 9 May 2016 21:55:57 -0700 Subject: [PATCH] Implement FatFs disk_ioctl MMC_GET_{TYPE,CSD}. --- .../os/various/fatfs_bindings/fatfs_diskio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/firmware/chibios-portapack/os/various/fatfs_bindings/fatfs_diskio.c b/firmware/chibios-portapack/os/various/fatfs_bindings/fatfs_diskio.c index 7f090f16..d6cd3b1f 100755 --- a/firmware/chibios-portapack/os/various/fatfs_bindings/fatfs_diskio.c +++ b/firmware/chibios-portapack/os/various/fatfs_bindings/fatfs_diskio.c @@ -10,6 +10,8 @@ #include "ch.h" #include "hal.h" +#include + #include "diskio.h" #if HAL_USE_MMC_SPI && HAL_USE_SDC @@ -212,6 +214,12 @@ DRESULT disk_ioctl ( case GET_SECTOR_SIZE: *((WORD *)buff) = MMCSD_BLOCK_SIZE; return RES_OK; + case MMC_GET_TYPE: + *((BYTE *)buff) = SDCD1.cardmode; + return RES_OK; + case MMC_GET_CSD: + memcpy(buff, &SDCD1.csd, sizeof(SDCD1.csd)); + return RES_OK; #if _USE_ERASE case CTRL_ERASE_SECTOR: mmcErase(&MMCD1, *((DWORD *)buff), *((DWORD *)buff + 1)); @@ -234,6 +242,12 @@ DRESULT disk_ioctl ( case GET_BLOCK_SIZE: *((DWORD *)buff) = 1; /* Unknown, TODO: implement? */ return RES_OK; + case MMC_GET_TYPE: + *((BYTE *)buff) = SDCD1.cardmode; + return RES_OK; + case MMC_GET_CSD: + memcpy(buff, &SDCD1.csd, sizeof(SDCD1.csd)); + return RES_OK; #if _USE_ERASE case CTRL_ERASE_SECTOR: sdcErase(&SDCD1, *((DWORD *)buff), *((DWORD *)buff + 1));