freemyipod r621 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r620‎ | r621 | r622 >
Date:01:47, 17 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Unify single/multivolume APIs a bit more
Modified paths:
  • /emcore/trunk/storage.c (modified) (history)
  • /emcore/trunk/storage.h (modified) (history)
  • /emcore/trunk/target/ipodnano2g/storage_nand.c (modified) (history)

Diff [purge]

Index: emcore/trunk/storage.c
@@ -21,7 +21,6 @@
2222 #include "global.h"
2323 #include "storage.h"
2424
25 -#ifdef CONFIG_STORAGE_MULTI
2625
2726 #define DRIVER_MASK 0xff000000
2827 #define DRIVER_OFFSET 24
@@ -31,7 +30,6 @@
3231
3332 static unsigned int storage_drivers[NUM_DRIVES];
3433 static unsigned int num_drives;
35 -#endif
3634
3735
3836 int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count,
@@ -167,8 +165,6 @@
168166 }
169167 #endif /* STORAGE_GET_INFO */
170168
171 -#ifdef CONFIG_STORAGE_MULTI
172 -
173169 int storage_num_drives(void)
174170 {
175171 return num_drives;
@@ -568,5 +564,3 @@
569565 }
570566 }
571567 #endif
572 -
573 -#endif /*CONFIG_STORAGE_MULTI*/
Index: emcore/trunk/target/ipodnano2g/storage_nand.c
@@ -67,6 +67,11 @@
6868 (void)on;
6969 }
7070
 71+int nand_num_drives(void)
 72+{
 73+ return 1;
 74+}
 75+
