diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2008-11-01 16:14:28 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2008-11-01 16:14:28 +0000 |
commit | 2f8a0081c64534da23fc0fa9cc685eb7454fd9c9 (patch) | |
tree | 84dbdbd5326cb48f43d2ebd5a4c86e992c1d5288 /firmware/usb.c | |
parent | 646cac0bde7b11fa7bcb670d1d76eec78e360485 (diff) | |
download | rockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.tar.gz rockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.zip |
Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do that, it also introduces sd_*, nand_*, and mmc_*.
This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usb.c')
-rw-r--r-- | firmware/usb.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 9064987ed1..bfb99e0607 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "thread.h" | 29 | #include "thread.h" |
30 | #include "system.h" | 30 | #include "system.h" |
31 | #include "debug.h" | 31 | #include "debug.h" |
32 | #include "ata.h" | 32 | #include "storage.h" |
33 | #include "fat.h" | 33 | #include "fat.h" |
34 | #include "disk.h" | 34 | #include "disk.h" |
35 | #include "panic.h" | 35 | #include "panic.h" |
@@ -86,7 +86,7 @@ static struct event_queue usb_queue; | |||
86 | static int last_usb_status; | 86 | static int last_usb_status; |
87 | static bool usb_monitor_enabled; | 87 | static bool usb_monitor_enabled; |
88 | #ifdef HAVE_USBSTACK | 88 | #ifdef HAVE_USBSTACK |
89 | static bool exclusive_ata_access; | 89 | static bool exclusive_storage_access; |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | 92 | ||
@@ -105,9 +105,9 @@ static void usb_slave_mode(bool on) | |||
105 | if(on) | 105 | if(on) |
106 | { | 106 | { |
107 | DEBUGF("Entering USB slave mode\n"); | 107 | DEBUGF("Entering USB slave mode\n"); |
108 | ata_soft_reset(); | 108 | storage_soft_reset(); |
109 | ata_init(); | 109 | storage_init(); |
110 | ata_enable(false); | 110 | storage_enable(false); |
111 | usb_enable(true); | 111 | usb_enable(true); |
112 | } | 112 | } |
113 | else | 113 | else |
@@ -119,9 +119,9 @@ static void usb_slave_mode(bool on) | |||
119 | 119 | ||
120 | usb_enable(false); | 120 | usb_enable(false); |
121 | 121 | ||
122 | rc = ata_init(); | 122 | rc = storage_init(); |
123 | if(rc) | 123 | if(rc) |
124 | panicf("ata: %d",rc); | 124 | panicf("storage: %d",rc); |
125 | 125 | ||
126 | rc = disk_mount_all(); | 126 | rc = disk_mount_all(); |
127 | if (rc <= 0) /* no partition */ | 127 | if (rc <= 0) /* no partition */ |
@@ -134,7 +134,7 @@ static void usb_slave_mode(bool on) | |||
134 | static void try_reboot(void) | 134 | static void try_reboot(void) |
135 | { | 135 | { |
136 | #ifdef HAVE_DISK_STORAGE | 136 | #ifdef HAVE_DISK_STORAGE |
137 | ata_sleepnow(); /* Immediately spindown the disk. */ | 137 | storage_sleepnow(); /* Immediately spindown the disk. */ |
138 | sleep(HZ*2); | 138 | sleep(HZ*2); |
139 | #endif | 139 | #endif |
140 | 140 | ||
@@ -262,7 +262,7 @@ static void usb_thread(void) | |||
262 | #ifdef HAVE_PRIORITY_SCHEDULING | 262 | #ifdef HAVE_PRIORITY_SCHEDULING |
263 | thread_set_priority(usb_thread_entry,PRIORITY_REALTIME); | 263 | thread_set_priority(usb_thread_entry,PRIORITY_REALTIME); |
264 | #endif | 264 | #endif |
265 | exclusive_ata_access = true; | 265 | exclusive_storage_access = true; |
266 | 266 | ||
267 | #else | 267 | #else |
268 | usb_slave_mode(true); | 268 | usb_slave_mode(true); |
@@ -310,12 +310,12 @@ static void usb_thread(void) | |||
310 | 310 | ||
311 | usb_state = USB_EXTRACTED; | 311 | usb_state = USB_EXTRACTED; |
312 | #ifdef HAVE_USBSTACK | 312 | #ifdef HAVE_USBSTACK |
313 | if(exclusive_ata_access) | 313 | if(exclusive_storage_access) |
314 | { | 314 | { |
315 | int rc = disk_mount_all(); | 315 | int rc = disk_mount_all(); |
316 | if (rc <= 0) /* no partition */ | 316 | if (rc <= 0) /* no partition */ |
317 | panicf("mount: %d",rc); | 317 | panicf("mount: %d",rc); |
318 | exclusive_ata_access = false; | 318 | exclusive_storage_access = false; |
319 | #endif | 319 | #endif |
320 | /* Tell all threads that we are back in business */ | 320 | /* Tell all threads that we are back in business */ |
321 | num_acks_to_expect = | 321 | num_acks_to_expect = |
@@ -455,7 +455,7 @@ void usb_init(void) | |||
455 | { | 455 | { |
456 | usb_state = USB_EXTRACTED; | 456 | usb_state = USB_EXTRACTED; |
457 | #ifdef HAVE_USBSTACK | 457 | #ifdef HAVE_USBSTACK |
458 | exclusive_ata_access = false; | 458 | exclusive_storage_access = false; |
459 | #endif | 459 | #endif |
460 | usb_monitor_enabled = false; | 460 | usb_monitor_enabled = false; |
461 | countdown = -1; | 461 | countdown = -1; |
@@ -561,7 +561,7 @@ void usb_request_exclusive_ata(void) | |||
561 | * currently the best one. We want to get rid of having to boost the cpu | 561 | * currently the best one. We want to get rid of having to boost the cpu |
562 | * for usb anyway */ | 562 | * for usb anyway */ |
563 | trigger_cpu_boost(); | 563 | trigger_cpu_boost(); |
564 | if(!exclusive_ata_access) { | 564 | if(!exclusive_storage_access) { |
565 | queue_post(&usb_queue, USB_REQUEST_DISK, 0); | 565 | queue_post(&usb_queue, USB_REQUEST_DISK, 0); |
566 | } | 566 | } |
567 | } | 567 | } |
@@ -569,15 +569,15 @@ void usb_request_exclusive_ata(void) | |||
569 | void usb_release_exclusive_ata(void) | 569 | void usb_release_exclusive_ata(void) |
570 | { | 570 | { |
571 | cancel_cpu_boost(); | 571 | cancel_cpu_boost(); |
572 | if(exclusive_ata_access) { | 572 | if(exclusive_storage_access) { |
573 | queue_post(&usb_queue, USB_RELEASE_DISK, 0); | 573 | queue_post(&usb_queue, USB_RELEASE_DISK, 0); |
574 | exclusive_ata_access = false; | 574 | exclusive_storage_access = false; |
575 | } | 575 | } |
576 | } | 576 | } |
577 | 577 | ||
578 | bool usb_exclusive_ata(void) | 578 | bool usb_exclusive_ata(void) |
579 | { | 579 | { |
580 | return exclusive_ata_access; | 580 | return exclusive_storage_access; |
581 | } | 581 | } |
582 | #endif | 582 | #endif |
583 | 583 | ||