From 376d8d577fe94a8dc8742deff5a7524aa1595e1c Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Sat, 3 Apr 2010 22:02:09 +0000 Subject: 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 --- firmware/common/dircache.c | 8 +++++++- firmware/common/disk.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'firmware/common') diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 9f19ac3d24..8b9be78b35 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -40,6 +40,7 @@ #include "file.h" #include "buffer.h" #include "dir.h" +#include "storage.h" #if CONFIG_RTC #include "time.h" #include "timefuncs.h" @@ -760,6 +761,7 @@ void* dircache_steal_buffer(long *size) void dircache_init(void) { int i; + int thread_id; dircache_initialized = false; dircache_initializing = false; @@ -771,10 +773,14 @@ void dircache_init(void) } queue_init(&dircache_queue, true); - create_thread(dircache_thread, dircache_stack, + thread_id = create_thread(dircache_thread, dircache_stack, sizeof(dircache_stack), 0, dircache_thread_name IF_PRIO(, PRIORITY_BACKGROUND) IF_COP(, CPU)); +#ifdef HAVE_IO_PRIORITY + thread_set_io_priority(thread_id,IO_PRIORITY_BACKGROUND); +#endif + } /** diff --git a/firmware/common/disk.c b/firmware/common/disk.c index c4553099ec..f8efe1c88b 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -82,7 +82,7 @@ struct partinfo* disk_init(IF_MD_NONVOID(int drive)) (void)drive; #endif - storage_read_sectors(drive, 0,1, §or); + storage_read_sectors(IF_MD2(drive,) 0,1, §or); /* check that the boot sector is initialized */ if ( (sector[510] != 0x55) || (sector[511] != 0xaa)) { -- cgit v1.2.3