7176 void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
7277 {
7378 uint32_t ppb = ftl_banks * (*ftl_nand_type).pagesperblock;
Index: emcore/trunk/storage.h
@@ -57,120 +57,21 @@
5858 /* storage_spindown, storage_sleep and storage_spin are passed as
5959 * pointers, which doesn't work with argument-macros.
6060 */
61 - #define storage_num_drives() NUM_DRIVES
6261 #if (CONFIG_STORAGE & STORAGE_ATA)
6362 #define STORAGE_FUNCTION(NAME) (ata_## NAME)
64 - #define storage_spindown ata_spindown
65 - #define storage_sleep ata_sleep
66 - #define storage_spin ata_spin
67 -
68 - #define storage_enable(on) ata_enable(on)
69 - #define storage_sleepnow() ata_sleepnow()
70 - #define storage_disk_is_active() ata_disk_is_active()
71 - #define storage_soft_reset() ata_soft_reset()
72 - #define storage_init() ata_init()
73 - #define storage_close() ata_close()
74 - #ifdef HAVE_STORAGE_FLUSH
75 - #define storage_flush() (void)0
76 - #endif
77 - #define storage_last_disk_activity() ata_last_disk_activity()
78 - #define storage_get_identify() ata_get_identify()
79 -
80 - #ifdef HAVE_HOTSWAP
81 - #define storage_removable(drive) ata_removable(IF_MD(drive))
82 - #define storage_present(drive) ata_present(IF_MD(drive))
83 - #endif
8463 #elif (CONFIG_STORAGE & STORAGE_SD)
8564 #define STORAGE_FUNCTION(NAME) (sd_## NAME)
86 - #define storage_spindown sd_spindown
87 - #define storage_sleep sd_sleep
88 - #define storage_spin sd_spin
89 -
90 - #define storage_enable(on) sd_enable(on)
91 - #define storage_sleepnow() sd_sleepnow()
92 - #define storage_disk_is_active() 0
93 - #define storage_soft_reset() (void)0
94 - #define storage_init() sd_init()
95 - #ifdef HAVE_STORAGE_FLUSH
96 - #define storage_flush() (void)0
97 - #endif
98 - #define storage_last_disk_activity() sd_last_disk_activity()
99 - #define storage_get_identify() sd_get_identify()
100 -
101 - #ifdef HAVE_HOTSWAP
102 - #define storage_removable(drive) sd_removable(IF_MD(drive))
103 - #define storage_present(drive) sd_present(IF_MD(drive))
104 - #endif
10565 #elif (CONFIG_STORAGE & STORAGE_MMC)
10666 #define STORAGE_FUNCTION(NAME) (mmc_## NAME)
107 - #define storage_spindown mmc_spindown
108 - #define storage_sleep mmc_sleep
109 - #define storage_spin mmc_spin
110 -
111 - #define storage_enable(on) mmc_enable(on)
112 - #define storage_sleepnow() mmc_sleepnow()
113 - #define storage_disk_is_active() mmc_disk_is_active()
114 - #define storage_soft_reset() (void)0
115 - #define storage_init() mmc_init()
116 - #ifdef HAVE_STORAGE_FLUSH
117 - #define storage_flush() (void)0
118 - #endif
119 - #define storage_last_disk_activity() mmc_last_disk_activity()
120 - #define storage_get_identify() mmc_get_identify()
121 -
122 - #ifdef HAVE_HOTSWAP
123 - #define storage_removable(drive) mmc_removable(IF_MD(drive))
124 - #define storage_present(drive) mmc_present(IF_MD(drive))
125 - #endif
12667 #elif (CONFIG_STORAGE & STORAGE_NAND)
12768 #define STORAGE_FUNCTION(NAME) (nand_## NAME)
128 - #define storage_spindown nand_spindown
129 - #define storage_sleep nand_sleep
130 - #define storage_spin nand_spin
131 -
132 - #define storage_enable(on) (void)0
133 - #define storage_sleepnow() nand_sleepnow()
134 - #define storage_disk_is_active() 0
135 - #define storage_soft_reset() (void)0
136 - #define storage_init() nand_init()
137 - #ifdef HAVE_STORAGE_FLUSH
138 - #define storage_flush() nand_flush()
139 - #endif
140 - #define storage_last_disk_activity() nand_last_disk_activity()
141 - #define storage_get_identify() nand_get_identify()
142 -
143 - #ifdef HAVE_HOTSWAP
144 - #define storage_removable(drive) nand_removable(IF_MD(drive))
145 - #define storage_present(drive) nand_present(IF_MD(drive))
146 - #endif
14769 #elif (CONFIG_STORAGE & STORAGE_RAMDISK)
14870 #define STORAGE_FUNCTION(NAME) (ramdisk_## NAME)
149 - #define storage_spindown ramdisk_spindown
150 - #define storage_sleep ramdisk_sleep
151 - #define storage_spin ramdisk_spin
152 -
153 - #define storage_enable(on) (void)0
154 - #define storage_sleepnow() ramdisk_sleepnow()
155 - #define storage_disk_is_active() 0
156 - #define storage_soft_reset() (void)0
157 - #define storage_init() ramdisk_init()
158 - #ifdef HAVE_STORAGE_FLUSH
159 - #define storage_flush() (void)0
160 - #endif
161 - #define storage_last_disk_activity() ramdisk_last_disk_activity()
162 - #define storage_get_identify() ramdisk_get_identify()
163 -
164 - #ifdef HAVE_HOTSWAP
165 - #define storage_removable(drive) ramdisk_removable(IF_MD(drive))
166 - #define storage_present(drive) ramdisk_present(IF_MD(drive))
167 - #endif
16871 #else
16972 //#error No storage driver!
17073 #endif
171 -#else /* NOT CONFIG_STORAGE_MULTI */
 74+#endif
17275
173 -/* Simulator and multi-driver use normal functions */
174 -
17576 void storage_enable(bool on);
17677 void storage_sleep(void);
17778 void storage_sleepnow(void);
@@ -187,8 +88,6 @@
18889 bool storage_present(int drive);
18990 #endif
19091
191 -#endif /* NOT CONFIG_STORAGE_MULTI */
192 -
19392 int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
19493 int storage_read_sectors_md(int drive, unsigned long start, int count, void* buf);
19594 int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);