diff options
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/export/storage.h | 111 | ||||
-rw-r--r-- | firmware/storage-sim.c | 118 |
3 files changed, 141 insertions, 90 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 567fa1c579..7bd809ca60 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -122,6 +122,8 @@ drivers/fat.c | |||
122 | #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) | 122 | #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) |
123 | hotswap.c | 123 | hotswap.c |
124 | #endif | 124 | #endif |
125 | #else /* SIMULATOR */ | ||
126 | storage-sim.c | ||
125 | #endif /* SIMULATOR */ | 127 | #endif /* SIMULATOR */ |
126 | 128 | ||
127 | /* EEPROM */ | 129 | /* EEPROM */ |
diff --git a/firmware/export/storage.h b/firmware/export/storage.h index 68867a98b1..d4e69163b7 100644 --- a/firmware/export/storage.h +++ b/firmware/export/storage.h | |||
@@ -175,98 +175,29 @@ struct storage_info | |||
175 | 175 | ||
176 | #endif /* NOT CONFIG_STORAGE_MULTI */ | 176 | #endif /* NOT CONFIG_STORAGE_MULTI */ |
177 | #else /*NOT SIMULATOR */ | 177 | #else /*NOT SIMULATOR */ |
178 | static inline void storage_enable(bool on) | 178 | void storage_enable(bool on); |
179 | { | 179 | void storage_sleep(void); |
180 | (void)on; | 180 | void storage_sleepnow(void); |
181 | } | 181 | bool storage_disk_is_active(void); |
182 | static inline void storage_sleep(void) | 182 | int storage_hard_reset(void); |
183 | { | 183 | int storage_soft_reset(void); |
184 | } | 184 | int storage_init(void); |
185 | static inline void storage_sleepnow(void) | 185 | void storage_close(void); |
186 | { | 186 | int storage_read_sectors(int drive, unsigned long start, int count, void* buf); |
187 | } | 187 | int storage_write_sectors(int drive, unsigned long start, int count, const void* buf); |
188 | static inline bool storage_disk_is_active(void) | 188 | void storage_spin(void); |
189 | { | 189 | void storage_spindown(int seconds); |
190 | return 0; | ||
191 | } | ||
192 | static inline int storage_hard_reset(void) | ||
193 | { | ||
194 | return 0; | ||
195 | } | ||
196 | static inline int storage_soft_reset(void) | ||
197 | { | ||
198 | return 0; | ||
199 | } | ||
200 | static inline int storage_init(void) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | static inline void storage_close(void) | ||
205 | { | ||
206 | } | ||
207 | static inline int storage_read_sectors(int drive, unsigned long start, int count, void* buf) | ||
208 | { | ||
209 | (void)drive; | ||
210 | (void)start; | ||
211 | (void)count; | ||
212 | (void)buf; | ||
213 | return 0; | ||
214 | } | ||
215 | static inline int storage_write_sectors(int drive, unsigned long start, int count, const void* buf) | ||
216 | { | ||
217 | (void)drive; | ||
218 | (void)start; | ||
219 | (void)count; | ||
220 | (void)buf; | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static inline void storage_spin(void) | ||
225 | { | ||
226 | } | ||
227 | static inline void storage_spindown(int seconds) | ||
228 | { | ||
229 | (void)seconds; | ||
230 | } | ||
231 | |||
232 | #if (CONFIG_LED == LED_REAL) | 190 | #if (CONFIG_LED == LED_REAL) |
233 | static inline void storage_set_led_enabled(bool enabled) | 191 | void storage_set_led_enabled(bool enabled); |
234 | { | 192 | #endif |
235 | (void)enabled; | 193 | long storage_last_disk_activity(void); |
236 | } | 194 | int storage_spinup_time(void); |
237 | #endif /*LED*/ | ||
238 | |||
239 | static inline long storage_last_disk_activity(void) | ||
240 | { | ||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static inline int storage_spinup_time(void) | ||
245 | { | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | #ifdef STORAGE_GET_INFO | 195 | #ifdef STORAGE_GET_INFO |
250 | static inline void storage_get_info(int drive, struct storage_info *info) | 196 | void storage_get_info(int drive, struct storage_info *info); |
251 | { | 197 | #endif |
252 | (void)drive; | 198 | #ifdef HOTSWAP |
253 | (void)info; | 199 | bool storage_removable(int drive); |
254 | } | 200 | bool storage_present(int drive); |
255 | #endif | 201 | #endif |
256 | |||
257 | #ifdef HAVE_HOTSWAP | ||
258 | static inline bool storage_removable(int drive) | ||
259 | { | ||
260 | (void)drive; | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static inline bool storage_present(int drive) | ||
265 | { | ||
266 | (void)drive; | ||
267 | return 0; | ||
268 | } | ||
269 | #endif /* HOTSWAP */ | ||
270 | |||
271 | #endif/*NOT SIMULATOR */ | 202 | #endif/*NOT SIMULATOR */ |
272 | #endif | 203 | #endif |
diff --git a/firmware/storage-sim.c b/firmware/storage-sim.c new file mode 100644 index 0000000000..24b3f18b4e --- /dev/null +++ b/firmware/storage-sim.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: $ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Frank Gevaerts | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" /* for HAVE_MULTIVOLUME or not */ | ||
22 | #include "storage.h" | ||
23 | |||
24 | #ifdef SIMULATOR | ||
25 | void storage_enable(bool on) | ||
26 | { | ||
27 | (void)on; | ||
28 | } | ||
29 | void storage_sleep(void) | ||
30 | { | ||
31 | } | ||
32 | void storage_sleepnow(void) | ||
33 | { | ||
34 | } | ||
35 | bool storage_disk_is_active(void) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | int storage_hard_reset(void) | ||
40 | { | ||
41 | return 0; | ||
42 | } | ||
43 | int storage_soft_reset(void) | ||
44 | { | ||
45 | return 0; | ||
46 | } | ||
47 | int storage_init(void) | ||
48 | { | ||
49 | return 0; | ||
50 | } | ||
51 | void storage_close(void) | ||
52 | { | ||
53 | } | ||
54 | int storage_read_sectors(int drive, unsigned long start, int count, void* buf) | ||
55 | { | ||
56 | (void)drive; | ||
57 | (void)start; | ||
58 | (void)count; | ||
59 | (void)buf; | ||
60 | return 0; | ||
61 | } | ||
62 | int storage_write_sectors(int drive, unsigned long start, int count, const void* buf) | ||
63 | { | ||
64 | (void)drive; | ||
65 | (void)start; | ||
66 | (void)count; | ||
67 | (void)buf; | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | void storage_spin(void) | ||
72 | { | ||
73 | } | ||
74 | void storage_spindown(int seconds) | ||
75 | { | ||
76 | (void)seconds; | ||
77 | } | ||
78 | |||
79 | #if (CONFIG_LED == LED_REAL) | ||
80 | void storage_set_led_enabled(bool enabled) | ||
81 | { | ||
82 | (void)enabled; | ||
83 | } | ||
84 | #endif /*LED*/ | ||
85 | |||
86 | long storage_last_disk_activity(void) | ||
87 | { | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | int storage_spinup_time(void) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | #ifdef STORAGE_GET_INFO | ||
97 | void storage_get_info(int drive, struct storage_info *info) | ||
98 | { | ||
99 | (void)drive; | ||
100 | (void)info; | ||
101 | } | ||
102 | #endif | ||
103 | |||
104 | #ifdef HAVE_HOTSWAP | ||
105 | bool storage_removable(int drive) | ||
106 | { | ||
107 | (void)drive; | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | bool storage_present(int drive) | ||
112 | { | ||
113 | (void)drive; | ||
114 | return 0; | ||
115 | } | ||
116 | #endif /* HOTSWAP */ | ||
117 | |||
118 | #endif | ||