summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ata-sd-pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ata-sd-pp.c')
-rw-r--r--firmware/target/arm/ata-sd-pp.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index 1a76eeeba2..77d3c3dc31 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -18,7 +18,7 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "config.h" /* for HAVE_MULTIVOLUME */ 21#include "config.h" /* for HAVE_MULTIDRIVE */
22#include "fat.h" 22#include "fat.h"
23#include "hotswap.h" 23#include "hotswap.h"
24#ifdef HAVE_HOTSWAP 24#ifdef HAVE_HOTSWAP
@@ -166,10 +166,10 @@ struct sd_card_status
166 int retry_max; 166 int retry_max;
167}; 167};
168 168
169static struct sd_card_status sd_status[NUM_VOLUMES] = 169static struct sd_card_status sd_status[NUM_DRIVES] =
170{ 170{
171 { 0, 1 }, 171 { 0, 1 },
172#ifdef HAVE_MULTIVOLUME 172#ifdef HAVE_MULTIDRIVE
173 { 0, 10 } 173 { 0, 10 }
174#endif 174#endif
175}; 175};
@@ -839,10 +839,10 @@ static void sd_select_device(int card_no)
839 839
840/* API Functions */ 840/* API Functions */
841 841
842int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, 842int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
843 void* inbuf) 843 void* inbuf)
844{ 844{
845#ifndef HAVE_MULTIVOLUME 845#ifndef HAVE_MULTIDRIVE
846 const int drive = 0; 846 const int drive = 0;
847#endif 847#endif
848 int ret; 848 int ret;
@@ -956,13 +956,13 @@ sd_read_error:
956 } 956 }
957} 957}
958 958
959int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, 959int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
960 const void* outbuf) 960 const void* outbuf)
961{ 961{
962/* Write support is not finished yet */ 962/* Write support is not finished yet */
963/* TODO: The standard suggests using ACMD23 prior to writing multiple blocks 963/* TODO: The standard suggests using ACMD23 prior to writing multiple blocks
964 to improve performance */ 964 to improve performance */
965#ifndef HAVE_MULTIVOLUME 965#ifndef HAVE_MULTIDRIVE
966 const int drive = 0; 966 const int drive = 0;
967#endif 967#endif
968 int ret; 968 int ret;
@@ -1330,19 +1330,33 @@ long sd_last_disk_activity(void)
1330} 1330}
1331 1331
1332#ifdef HAVE_HOTSWAP 1332#ifdef HAVE_HOTSWAP
1333bool sd_removable(IF_MV_NONVOID(int drive)) 1333bool sd_removable(IF_MD_NONVOID(int drive))
1334{ 1334{
1335#ifndef HAVE_MULTIVOLUME 1335#ifndef HAVE_MULTIDRIVE
1336 const int drive=0; 1336 const int drive=0;
1337#endif 1337#endif
1338 return (drive==1); 1338 return (drive==1);
1339} 1339}
1340 1340
1341bool sd_present(IF_MV_NONVOID(int drive)) 1341bool sd_present(IF_MD_NONVOID(int drive))
1342{ 1342{
1343#ifndef HAVE_MULTIVOLUME 1343#ifndef HAVE_MULTIDRIVE
1344 const int drive=0; 1344 const int drive=0;
1345#endif 1345#endif
1346 return (card_info[drive].initialized && card_info[drive].numblocks > 0); 1346 return (card_info[drive].initialized && card_info[drive].numblocks > 0);
1347} 1347}
1348#endif 1348#endif
1349
1350#ifdef CONFIG_STORAGE_MULTI
1351int sd_num_drives(int first_drive)
1352{
1353 /* We don't care which logical drive number(s) we have been assigned */
1354 (void)first_drive;
1355
1356#ifdef HAVE_MULTIDRIVE
1357 return 2;
1358#else
1359 return 1;
1360#endif
1361}
1362#endif