From 751303c2acf22f7fa431690efcddcc8cb0d3a84e Mon Sep 17 00:00:00 2001 From: Michael Sparmann Date: Sun, 27 Feb 2011 22:44:30 +0000 Subject: 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 --- firmware/common/file.c | 6 +++--- firmware/drivers/fat.c | 2 +- firmware/export/fat.h | 5 +++-- firmware/font.c | 5 +++-- 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 @@ */ struct filedesc { - unsigned char cache[SECTOR_SIZE]; + unsigned char cache[SECTOR_SIZE] CACHEALIGN_ATTR; int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */ long fileoffset; long size; @@ -49,9 +49,9 @@ struct filedesc { bool write; bool dirty; bool trunc; -}; +} CACHEALIGN_ATTR; -static struct filedesc openfiles[MAX_OPEN_FILES]; +static struct filedesc openfiles[MAX_OPEN_FILES] CACHEALIGN_ATTR; static int flush_cache(int fd); 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 #endif }; -static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE]; +static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE] CACHEALIGN_ATTR; static struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; static struct mutex cache_mutex SHAREDBSS_ATTR; 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 @@ #include #include "mv.h" /* for volume definitions */ #include "config.h" +#include "system.h" /* This value can be overwritten by a target in config-[target].h, but that behaviour is still experimental */ @@ -81,17 +82,17 @@ struct fat_file struct fat_dir { + unsigned char sectorcache[SECTOR_SIZE] CACHEALIGN_ATTR; unsigned int entry; unsigned int entrycount; long sector; struct fat_file file; - unsigned char sectorcache[SECTOR_SIZE]; /* There are 2-bytes per characters. We don't want to bother too much, as LFN entries are * at much 255 characters longs, that's at most 20 LFN entries. Each entry hold at most * 13 characters, that a total of 260 characters. So we keep a buffer of that size. * Keep coherent with fat.c code. */ unsigned char longname[260 * 2]; -}; +} CACHEALIGN_ATTR; #ifdef HAVE_HOTSWAP 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 @@ #include #include "inttypes.h" #include "lcd.h" +#include "system.h" #include "font.h" #include "file.h" #include "debug.h" @@ -76,11 +77,11 @@ extern struct font sysfont; /* structure filled in by font_load */ static struct font font_ui; /* static buffer allocation structures */ -static unsigned char main_buf[MAX_FONT_SIZE]; +static unsigned char main_buf[MAX_FONT_SIZE] CACHEALIGN_ATTR; #ifdef HAVE_REMOTE_LCD #define REMOTE_FONT_SIZE 10000 static struct font remote_font_ui; -static unsigned char remote_buf[REMOTE_FONT_SIZE]; +static unsigned char remote_buf[REMOTE_FONT_SIZE] CACHEALIGN_ATTR; #endif /* 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 { #ifndef DIR_DEFINED typedef struct { #if (CONFIG_PLATFORM & PLATFORM_NATIVE) + struct fat_dir fatdir CACHEALIGN_ATTR; bool busy; long startcluster; - struct fat_dir fatdir; struct dirent_uncached theent; #ifdef HAVE_MULTIVOLUME int volumecounter; /* running counter for faked volume entries */ @@ -69,7 +69,7 @@ typedef struct { void *dir; /* actually a DIR* dir */ char *name; #endif -} DIR_UNCACHED; +} DIR_UNCACHED CACHEALIGN_ATTR; #endif -- cgit v1.2.3