summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata.c33
-rw-r--r--firmware/drivers/ata_flash.c14
-rw-r--r--firmware/drivers/ata_mmc.c40
-rw-r--r--firmware/drivers/fat.c6
-rw-r--r--firmware/drivers/ramdisk.c46
5 files changed, 109 insertions, 30 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index adc720eaf8..3c37077fd3 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -307,7 +307,7 @@ static int _read_sectors(unsigned long start,
307 int incount, 307 int incount,
308 void* inbuf) 308 void* inbuf)
309#else 309#else
310int ata_read_sectors(IF_MV2(int drive,) 310int ata_read_sectors(IF_MD2(int drive,)
311 unsigned long start, 311 unsigned long start,
312 int incount, 312 int incount,
313 void* inbuf) 313 void* inbuf)
@@ -323,7 +323,7 @@ int ata_read_sectors(IF_MV2(int drive,)
323#endif 323#endif
324 324
325#ifndef MAX_PHYS_SECTOR_SIZE 325#ifndef MAX_PHYS_SECTOR_SIZE
326#ifdef HAVE_MULTIVOLUME 326#ifdef HAVE_MULTIDRIVE
327 (void)drive; /* unused for now */ 327 (void)drive; /* unused for now */
328#endif 328#endif
329 mutex_lock(&ata_mtx); 329 mutex_lock(&ata_mtx);
@@ -555,7 +555,7 @@ static int _write_sectors(unsigned long start,
555 int count, 555 int count,
556 const void* buf) 556 const void* buf)
557#else 557#else
558int ata_write_sectors(IF_MV2(int drive,) 558int ata_write_sectors(IF_MD2(int drive,)
559 unsigned long start, 559 unsigned long start,
560 int count, 560 int count,
561 const void* buf) 561 const void* buf)
@@ -569,7 +569,7 @@ int ata_write_sectors(IF_MV2(int drive,)
569#endif 569#endif
570 570
571#ifndef MAX_PHYS_SECTOR_SIZE 571#ifndef MAX_PHYS_SECTOR_SIZE
572#ifdef HAVE_MULTIVOLUME 572#ifdef HAVE_MULTIDRIVE
573 (void)drive; /* unused for now */ 573 (void)drive; /* unused for now */
574#endif 574#endif
575 mutex_lock(&ata_mtx); 575 mutex_lock(&ata_mtx);
@@ -728,7 +728,7 @@ static inline int flush_current_sector(void)
728 sector_cache.data); 728 sector_cache.data);
729} 729}
730 730
731int ata_read_sectors(IF_MV2(int drive,) 731int ata_read_sectors(IF_MD2(int drive,)
732 unsigned long start, 732 unsigned long start,
733 int incount, 733 int incount,
734 void* inbuf) 734 void* inbuf)
@@ -736,7 +736,7 @@ int ata_read_sectors(IF_MV2(int drive,)
736 int rc = 0; 736 int rc = 0;
737 int offset; 737 int offset;
738 738
739#ifdef HAVE_MULTIVOLUME 739#ifdef HAVE_MULTIDRIVE
740 (void)drive; /* unused for now */ 740 (void)drive; /* unused for now */
741#endif 741#endif
742 mutex_lock(&ata_mtx); 742 mutex_lock(&ata_mtx);
@@ -794,7 +794,7 @@ int ata_read_sectors(IF_MV2(int drive,)
794 return rc; 794 return rc;
795} 795}
796 796
797int ata_write_sectors(IF_MV2(int drive,) 797int ata_write_sectors(IF_MD2(int drive,)
798 unsigned long start, 798 unsigned long start,
799 int count, 799 int count,
800 const void* buf) 800 const void* buf)
@@ -802,7 +802,7 @@ int ata_write_sectors(IF_MV2(int drive,)
802 int rc = 0; 802 int rc = 0;
803 int offset; 803 int offset;
804 804
805#ifdef HAVE_MULTIVOLUME 805#ifdef HAVE_MULTIDRIVE
806 (void)drive; /* unused for now */ 806 (void)drive; /* unused for now */
807#endif 807#endif
808 mutex_lock(&ata_mtx); 808 mutex_lock(&ata_mtx);
@@ -1503,7 +1503,7 @@ int ata_init(void)
1503 create_thread(ata_thread, ata_stack, 1503 create_thread(ata_thread, ata_stack,
1504 sizeof(ata_stack), 0, ata_thread_name 1504 sizeof(ata_stack), 0, ata_thread_name
1505 IF_PRIO(, PRIORITY_USER_INTERFACE) 1505 IF_PRIO(, PRIORITY_USER_INTERFACE)
1506 IF_COP(, CPU)); 1506 IF_COP(, CPU));
1507 initialized = true; 1507 initialized = true;
1508 1508
1509 } 1509 }
@@ -1552,12 +1552,15 @@ int ata_spinup_time(void)
1552} 1552}
1553 1553
1554#ifdef STORAGE_GET_INFO 1554#ifdef STORAGE_GET_INFO
1555void ata_get_info(struct storage_info *info) 1555void ata_get_info(IF_MD2(int drive,)struct storage_info *info)
1556{ 1556{
1557 unsigned short *src,*dest; 1557 unsigned short *src,*dest;
1558 static char vendor[8]; 1558 static char vendor[8];
1559 static char product[16]; 1559 static char product[16];
1560 static char revision[4]; 1560 static char revision[4];
1561#ifdef HAVE_MULTIDRIVE
1562 (void)drive; /* unused for now */
1563#endif
1561 int i; 1564 int i;
1562 info->sector_size = SECTOR_SIZE; 1565 info->sector_size = SECTOR_SIZE;
1563 info->num_sectors= total_sectors; 1566 info->num_sectors= total_sectors;
@@ -1595,3 +1598,13 @@ void ata_keep_active(void)
1595 last_disk_activity = current_tick; 1598 last_disk_activity = current_tick;
1596} 1599}
1597#endif 1600#endif
1601
1602#ifdef CONFIG_STORAGE_MULTI
1603int ata_num_drives(int first_drive)
1604{
1605 /* We don't care which logical drive number(s) we have been assigned */
1606 (void)first_drive;
1607
1608 return 1;
1609}
1610#endif
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
index ba96ea0f7d..2d31b413ac 100644
--- a/firmware/drivers/ata_flash.c
+++ b/firmware/drivers/ata_flash.c
@@ -384,7 +384,7 @@ int flash_disk_read_sectors(unsigned long start,
384 return done; 384 return done;
385} 385}
386 386
387int nand_read_sectors(IF_MV2(int drive,) 387int nand_read_sectors(IF_MD2(int drive,)
388 unsigned long start, 388 unsigned long start,
389 int incount, 389 int incount,
390 void* inbuf) 390 void* inbuf)
@@ -401,7 +401,7 @@ int nand_read_sectors(IF_MV2(int drive,)
401 return 0; 401 return 0;
402} 402}
403 403
404int nand_write_sectors(IF_MV2(int drive,) 404int nand_write_sectors(IF_MD2(int drive,)
405 unsigned long start, 405 unsigned long start,
406 int count, 406 int count,
407 const void* buf) 407 const void* buf)
@@ -472,3 +472,13 @@ void nand_get_info(struct storage_info *info)
472} 472}
473#endif 473#endif
474 474
475#ifdef CONFIG_STORAGE_MULTI
476int nand_num_drives(int first_drive)
477{
478 /* We don't care which logical drive number(s) we have been assigned */
479 (void)first_drive;
480
481 return 1;
482}
483#endif
484
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
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index a710593a69..e319669e97 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -167,7 +167,9 @@ struct bpb
167 * of first pseudo cluster */ 167 * of first pseudo cluster */
168#endif /* #ifdef HAVE_FAT16SUPPORT */ 168#endif /* #ifdef HAVE_FAT16SUPPORT */
169#ifdef HAVE_MULTIVOLUME 169#ifdef HAVE_MULTIVOLUME
170#ifdef HAVE_MULTIDRIVE
170 int drive; /* on which physical device is this located */ 171 int drive; /* on which physical device is this located */
172#endif
171 bool mounted; /* flag if this volume is mounted */ 173 bool mounted; /* flag if this volume is mounted */
172#endif 174#endif
173}; 175};
@@ -285,7 +287,7 @@ void fat_init(void)
285#endif 287#endif
286} 288}
287 289
288int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector) 290int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector)
289{ 291{
290#ifndef HAVE_MULTIVOLUME 292#ifndef HAVE_MULTIVOLUME
291 const int volume = 0; 293 const int volume = 0;
@@ -309,7 +311,7 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
309 311
310 memset(fat_bpb, 0, sizeof(struct bpb)); 312 memset(fat_bpb, 0, sizeof(struct bpb));
311 fat_bpb->startsector = startsector; 313 fat_bpb->startsector = startsector;
312#ifdef HAVE_MULTIVOLUME 314#ifdef HAVE_MULTIDRIVE
313 fat_bpb->drive = drive; 315 fat_bpb->drive = drive;
314#endif 316#endif
315 317
diff --git a/firmware/drivers/ramdisk.c b/firmware/drivers/ramdisk.c
index 0ea4012ef1..661aa39695 100644
--- a/firmware/drivers/ramdisk.c
+++ b/firmware/drivers/ramdisk.c
@@ -31,11 +31,14 @@ unsigned char ramdisk[SECTOR_SIZE * NUM_SECTORS];
31 31
32long last_disk_activity = -1; 32long last_disk_activity = -1;
33 33
34int ramdisk_read_sectors(IF_MV2(int drive,) 34int ramdisk_read_sectors(IF_MD2(int drive,)
35 unsigned long start, 35 unsigned long start,
36 int count, 36 int count,
37 void* buf) 37 void* buf)
38{ 38{
39#ifdef HAVE_MULTIDRIVE
40 (void)drive; /* unused for now */
41#endif
39 if(start+count>NUM_SECTORS) 42 if(start+count>NUM_SECTORS)
40 { 43 {
41 return -1; 44 return -1;
@@ -44,11 +47,14 @@ int ramdisk_read_sectors(IF_MV2(int drive,)
44 return 0; 47 return 0;
45} 48}
46 49
47int ramdisk_write_sectors(IF_MV2(int drive,) 50int ramdisk_write_sectors(IF_MD2(int drive,)
48 unsigned long start, 51 unsigned long start,
49 int count, 52 int count,
50 const void* buf) 53 const void* buf)
51{ 54{
55#ifdef HAVE_MULTIDRIVE
56 (void)drive; /* unused for now */
57#endif
52 if(start+count>NUM_SECTORS) 58 if(start+count>NUM_SECTORS)
53 { 59 {
54 return -1; 60 return -1;
@@ -79,13 +85,36 @@ void ramdisk_sleepnow(void)
79{ 85{
80} 86}
81 87
88void ramdisk_enable(bool on)
89{
90 (void)on;
91}
92
93bool ramdisk_disk_is_active(void)
94{
95 return true;
96}
97
98int ramdisk_soft_reset(void)
99{
100 return 0;
101}
102
103int ramdisk_spinup_time(void)
104{
105 return 0;
106}
107
82void ramdisk_spindown(int seconds) 108void ramdisk_spindown(int seconds)
83{ 109{
84 (void)seconds; 110 (void)seconds;
85} 111}
86#ifdef STORAGE_GET_INFO 112#ifdef STORAGE_GET_INFO
87void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info) 113void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info)
88{ 114{
115#ifdef HAVE_MULTIDRIVE
116 (void)drive; /* unused for now */
117#endif
89 /* firmware version */ 118 /* firmware version */
90 info->revision="0.00"; 119 info->revision="0.00";
91 120
@@ -100,3 +129,14 @@ void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info)
100} 129}
101#endif 130#endif
102 131
132#ifdef CONFIG_STORAGE_MULTI
133int ramdisk_num_drives(int first_drive)
134{
135 /* We don't care which logical drive number(s) we have been assigned */
136 (void)first_drive;
137
138 return 1;
139}
140#endif
141
142