summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata_mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/ata_mmc.c')
-rw-r--r--firmware/drivers/ata_mmc.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 0fe89c5be8..239778577d 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -126,7 +126,7 @@ static int current_buffer = 0;
126static const unsigned char *send_block_addr = NULL; 126static const unsigned char *send_block_addr = NULL;
127 127
128static tCardInfo card_info[2]; 128static tCardInfo card_info[2];
129#ifndef HAVE_MULTIVOLUME 129#ifndef HAVE_MULTIDRIVE
130static int current_card = 0; 130static int current_card = 0;
131#endif 131#endif
132static bool last_mmc_status = false; 132static bool last_mmc_status = false;
@@ -602,7 +602,7 @@ static int send_block_send(unsigned char start_token, long timeout,
602 return rc; 602 return rc;
603} 603}
604 604
605int mmc_read_sectors(IF_MV2(int drive,) 605int mmc_read_sectors(IF_MD2(int drive,)
606 unsigned long start, 606 unsigned long start,
607 int incount, 607 int incount,
608 void* inbuf) 608 void* inbuf)
@@ -611,7 +611,7 @@ int mmc_read_sectors(IF_MV2(int drive,)
611 int lastblock = 0; 611 int lastblock = 0;
612 unsigned long end_block; 612 unsigned long end_block;
613 tCardInfo *card; 613 tCardInfo *card;
614#ifndef HAVE_MULTIVOLUME 614#ifndef HAVE_MULTIDRIVE
615 int drive = current_card; 615 int drive = current_card;
616#endif 616#endif
617 617
@@ -688,7 +688,7 @@ int mmc_read_sectors(IF_MV2(int drive,)
688 return rc; 688 return rc;
689} 689}
690 690
691int mmc_write_sectors(IF_MV2(int drive,) 691int mmc_write_sectors(IF_MD2(int drive,)
692 unsigned long start, 692 unsigned long start,
693 int count, 693 int count,
694 const void* buf) 694 const void* buf)
@@ -697,7 +697,7 @@ int mmc_write_sectors(IF_MV2(int drive,)
697 int write_cmd; 697 int write_cmd;
698 unsigned char start_token; 698 unsigned char start_token;
699 tCardInfo *card; 699 tCardInfo *card;
700#ifndef HAVE_MULTIVOLUME 700#ifndef HAVE_MULTIDRIVE
701 int drive = current_card; 701 int drive = current_card;
702#endif 702#endif
703 703
@@ -920,7 +920,7 @@ int mmc_init(void)
920 led(false); 920 led(false);
921 921
922 last_mmc_status = mmc_detect(); 922 last_mmc_status = mmc_detect();
923#ifndef HAVE_MULTIVOLUME 923#ifndef HAVE_MULTIDRIVE
924 /* Use MMC if inserted, internal flash otherwise */ 924 /* Use MMC if inserted, internal flash otherwise */
925 current_card = last_mmc_status ? 1 : 0; 925 current_card = last_mmc_status ? 1 : 0;
926#endif 926#endif
@@ -949,7 +949,7 @@ int mmc_init(void)
949 create_thread(mmc_thread, mmc_stack, 949 create_thread(mmc_thread, mmc_stack,
950 sizeof(mmc_stack), 0, mmc_thread_name 950 sizeof(mmc_stack), 0, mmc_thread_name
951 IF_PRIO(, PRIORITY_SYSTEM) 951 IF_PRIO(, PRIORITY_SYSTEM)
952 IF_COP(, CPU)); 952 IF_COP(, CPU));
953 tick_add_task(mmc_tick); 953 tick_add_task(mmc_tick);
954 initialized = true; 954 initialized = true;
955 } 955 }
@@ -965,9 +965,9 @@ long mmc_last_disk_activity(void)
965} 965}
966 966
967#ifdef STORAGE_GET_INFO 967#ifdef STORAGE_GET_INFO
968void mmc_get_info(IF_MV2(int drive,) struct storage_info *info) 968void mmc_get_info(IF_MD2(int drive,) struct storage_info *info)
969{ 969{
970#ifndef HAVE_MULTIVOLUME 970#ifndef HAVE_MULTIDRIVE
971 const int drive=0; 971 const int drive=0;
972#endif 972#endif
973 info->sector_size=card_info[drive].blocksize; 973 info->sector_size=card_info[drive].blocksize;
@@ -986,17 +986,17 @@ void mmc_get_info(IF_MV2(int drive,) struct storage_info *info)
986#endif 986#endif
987 987
988#ifdef HAVE_HOTSWAP 988#ifdef HAVE_HOTSWAP
989bool mmc_removable(IF_MV_NONVOID(int drive)) 989bool mmc_removable(IF_MD_NONVOID(int drive))
990{ 990{
991#ifndef HAVE_MULTIVOLUME 991#ifndef HAVE_MULTIDRIVE
992 const int drive=0; 992 const int drive=0;
993#endif 993#endif
994 return (drive==1); 994 return (drive==1);
995} 995}
996 996
997bool mmc_present(IF_MV_NONVOID(int drive)) 997bool mmc_present(IF_MD_NONVOID(int drive))
998{ 998{
999#ifndef HAVE_MULTIVOLUME 999#ifndef HAVE_MULTIDRIVE
1000 const int drive=0; 1000 const int drive=0;
1001#endif 1001#endif
1002 return (card_info[drive].initialized && card_info[drive].numblocks > 0); 1002 return (card_info[drive].initialized && card_info[drive].numblocks > 0);
@@ -1016,3 +1016,17 @@ void mmc_spindown(int seconds)
1016{ 1016{
1017 (void)seconds; 1017 (void)seconds;
1018} 1018}
1019
1020#ifdef CONFIG_STORAGE_MULTI
1021int mmc_num_drives(int first_drive)
1022{
1023 /* We don't care which logical drive number(s) we have been assigned */
1024 (void)first_drive;
1025
1026#ifdef HAVE_MULTIDRIVE
1027 return 2;
1028#else
1029 return 1;
1030#endif
1031}
1032#endif