summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-08-17 12:18:22 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-08-17 12:18:22 -0400
commita56f1ca1ed63b93eb61fd5319f47347b3eb1e364 (patch)
tree62a253ba44b23c1867cef59fee40b40092719ee1 /firmware/export
parentc13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682 (diff)
downloadrockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.tar.gz
rockbox-a56f1ca1ed63b93eb61fd5319f47347b3eb1e364.zip
Cleanup MV/MD macros a little.
When using variadic macros there's no need for IF_MD2/IF_MV2 to deal with function parameters. IF_MD/IF_MV are enough. Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0 if not. Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/ata.h6
-rw-r--r--firmware/export/fat.h8
-rw-r--r--firmware/export/mmc.h6
-rw-r--r--firmware/export/mv.h29
-rw-r--r--firmware/export/nand.h6
-rw-r--r--firmware/export/ramdisk.h6
-rw-r--r--firmware/export/sd.h6
-rw-r--r--firmware/export/storage.h14
8 files changed, 41 insertions, 40 deletions
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index 41a2fd5c9f..0bcb144e63 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -39,8 +39,8 @@ bool ata_disk_is_active(void);
39int ata_soft_reset(void); 39int ata_soft_reset(void);
40int ata_init(void) STORAGE_INIT_ATTR; 40int ata_init(void) STORAGE_INIT_ATTR;
41void ata_close(void); 41void ata_close(void);
42int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 42int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
43int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 43int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
44void ata_spin(void); 44void ata_spin(void);
45#if (CONFIG_LED == LED_REAL) 45#if (CONFIG_LED == LED_REAL)
46void ata_set_led_enabled(bool enabled); 46void ata_set_led_enabled(bool enabled);
@@ -48,7 +48,7 @@ void ata_set_led_enabled(bool enabled);
48unsigned short* ata_get_identify(void); 48unsigned short* ata_get_identify(void);
49 49
50#ifdef STORAGE_GET_INFO 50#ifdef STORAGE_GET_INFO
51void ata_get_info(IF_MD2(int drive,) struct storage_info *info); 51void ata_get_info(IF_MD(int drive,) struct storage_info *info);
52#endif 52#endif
53#ifdef HAVE_HOTSWAP 53#ifdef HAVE_HOTSWAP
54bool ata_removable(IF_MD_NONVOID(int drive)); 54bool ata_removable(IF_MD_NONVOID(int drive));
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 15511076e2..a0d52acc35 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -101,16 +101,16 @@ extern void fat_unlock(void);
101 101
102extern void fat_init(void); 102extern void fat_init(void);
103extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume)); 103extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume));
104extern int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector); 104extern int fat_mount(IF_MV(int volume,) IF_MD(int drive,) long startsector);
105extern int fat_unmount(int volume, bool flush); 105extern int fat_unmount(int volume, bool flush);
106extern void fat_size(IF_MV2(int volume,) /* public for info */ 106extern void fat_size(IF_MV(int volume,) /* public for info */
107 unsigned long* size, 107 unsigned long* size,
108 unsigned long* free); 108 unsigned long* free);
109extern void fat_recalc_free(IF_MV_NONVOID(int volume)); /* public for debug info screen */ 109extern void fat_recalc_free(IF_MV_NONVOID(int volume)); /* public for debug info screen */
110extern int fat_create_dir(const char* name, 110extern int fat_create_dir(const char* name,
111 struct fat_dir* newdir, 111 struct fat_dir* newdir,
112 struct fat_dir* dir); 112 struct fat_dir* dir);
113extern int fat_open(IF_MV2(int volume,) 113extern int fat_open(IF_MV(int volume,)
114 long cluster, 114 long cluster,
115 struct fat_file* ent, 115 struct fat_file* ent,
116 const struct fat_dir* dir); 116 const struct fat_dir* dir);
@@ -128,7 +128,7 @@ extern int fat_rename(struct fat_file* file,
128 const unsigned char* newname, 128 const unsigned char* newname,
129 long size, int attr); 129 long size, int attr);
130 130
131extern int fat_opendir(IF_MV2(int volume,) 131extern int fat_opendir(IF_MV(int volume,)
132 struct fat_dir *ent, unsigned long startcluster, 132 struct fat_dir *ent, unsigned long startcluster,
133 const struct fat_dir *parent_dir); 133 const struct fat_dir *parent_dir);
134extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry); 134extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry);
diff --git a/firmware/export/mmc.h b/firmware/export/mmc.h
index 8d20f81236..0d27e20a64 100644
--- a/firmware/export/mmc.h
+++ b/firmware/export/mmc.h
@@ -36,13 +36,13 @@ bool mmc_disk_is_active(void);
36int mmc_soft_reset(void); 36int mmc_soft_reset(void);
37int mmc_init(void) STORAGE_INIT_ATTR; 37int mmc_init(void) STORAGE_INIT_ATTR;
38void mmc_close(void); 38void mmc_close(void);
39int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 39int mmc_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
40int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 40int mmc_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
41void mmc_spin(void); 41void mmc_spin(void);
42int mmc_spinup_time(void); 42int mmc_spinup_time(void);
43 43
44#ifdef STORAGE_GET_INFO 44#ifdef STORAGE_GET_INFO
45void mmc_get_info(IF_MD2(int drive,) struct storage_info *info); 45void mmc_get_info(IF_MD(int drive,) struct storage_info *info);
46#endif 46#endif
47#ifdef HAVE_HOTSWAP 47#ifdef HAVE_HOTSWAP
48bool mmc_removable(IF_MD_NONVOID(int drive)); 48bool mmc_removable(IF_MD_NONVOID(int drive));
diff --git a/firmware/export/mv.h b/firmware/export/mv.h
index b1d16a7267..b1c8a83008 100644
--- a/firmware/export/mv.h
+++ b/firmware/export/mv.h
@@ -27,27 +27,28 @@
27/* FixMe: These macros are a bit nasty and perhaps misplaced here. 27/* FixMe: These macros are a bit nasty and perhaps misplaced here.
28 We'll get rid of them once decided on how to proceed with multivolume. */ 28 We'll get rid of them once decided on how to proceed with multivolume. */
29 29
30/* Drives are things like a disk, a card, a flash chip. They can have volumes on them */ 30/* Drives are things like a disk, a card, a flash chip. They can have volumes
31 on them */
31#ifdef HAVE_MULTIDRIVE 32#ifdef HAVE_MULTIDRIVE
32#define IF_MD(x) x /* optional drive parameter */ 33#define IF_MD(x...) x /* valist contents or empty */
33#define IF_MD2(x,y) x,y /* same, for a list of arguments */ 34#define IF_MD_NONVOID(x...) x /* valist contents or 'void' */
34#define IF_MD_NONVOID(x) x /* for prototype with sole volume parameter */ 35#define IF_MD_DRV(d) d /* drive argument or '0' */
35#else /* empty definitions if no multi-drive */ 36#else /* empty definitions if no multi-drive */
36#define IF_MD(x) 37#define IF_MD(x...)
37#define IF_MD2(x,y) 38#define IF_MD_NONVOID(x...) void
38#define IF_MD_NONVOID(x) void 39#define IF_MD_DRV(d) 0
39#endif 40#endif
40 41
41/* Volumes mean things that have filesystems on them, like partitions */ 42/* Volumes mean things that have filesystems on them, like partitions */
42#ifdef HAVE_MULTIVOLUME 43#ifdef HAVE_MULTIVOLUME
43#define IF_MV(x) x /* optional volume parameter */ 44#define IF_MV(x...) x /* valist contents or empty */
44#define IF_MV2(x,y) x,y /* same, for a list of arguments */ 45#define IF_MV_NONVOID(x...) x /* valist contents or 'void' */
45#define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */ 46#define IF_MV_VOL(v) v /* volume argument or '0' */
46#else /* empty definitions if no multi-volume */ 47#else /* empty definitions if no multi-volume */
47#define IF_MV(x) 48#define IF_MV(x...)
48#define IF_MV2(x,y) 49#define IF_MV_NONVOID(x...) void
49#define IF_MV_NONVOID(x) void 50#define IF_MV_VOL(v) 0
50#endif 51#endif
51 52
52 53
53#endif 54#endif /* __MV_H__ */
diff --git a/firmware/export/nand.h b/firmware/export/nand.h
index 58751ab298..fe25c9b407 100644
--- a/firmware/export/nand.h
+++ b/firmware/export/nand.h
@@ -36,8 +36,8 @@ bool nand_disk_is_active(void);
36int nand_soft_reset(void); 36int nand_soft_reset(void);
37int nand_init(void) STORAGE_INIT_ATTR; 37int nand_init(void) STORAGE_INIT_ATTR;
38void nand_close(void); 38void nand_close(void);
39int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 39int nand_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
40int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 40int nand_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
41#ifdef HAVE_STORAGE_FLUSH 41#ifdef HAVE_STORAGE_FLUSH
42int nand_flush(void); 42int nand_flush(void);
43#endif 43#endif
@@ -45,7 +45,7 @@ void nand_spin(void);
45int nand_spinup_time(void); /* ticks */ 45int nand_spinup_time(void); /* ticks */
46 46
47#ifdef STORAGE_GET_INFO 47#ifdef STORAGE_GET_INFO
48void nand_get_info(IF_MD2(int drive,) struct storage_info *info); 48void nand_get_info(IF_MD(int drive,) struct storage_info *info);
49#endif 49#endif
50 50
51long nand_last_disk_activity(void); 51long nand_last_disk_activity(void);
diff --git a/firmware/export/ramdisk.h b/firmware/export/ramdisk.h
index c478c78882..d79ac50836 100644
--- a/firmware/export/ramdisk.h
+++ b/firmware/export/ramdisk.h
@@ -35,14 +35,14 @@ bool ramdisk_disk_is_active(void);
35int ramdisk_soft_reset(void); 35int ramdisk_soft_reset(void);
36int ramdisk_init(void) STORAGE_INIT_ATTR; 36int ramdisk_init(void) STORAGE_INIT_ATTR;
37void ramdisk_close(void); 37void ramdisk_close(void);
38int ramdisk_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 38int ramdisk_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
39int ramdisk_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 39int ramdisk_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
40void ramdisk_spin(void); 40void ramdisk_spin(void);
41void ramdisk_sleepnow(void); 41void ramdisk_sleepnow(void);
42int ramdisk_spinup_time(void); 42int ramdisk_spinup_time(void);
43 43
44#ifdef STORAGE_GET_INFO 44#ifdef STORAGE_GET_INFO
45void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info); 45void ramdisk_get_info(IF_MD(int drive,) struct storage_info *info);
46#endif 46#endif
47 47
48long ramdisk_last_disk_activity(void); 48long ramdisk_last_disk_activity(void);
diff --git a/firmware/export/sd.h b/firmware/export/sd.h
index 1c3c429508..a5942dde1e 100644
--- a/firmware/export/sd.h
+++ b/firmware/export/sd.h
@@ -42,13 +42,13 @@ bool sd_disk_is_active(void);
42int sd_soft_reset(void); 42int sd_soft_reset(void);
43int sd_init(void) STORAGE_INIT_ATTR; 43int sd_init(void) STORAGE_INIT_ATTR;
44void sd_close(void); 44void sd_close(void);
45int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 45int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
46int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 46int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
47void sd_spin(void); 47void sd_spin(void);
48int sd_spinup_time(void); /* ticks */ 48int sd_spinup_time(void); /* ticks */
49 49
50#ifdef STORAGE_GET_INFO 50#ifdef STORAGE_GET_INFO
51void sd_get_info(IF_MD2(int drive,) struct storage_info *info); 51void sd_get_info(IF_MD(int drive,) struct storage_info *info);
52#endif 52#endif
53#ifdef HAVE_HOTSWAP 53#ifdef HAVE_HOTSWAP
54bool sd_removable(IF_MV_NONVOID(int drive)); 54bool sd_removable(IF_MV_NONVOID(int drive));
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index 6c875bc847..1793e385df 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -95,7 +95,7 @@ static inline void stub_storage_spindown(int timeout) { (void)timeout; }
95 #define storage_get_identify() ata_get_identify() 95 #define storage_get_identify() ata_get_identify()
96 96
97 #ifdef STORAGE_GET_INFO 97 #ifdef STORAGE_GET_INFO
98 #define storage_get_info(drive, info) ata_get_info(IF_MD2(drive,) info) 98 #define storage_get_info(drive, info) ata_get_info(IF_MD(drive,) info)
99 #endif 99 #endif
100 #ifdef HAVE_HOTSWAP 100 #ifdef HAVE_HOTSWAP
101 #define storage_removable(drive) ata_removable(IF_MD(drive)) 101 #define storage_removable(drive) ata_removable(IF_MD(drive))
@@ -121,7 +121,7 @@ static inline void stub_storage_spindown(int timeout) { (void)timeout; }
121 #define storage_get_identify() sd_get_identify() 121 #define storage_get_identify() sd_get_identify()
122 122
123 #ifdef STORAGE_GET_INFO 123 #ifdef STORAGE_GET_INFO
124 #define storage_get_info(drive, info) sd_get_info(IF_MD2(drive,) info) 124 #define storage_get_info(drive, info) sd_get_info(IF_MD(drive,) info)
125 #endif 125 #endif
126 #ifdef HAVE_HOTSWAP 126 #ifdef HAVE_HOTSWAP
127 #define storage_removable(drive) sd_removable(IF_MD(drive)) 127 #define storage_removable(drive) sd_removable(IF_MD(drive))
@@ -146,7 +146,7 @@ static inline void stub_storage_spindown(int timeout) { (void)timeout; }
146 #define storage_get_identify() mmc_get_identify() 146 #define storage_get_identify() mmc_get_identify()
147 147
148 #ifdef STORAGE_GET_INFO 148 #ifdef STORAGE_GET_INFO
149 #define storage_get_info(drive, info) mmc_get_info(IF_MD2(drive,) info) 149 #define storage_get_info(drive, info) mmc_get_info(IF_MD(drive,) info)
150 #endif 150 #endif
151 #ifdef HAVE_HOTSWAP 151 #ifdef HAVE_HOTSWAP
152 #define storage_removable(drive) mmc_removable(IF_MD(drive)) 152 #define storage_removable(drive) mmc_removable(IF_MD(drive))
@@ -171,7 +171,7 @@ static inline void stub_storage_spindown(int timeout) { (void)timeout; }
171 #define storage_get_identify() nand_get_identify() 171 #define storage_get_identify() nand_get_identify()
172 172
173 #ifdef STORAGE_GET_INFO 173 #ifdef STORAGE_GET_INFO
174 #define storage_get_info(drive, info) nand_get_info(IF_MD2(drive,) info) 174 #define storage_get_info(drive, info) nand_get_info(IF_MD(drive,) info)
175 #endif 175 #endif
176 #ifdef HAVE_HOTSWAP 176 #ifdef HAVE_HOTSWAP
177 #define storage_removable(drive) nand_removable(IF_MD(drive)) 177 #define storage_removable(drive) nand_removable(IF_MD(drive))
@@ -196,7 +196,7 @@ static inline void stub_storage_spindown(int timeout) { (void)timeout; }
196 #define storage_get_identify() ramdisk_get_identify() 196 #define storage_get_identify() ramdisk_get_identify()
197 197
198 #ifdef STORAGE_GET_INFO 198 #ifdef STORAGE_GET_INFO
199 #define storage_get_info(drive, info) ramdisk_get_info(IF_MD2(drive,) info) 199 #define storage_get_info(drive, info) ramdisk_get_info(IF_MD(drive,) info)
200 #endif 200 #endif
201 #ifdef HAVE_HOTSWAP 201 #ifdef HAVE_HOTSWAP
202 #define storage_removable(drive) ramdisk_removable(IF_MD(drive)) 202 #define storage_removable(drive) ramdisk_removable(IF_MD(drive))
@@ -231,6 +231,6 @@ bool storage_present(int drive);
231 231
232#endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/ 232#endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
233 233
234int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); 234int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf);
235int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); 235int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf);
236#endif 236#endif