diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-08-17 12:18:22 -0400 |
commit | a56f1ca1ed63b93eb61fd5319f47347b3eb1e364 (patch) | |
tree | 62a253ba44b23c1867cef59fee40b40092719ee1 /firmware/export | |
parent | c13f21a4d5c27c638c9f0dedf6d7b1f9bbb4d682 (diff) | |
download | rockbox-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.h | 6 | ||||
-rw-r--r-- | firmware/export/fat.h | 8 | ||||
-rw-r--r-- | firmware/export/mmc.h | 6 | ||||
-rw-r--r-- | firmware/export/mv.h | 29 | ||||
-rw-r--r-- | firmware/export/nand.h | 6 | ||||
-rw-r--r-- | firmware/export/ramdisk.h | 6 | ||||
-rw-r--r-- | firmware/export/sd.h | 6 | ||||
-rw-r--r-- | firmware/export/storage.h | 14 |
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); | |||
39 | int ata_soft_reset(void); | 39 | int ata_soft_reset(void); |
40 | int ata_init(void) STORAGE_INIT_ATTR; | 40 | int ata_init(void) STORAGE_INIT_ATTR; |
41 | void ata_close(void); | 41 | void ata_close(void); |
42 | int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 42 | int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
43 | int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 43 | int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); |
44 | void ata_spin(void); | 44 | void ata_spin(void); |
45 | #if (CONFIG_LED == LED_REAL) | 45 | #if (CONFIG_LED == LED_REAL) |
46 | void ata_set_led_enabled(bool enabled); | 46 | void ata_set_led_enabled(bool enabled); |
@@ -48,7 +48,7 @@ void ata_set_led_enabled(bool enabled); | |||
48 | unsigned short* ata_get_identify(void); | 48 | unsigned short* ata_get_identify(void); |
49 | 49 | ||
50 | #ifdef STORAGE_GET_INFO | 50 | #ifdef STORAGE_GET_INFO |
51 | void ata_get_info(IF_MD2(int drive,) struct storage_info *info); | 51 | void ata_get_info(IF_MD(int drive,) struct storage_info *info); |
52 | #endif | 52 | #endif |
53 | #ifdef HAVE_HOTSWAP | 53 | #ifdef HAVE_HOTSWAP |
54 | bool ata_removable(IF_MD_NONVOID(int drive)); | 54 | bool 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 | ||
102 | extern void fat_init(void); | 102 | extern void fat_init(void); |
103 | extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume)); | 103 | extern int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume)); |
104 | extern int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector); | 104 | extern int fat_mount(IF_MV(int volume,) IF_MD(int drive,) long startsector); |
105 | extern int fat_unmount(int volume, bool flush); | 105 | extern int fat_unmount(int volume, bool flush); |
106 | extern void fat_size(IF_MV2(int volume,) /* public for info */ | 106 | extern 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); |
109 | extern void fat_recalc_free(IF_MV_NONVOID(int volume)); /* public for debug info screen */ | 109 | extern void fat_recalc_free(IF_MV_NONVOID(int volume)); /* public for debug info screen */ |
110 | extern int fat_create_dir(const char* name, | 110 | extern 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); |
113 | extern int fat_open(IF_MV2(int volume,) | 113 | extern 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 | ||
131 | extern int fat_opendir(IF_MV2(int volume,) | 131 | extern 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); |
134 | extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry); | 134 | extern 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); | |||
36 | int mmc_soft_reset(void); | 36 | int mmc_soft_reset(void); |
37 | int mmc_init(void) STORAGE_INIT_ATTR; | 37 | int mmc_init(void) STORAGE_INIT_ATTR; |
38 | void mmc_close(void); | 38 | void mmc_close(void); |
39 | int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 39 | int mmc_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
40 | int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 40 | int mmc_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); |
41 | void mmc_spin(void); | 41 | void mmc_spin(void); |
42 | int mmc_spinup_time(void); | 42 | int mmc_spinup_time(void); |
43 | 43 | ||
44 | #ifdef STORAGE_GET_INFO | 44 | #ifdef STORAGE_GET_INFO |
45 | void mmc_get_info(IF_MD2(int drive,) struct storage_info *info); | 45 | void mmc_get_info(IF_MD(int drive,) struct storage_info *info); |
46 | #endif | 46 | #endif |
47 | #ifdef HAVE_HOTSWAP | 47 | #ifdef HAVE_HOTSWAP |
48 | bool mmc_removable(IF_MD_NONVOID(int drive)); | 48 | bool 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); | |||
36 | int nand_soft_reset(void); | 36 | int nand_soft_reset(void); |
37 | int nand_init(void) STORAGE_INIT_ATTR; | 37 | int nand_init(void) STORAGE_INIT_ATTR; |
38 | void nand_close(void); | 38 | void nand_close(void); |
39 | int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 39 | int nand_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
40 | int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 40 | int 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 |
42 | int nand_flush(void); | 42 | int nand_flush(void); |
43 | #endif | 43 | #endif |
@@ -45,7 +45,7 @@ void nand_spin(void); | |||
45 | int nand_spinup_time(void); /* ticks */ | 45 | int nand_spinup_time(void); /* ticks */ |
46 | 46 | ||
47 | #ifdef STORAGE_GET_INFO | 47 | #ifdef STORAGE_GET_INFO |
48 | void nand_get_info(IF_MD2(int drive,) struct storage_info *info); | 48 | void nand_get_info(IF_MD(int drive,) struct storage_info *info); |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | long nand_last_disk_activity(void); | 51 | long 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); | |||
35 | int ramdisk_soft_reset(void); | 35 | int ramdisk_soft_reset(void); |
36 | int ramdisk_init(void) STORAGE_INIT_ATTR; | 36 | int ramdisk_init(void) STORAGE_INIT_ATTR; |
37 | void ramdisk_close(void); | 37 | void ramdisk_close(void); |
38 | int ramdisk_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 38 | int ramdisk_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
39 | int ramdisk_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 39 | int ramdisk_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); |
40 | void ramdisk_spin(void); | 40 | void ramdisk_spin(void); |
41 | void ramdisk_sleepnow(void); | 41 | void ramdisk_sleepnow(void); |
42 | int ramdisk_spinup_time(void); | 42 | int ramdisk_spinup_time(void); |
43 | 43 | ||
44 | #ifdef STORAGE_GET_INFO | 44 | #ifdef STORAGE_GET_INFO |
45 | void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info); | 45 | void ramdisk_get_info(IF_MD(int drive,) struct storage_info *info); |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | long ramdisk_last_disk_activity(void); | 48 | long 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); | |||
42 | int sd_soft_reset(void); | 42 | int sd_soft_reset(void); |
43 | int sd_init(void) STORAGE_INIT_ATTR; | 43 | int sd_init(void) STORAGE_INIT_ATTR; |
44 | void sd_close(void); | 44 | void sd_close(void); |
45 | int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 45 | int sd_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
46 | int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 46 | int sd_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); |
47 | void sd_spin(void); | 47 | void sd_spin(void); |
48 | int sd_spinup_time(void); /* ticks */ | 48 | int sd_spinup_time(void); /* ticks */ |
49 | 49 | ||
50 | #ifdef STORAGE_GET_INFO | 50 | #ifdef STORAGE_GET_INFO |
51 | void sd_get_info(IF_MD2(int drive,) struct storage_info *info); | 51 | void sd_get_info(IF_MD(int drive,) struct storage_info *info); |
52 | #endif | 52 | #endif |
53 | #ifdef HAVE_HOTSWAP | 53 | #ifdef HAVE_HOTSWAP |
54 | bool sd_removable(IF_MV_NONVOID(int drive)); | 54 | bool 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 | ||
234 | int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); | 234 | int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); |
235 | int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); | 235 | int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); |
236 | #endif | 236 | #endif |