diff options
author | Michael Sparmann <theseven@rockbox.org> | 2011-02-27 22:44:30 +0000 |
---|---|---|
committer | Michael Sparmann <theseven@rockbox.org> | 2011-02-27 22:44:30 +0000 |
commit | 751303c2acf22f7fa431690efcddcc8cb0d3a84e (patch) | |
tree | 1b1943ffdbefb3a2fe96e95a2af5c6c6c12968c5 | |
parent | b25f17200f4dd5e7fc8046ffc8fd6e64a61183bd (diff) | |
download | rockbox-751303c2acf22f7fa431690efcddcc8cb0d3a84e.tar.gz rockbox-751303c2acf22f7fa431690efcddcc8cb0d3a84e.zip |
iPod Classic CE-ATA Support (Part 1 of 4: Cacheline align some statically allocated sector buffers)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29444 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/common/file.c | 6 | ||||
-rw-r--r-- | firmware/drivers/fat.c | 2 | ||||
-rw-r--r-- | firmware/export/fat.h | 5 | ||||
-rw-r--r-- | firmware/font.c | 5 | ||||
-rw-r--r-- | firmware/include/dir_uncached.h | 4 |
5 files changed, 12 insertions, 10 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 3477c10061..bc4a90a485 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | struct filedesc { | 41 | struct filedesc { |
42 | unsigned char cache[SECTOR_SIZE]; | 42 | unsigned char cache[SECTOR_SIZE] CACHEALIGN_ATTR; |
43 | int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */ | 43 | int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */ |
44 | long fileoffset; | 44 | long fileoffset; |
45 | long size; | 45 | long size; |
@@ -49,9 +49,9 @@ struct filedesc { | |||
49 | bool write; | 49 | bool write; |
50 | bool dirty; | 50 | bool dirty; |
51 | bool trunc; | 51 | bool trunc; |
52 | }; | 52 | } CACHEALIGN_ATTR; |
53 | 53 | ||
54 | static struct filedesc openfiles[MAX_OPEN_FILES]; | 54 | static struct filedesc openfiles[MAX_OPEN_FILES] CACHEALIGN_ATTR; |
55 | 55 | ||
56 | static int flush_cache(int fd); | 56 | static int flush_cache(int fd); |
57 | 57 | ||
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index f055f4b170..63f4151792 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -211,7 +211,7 @@ struct fat_cache_entry | |||
211 | #endif | 211 | #endif |
212 | }; | 212 | }; |
213 | 213 | ||
214 | static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE]; | 214 | static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE] CACHEALIGN_ATTR; |
215 | static struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; | 215 | static struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; |
216 | static struct mutex cache_mutex SHAREDBSS_ATTR; | 216 | static struct mutex cache_mutex SHAREDBSS_ATTR; |
217 | 217 | ||
diff --git a/firmware/export/fat.h b/firmware/export/fat.h index 36beda711d..38ce6ee74d 100644 --- a/firmware/export/fat.h +++ b/firmware/export/fat.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | #include "mv.h" /* for volume definitions */ | 26 | #include "mv.h" /* for volume definitions */ |
27 | #include "config.h" | 27 | #include "config.h" |
28 | #include "system.h" | ||
28 | 29 | ||
29 | /* This value can be overwritten by a target in config-[target].h, but | 30 | /* This value can be overwritten by a target in config-[target].h, but |
30 | that behaviour is still experimental */ | 31 | that behaviour is still experimental */ |
@@ -81,17 +82,17 @@ struct fat_file | |||
81 | 82 | ||
82 | struct fat_dir | 83 | struct fat_dir |
83 | { | 84 | { |
85 | unsigned char sectorcache[SECTOR_SIZE] CACHEALIGN_ATTR; | ||
84 | unsigned int entry; | 86 | unsigned int entry; |
85 | unsigned int entrycount; | 87 | unsigned int entrycount; |
86 | long sector; | 88 | long sector; |
87 | struct fat_file file; | 89 | struct fat_file file; |
88 | unsigned char sectorcache[SECTOR_SIZE]; | ||
89 | /* There are 2-bytes per characters. We don't want to bother too much, as LFN entries are | 90 | /* There are 2-bytes per characters. We don't want to bother too much, as LFN entries are |
90 | * at much 255 characters longs, that's at most 20 LFN entries. Each entry hold at most | 91 | * at much 255 characters longs, that's at most 20 LFN entries. Each entry hold at most |
91 | * 13 characters, that a total of 260 characters. So we keep a buffer of that size. | 92 | * 13 characters, that a total of 260 characters. So we keep a buffer of that size. |
92 | * Keep coherent with fat.c code. */ | 93 | * Keep coherent with fat.c code. */ |
93 | unsigned char longname[260 * 2]; | 94 | unsigned char longname[260 * 2]; |
94 | }; | 95 | } CACHEALIGN_ATTR; |
95 | 96 | ||
96 | #ifdef HAVE_HOTSWAP | 97 | #ifdef HAVE_HOTSWAP |
97 | extern void fat_lock(void); | 98 | extern void fat_lock(void); |
diff --git a/firmware/font.c b/firmware/font.c index 8538ef9490..45ddef3afe 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include "inttypes.h" | 32 | #include "inttypes.h" |
33 | #include "lcd.h" | 33 | #include "lcd.h" |
34 | #include "system.h" | ||
34 | #include "font.h" | 35 | #include "font.h" |
35 | #include "file.h" | 36 | #include "file.h" |
36 | #include "debug.h" | 37 | #include "debug.h" |
@@ -76,11 +77,11 @@ extern struct font sysfont; | |||
76 | /* structure filled in by font_load */ | 77 | /* structure filled in by font_load */ |
77 | static struct font font_ui; | 78 | static struct font font_ui; |
78 | /* static buffer allocation structures */ | 79 | /* static buffer allocation structures */ |
79 | static unsigned char main_buf[MAX_FONT_SIZE]; | 80 | static unsigned char main_buf[MAX_FONT_SIZE] CACHEALIGN_ATTR; |
80 | #ifdef HAVE_REMOTE_LCD | 81 | #ifdef HAVE_REMOTE_LCD |
81 | #define REMOTE_FONT_SIZE 10000 | 82 | #define REMOTE_FONT_SIZE 10000 |
82 | static struct font remote_font_ui; | 83 | static struct font remote_font_ui; |
83 | static unsigned char remote_buf[REMOTE_FONT_SIZE]; | 84 | static unsigned char remote_buf[REMOTE_FONT_SIZE] CACHEALIGN_ATTR; |
84 | #endif | 85 | #endif |
85 | 86 | ||
86 | /* system font table, in order of FONT_xxx definition */ | 87 | /* system font table, in order of FONT_xxx definition */ |
diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h index c2c7d67505..19bed9af5d 100644 --- a/firmware/include/dir_uncached.h +++ b/firmware/include/dir_uncached.h | |||
@@ -57,9 +57,9 @@ struct dirent_uncached { | |||
57 | #ifndef DIR_DEFINED | 57 | #ifndef DIR_DEFINED |
58 | typedef struct { | 58 | typedef struct { |
59 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 59 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
60 | struct fat_dir fatdir CACHEALIGN_ATTR; | ||
60 | bool busy; | 61 | bool busy; |
61 | long startcluster; | 62 | long startcluster; |
62 | struct fat_dir fatdir; | ||
63 | struct dirent_uncached theent; | 63 | struct dirent_uncached theent; |
64 | #ifdef HAVE_MULTIVOLUME | 64 | #ifdef HAVE_MULTIVOLUME |
65 | int volumecounter; /* running counter for faked volume entries */ | 65 | int volumecounter; /* running counter for faked volume entries */ |
@@ -69,7 +69,7 @@ typedef struct { | |||
69 | void *dir; /* actually a DIR* dir */ | 69 | void *dir; /* actually a DIR* dir */ |
70 | char *name; | 70 | char *name; |
71 | #endif | 71 | #endif |
72 | } DIR_UNCACHED; | 72 | } DIR_UNCACHED CACHEALIGN_ATTR; |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | 75 | ||