summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-04-03 22:02:09 +0000
commit376d8d577fe94a8dc8742deff5a7524aa1595e1c (patch)
tree4d76e5232d8b513a40f11588d0f6899d47336b49 /firmware/export
parentba7501513a87433043a217a813c9147d004314a5 (diff)
downloadrockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.tar.gz
rockbox-376d8d577fe94a8dc8742deff5a7524aa1595e1c.zip
Add IO priority handling. Currently all IO has equal priority, except the dircache scanning thread which is lower. This fixes the slow boot problem for me, with the added benefit that actual audio playback also starts faster.
Lots of the changes are due to changing storage_(read|write)sectors() from macros to wrapper functions. This means that they have to be called with IF_MD2(drive,) again. Flyspray: FS#11167 Author: Frank Gevaerts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25459 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/storage.h20
-rw-r--r--firmware/export/thread.h10
3 files changed, 22 insertions, 12 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 9d8dc41111..858d9bf250 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -921,4 +921,8 @@ Lyre prototype 1 */
921#define HAVE_PLUGIN_CHECK_OPEN_CLOSE 921#define HAVE_PLUGIN_CHECK_OPEN_CLOSE
922#endif 922#endif
923 923
924#ifdef HAVE_DIRCACHE
925#define HAVE_IO_PRIORITY
926#endif
927
924#endif /* __CONFIG_H__ */ 928#endif /* __CONFIG_H__ */
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index 0096e87a8d..e62cf0d902 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -57,6 +57,7 @@ struct storage_info
57 */ 57 */
58 #define storage_num_drives() NUM_DRIVES 58 #define storage_num_drives() NUM_DRIVES
59 #if (CONFIG_STORAGE & STORAGE_ATA) 59 #if (CONFIG_STORAGE & STORAGE_ATA)
60 #define STORAGE_FUNCTION(NAME) (ata_## NAME)
60 #define storage_spindown ata_spindown 61 #define storage_spindown ata_spindown
61 #define storage_sleep ata_sleep 62 #define storage_sleep ata_sleep
62 #define storage_spin ata_spin 63 #define storage_spin ata_spin
@@ -67,8 +68,6 @@ struct storage_info
67 #define storage_soft_reset() ata_soft_reset() 68 #define storage_soft_reset() ata_soft_reset()
68 #define storage_init() ata_init() 69 #define storage_init() ata_init()
69 #define storage_close() ata_close() 70 #define storage_close() ata_close()
70 #define storage_read_sectors(drive, start, count, buf) ata_read_sectors(IF_MD2(drive,) start, count, buf)
71 #define storage_write_sectors(drive, start, count, buf) ata_write_sectors(IF_MD2(drive,) start, count, buf)
72 #ifdef HAVE_STORAGE_FLUSH 71 #ifdef HAVE_STORAGE_FLUSH
73 #define storage_flush() (void)0 72 #define storage_flush() (void)0
74 #endif 73 #endif
@@ -84,6 +83,7 @@ struct storage_info
84 #define storage_present(drive) ata_present(IF_MD(drive)) 83 #define storage_present(drive) ata_present(IF_MD(drive))
85 #endif 84 #endif
86 #elif (CONFIG_STORAGE & STORAGE_SD) 85 #elif (CONFIG_STORAGE & STORAGE_SD)
86 #define STORAGE_FUNCTION(NAME) (sd_## NAME)
87 #define storage_spindown sd_spindown 87 #define storage_spindown sd_spindown
88 #define storage_sleep sd_sleep 88 #define storage_sleep sd_sleep
89 #define storage_spin sd_spin 89 #define storage_spin sd_spin
@@ -93,8 +93,6 @@ struct storage_info
93 #define storage_disk_is_active() 0 93 #define storage_disk_is_active() 0
94 #define storage_soft_reset() (void)0 94 #define storage_soft_reset() (void)0
95 #define storage_init() sd_init() 95 #define storage_init() sd_init()
96 #define storage_read_sectors(drive, start, count, buf) sd_read_sectors(IF_MD2(drive,) start, count, buf)
97 #define storage_write_sectors(drive, start, count, buf) sd_write_sectors(IF_MD2(drive,) start, count, buf)
98 #ifdef HAVE_STORAGE_FLUSH 96 #ifdef HAVE_STORAGE_FLUSH
99 #define storage_flush() (void)0 97 #define storage_flush() (void)0
100 #endif 98 #endif
@@ -110,6 +108,7 @@ struct storage_info
110 #define storage_present(drive) sd_present(IF_MD(drive)) 108 #define storage_present(drive) sd_present(IF_MD(drive))
111 #endif 109 #endif
112 #elif (CONFIG_STORAGE & STORAGE_MMC) 110 #elif (CONFIG_STORAGE & STORAGE_MMC)
111 #define STORAGE_FUNCTION(NAME) (mmc_## NAME)
113 #define storage_spindown mmc_spindown 112 #define storage_spindown mmc_spindown
114 #define storage_sleep mmc_sleep 113 #define storage_sleep mmc_sleep
115 #define storage_spin mmc_spin 114 #define storage_spin mmc_spin
@@ -119,8 +118,6 @@ struct storage_info
119 #define storage_disk_is_active() mmc_disk_is_active() 118 #define storage_disk_is_active() mmc_disk_is_active()
120 #define storage_soft_reset() (void)0 119 #define storage_soft_reset() (void)0
121 #define storage_init() mmc_init() 120 #define storage_init() mmc_init()
122 #define storage_read_sectors(drive, start, count, buf) mmc_read_sectors(IF_MD2(drive,) start, count, buf)
123 #define storage_write_sectors(drive, start, count, buf) mmc_write_sectors(IF_MD2(drive,) start, count, buf)
124 #ifdef HAVE_STORAGE_FLUSH 121 #ifdef HAVE_STORAGE_FLUSH
125 #define storage_flush() (void)0 122 #define storage_flush() (void)0
126 #endif 123 #endif
@@ -136,6 +133,7 @@ struct storage_info
136 #define storage_present(drive) mmc_present(IF_MD(drive)) 133 #define storage_present(drive) mmc_present(IF_MD(drive))
137 #endif 134 #endif
138 #elif (CONFIG_STORAGE & STORAGE_NAND) 135 #elif (CONFIG_STORAGE & STORAGE_NAND)
136 #define STORAGE_FUNCTION(NAME) (nand_## NAME)
139 #define storage_spindown nand_spindown 137 #define storage_spindown nand_spindown
140 #define storage_sleep nand_sleep 138 #define storage_sleep nand_sleep
141 #define storage_spin nand_spin 139 #define storage_spin nand_spin
@@ -145,8 +143,6 @@ struct storage_info
145 #define storage_disk_is_active() 0 143 #define storage_disk_is_active() 0
146 #define storage_soft_reset() (void)0 144 #define storage_soft_reset() (void)0
147 #define storage_init() nand_init() 145 #define storage_init() nand_init()
148 #define storage_read_sectors(drive, start, count, buf) nand_read_sectors(IF_MD2(drive,) start, count, buf)
149 #define storage_write_sectors(drive, start, count, buf) nand_write_sectors(IF_MD2(drive,) start, count, buf)
150 #ifdef HAVE_STORAGE_FLUSH 146 #ifdef HAVE_STORAGE_FLUSH
151 #define storage_flush() nand_flush() 147 #define storage_flush() nand_flush()
152 #endif 148 #endif
@@ -162,6 +158,7 @@ struct storage_info
162 #define storage_present(drive) nand_present(IF_MD(drive)) 158 #define storage_present(drive) nand_present(IF_MD(drive))
163 #endif 159 #endif
164 #elif (CONFIG_STORAGE & STORAGE_RAMDISK) 160 #elif (CONFIG_STORAGE & STORAGE_RAMDISK)
161 #define STORAGE_FUNCTION(NAME) (ramdisk_## NAME)
165 #define storage_spindown ramdisk_spindown 162 #define storage_spindown ramdisk_spindown
166 #define storage_sleep ramdisk_sleep 163 #define storage_sleep ramdisk_sleep
167 #define storage_spin ramdisk_spin 164 #define storage_spin ramdisk_spin
@@ -171,8 +168,6 @@ struct storage_info
171 #define storage_disk_is_active() 0 168 #define storage_disk_is_active() 0
172 #define storage_soft_reset() (void)0 169 #define storage_soft_reset() (void)0
173 #define storage_init() ramdisk_init() 170 #define storage_init() ramdisk_init()
174 #define storage_read_sectors(drive, start, count, buf) ramdisk_read_sectors(IF_MD2(drive,) start, count, buf)
175 #define storage_write_sectors(drive, start, count, buf) ramdisk_write_sectors(IF_MD2(drive,) start, count, buf)
176 #ifdef HAVE_STORAGE_FLUSH 171 #ifdef HAVE_STORAGE_FLUSH
177 #define storage_flush() (void)0 172 #define storage_flush() (void)0
178 #endif 173 #endif
@@ -200,8 +195,6 @@ void storage_sleepnow(void);
200bool storage_disk_is_active(void); 195bool storage_disk_is_active(void);
201int storage_soft_reset(void); 196int storage_soft_reset(void);
202int storage_init(void); 197int storage_init(void);
203int storage_read_sectors(int drive, unsigned long start, int count, void* buf);
204int storage_write_sectors(int drive, unsigned long start, int count, const void* buf);
205int storage_flush(void); 198int storage_flush(void);
206void storage_spin(void); 199void storage_spin(void);
207void storage_spindown(int seconds); 200void storage_spindown(int seconds);
@@ -217,4 +210,7 @@ bool storage_present(int drive);
217#endif 210#endif
218 211
219#endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/ 212#endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/
213
214int storage_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf);
215int storage_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf);
220#endif 216#endif
diff --git a/firmware/export/thread.h b/firmware/export/thread.h
index 2a2a7a8619..a75981dcba 100644
--- a/firmware/export/thread.h
+++ b/firmware/export/thread.h
@@ -58,6 +58,9 @@
58#define NUM_PRIORITIES 32 58#define NUM_PRIORITIES 32
59#define PRIORITY_IDLE 32 /* Priority representative of no tasks */ 59#define PRIORITY_IDLE 32 /* Priority representative of no tasks */
60 60
61#define IO_PRIORITY_IMMEDIATE 0
62#define IO_PRIORITY_BACKGROUND 32
63
61#if CONFIG_CODEC == SWCODEC 64#if CONFIG_CODEC == SWCODEC
62 65
63#ifdef HAVE_RECORDING 66#ifdef HAVE_RECORDING
@@ -294,6 +297,9 @@ struct thread_entry
294 struct corelock waiter_cl; /* Corelock for thread_wait */ 297 struct corelock waiter_cl; /* Corelock for thread_wait */
295 struct corelock slot_cl; /* Corelock to lock thread slot */ 298 struct corelock slot_cl; /* Corelock to lock thread slot */
296#endif 299#endif
300#ifdef HAVE_IO_PRIORITY
301 unsigned char io_priority;
302#endif
297}; 303};
298 304
299/*** Macros for internal use ***/ 305/*** Macros for internal use ***/
@@ -539,6 +545,10 @@ unsigned int wakeup_thread(struct thread_entry **list);
539int thread_set_priority(unsigned int thread_id, int priority); 545int thread_set_priority(unsigned int thread_id, int priority);
540int thread_get_priority(unsigned int thread_id); 546int thread_get_priority(unsigned int thread_id);
541#endif /* HAVE_PRIORITY_SCHEDULING */ 547#endif /* HAVE_PRIORITY_SCHEDULING */
548#ifdef HAVE_IO_PRIORITY
549void thread_set_io_priority(unsigned int thread_id, int io_priority);
550int thread_get_io_priority(unsigned int thread_id);
551#endif /* HAVE_IO_PRIORITY */
542#if NUM_CORES > 1 552#if NUM_CORES > 1
543unsigned int switch_core(unsigned int new_core); 553unsigned int switch_core(unsigned int new_core);
544#endif 554#endif