summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-18 01:47:34 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-18 01:47:34 +0000
commit6470a9ffd132f0315e1c62cbf01e2a1963b874ab (patch)
treead9ce601414dedabd35d49b0fbc0bd5121d2dddb
parent48313f58e3f7fbc329e5dcb2d193802300d56556 (diff)
downloadrockbox-6470a9ffd132f0315e1c62cbf01e2a1963b874ab.tar.gz
rockbox-6470a9ffd132f0315e1c62cbf01e2a1963b874ab.zip
sd-as3525: enable writing, sd_enable() and card_get_info_target() in bootloader
They will be needed for USB git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26904 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sd-as3525.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c
index a1625c047a..20ad241c02 100644
--- a/firmware/target/arm/as3525/sd-as3525.c
+++ b/firmware/target/arm/as3525/sd-as3525.c
@@ -123,9 +123,7 @@ static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x200)/sizeof(long)];
123static const char sd_thread_name[] = "ata/sd"; 123static const char sd_thread_name[] = "ata/sd";
124static struct mutex sd_mtx; 124static struct mutex sd_mtx;
125static struct event_queue sd_queue; 125static struct event_queue sd_queue;
126#ifndef BOOTLOADER
127bool sd_enabled = false; 126bool sd_enabled = false;
128#endif
129 127
130#if defined(HAVE_MULTIDRIVE) 128#if defined(HAVE_MULTIDRIVE)
131static bool hs_card = false; 129static bool hs_card = false;
@@ -557,10 +555,9 @@ int sd_init(void)
557 create_thread(sd_thread, sd_stack, sizeof(sd_stack), 0, 555 create_thread(sd_thread, sd_stack, sizeof(sd_stack), 0,
558 sd_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU)); 556 sd_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU));
559 557
560#ifndef BOOTLOADER
561 sd_enabled = true; 558 sd_enabled = true;
562 sd_enable(false); 559 sd_enable(false);
563#endif 560
564 return 0; 561 return 0;
565} 562}
566 563
@@ -674,8 +671,8 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
674 unsigned loops = 0; 671 unsigned loops = 0;
675 672
676 mutex_lock(&sd_mtx); 673 mutex_lock(&sd_mtx);
677#ifndef BOOTLOADER
678 sd_enable(true); 674 sd_enable(true);
675#ifndef BOOTLOADER
679 led(true); 676 led(true);
680#endif 677#endif
681 678
@@ -829,8 +826,8 @@ sd_transfer_error_nodma:
829 826
830#ifndef BOOTLOADER 827#ifndef BOOTLOADER
831 led(false); 828 led(false);
832 sd_enable(false);
833#endif 829#endif
830 sd_enable(false);
834 831
835 if (ret) /* error */ 832 if (ret) /* error */
836 card_info[drive].initialized = 0; 833 card_info[drive].initialized = 0;
@@ -848,18 +845,7 @@ int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
848int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, 845int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
849 const void* buf) 846 const void* buf)
850{ 847{
851
852#ifdef BOOTLOADER /* we don't need write support in bootloader */
853#ifdef HAVE_MULTIDRIVE
854 (void) drive;
855#endif
856 (void) start;
857 (void) count;
858 (void) buf;
859 return -1;
860#else
861 return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true); 848 return sd_transfer_sectors(IF_MD2(drive,) start, count, (void*)buf, true);
862#endif
863} 849}
864 850
865#ifndef BOOTLOADER 851#ifndef BOOTLOADER
@@ -867,6 +853,7 @@ long sd_last_disk_activity(void)
867{ 853{
868 return last_disk_activity; 854 return last_disk_activity;
869} 855}
856#endif /* !BOOTLOADER */
870 857
871void sd_enable(bool on) 858void sd_enable(bool on)
872{ 859{
@@ -926,8 +913,6 @@ tCardInfo *card_get_info_target(int card_no)
926 return &card_info[card_no]; 913 return &card_info[card_no];
927} 914}
928 915
929#endif /* !BOOTLOADER */
930
931#ifdef CONFIG_STORAGE_MULTI 916#ifdef CONFIG_STORAGE_MULTI
932int sd_num_drives(int first_drive) 917int sd_num_drives(int first_drive)
933{ 918{