forked from len0rd/rockbox
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
This commit is contained in:
parent
b25f17200f
commit
751303c2ac
5 changed files with 12 additions and 10 deletions
|
@ -39,7 +39,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct filedesc {
|
struct filedesc {
|
||||||
unsigned char cache[SECTOR_SIZE];
|
unsigned char cache[SECTOR_SIZE] CACHEALIGN_ATTR;
|
||||||
int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */
|
int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */
|
||||||
long fileoffset;
|
long fileoffset;
|
||||||
long size;
|
long size;
|
||||||
|
@ -49,9 +49,9 @@ struct filedesc {
|
||||||
bool write;
|
bool write;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
bool trunc;
|
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);
|
static int flush_cache(int fd);
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ struct fat_cache_entry
|
||||||
#endif
|
#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 fat_cache_entry fat_cache[FAT_CACHE_SIZE];
|
||||||
static struct mutex cache_mutex SHAREDBSS_ATTR;
|
static struct mutex cache_mutex SHAREDBSS_ATTR;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "mv.h" /* for volume definitions */
|
#include "mv.h" /* for volume definitions */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
/* This value can be overwritten by a target in config-[target].h, but
|
/* This value can be overwritten by a target in config-[target].h, but
|
||||||
that behaviour is still experimental */
|
that behaviour is still experimental */
|
||||||
|
@ -81,17 +82,17 @@ struct fat_file
|
||||||
|
|
||||||
struct fat_dir
|
struct fat_dir
|
||||||
{
|
{
|
||||||
|
unsigned char sectorcache[SECTOR_SIZE] CACHEALIGN_ATTR;
|
||||||
unsigned int entry;
|
unsigned int entry;
|
||||||
unsigned int entrycount;
|
unsigned int entrycount;
|
||||||
long sector;
|
long sector;
|
||||||
struct fat_file file;
|
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
|
/* 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
|
* 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.
|
* 13 characters, that a total of 260 characters. So we keep a buffer of that size.
|
||||||
* Keep coherent with fat.c code. */
|
* Keep coherent with fat.c code. */
|
||||||
unsigned char longname[260 * 2];
|
unsigned char longname[260 * 2];
|
||||||
};
|
} CACHEALIGN_ATTR;
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
extern void fat_lock(void);
|
extern void fat_lock(void);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
#include "system.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -76,11 +77,11 @@ extern struct font sysfont;
|
||||||
/* structure filled in by font_load */
|
/* structure filled in by font_load */
|
||||||
static struct font font_ui;
|
static struct font font_ui;
|
||||||
/* static buffer allocation structures */
|
/* 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
|
#ifdef HAVE_REMOTE_LCD
|
||||||
#define REMOTE_FONT_SIZE 10000
|
#define REMOTE_FONT_SIZE 10000
|
||||||
static struct font remote_font_ui;
|
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
|
#endif
|
||||||
|
|
||||||
/* system font table, in order of FONT_xxx definition */
|
/* system font table, in order of FONT_xxx definition */
|
||||||
|
|
|
@ -57,9 +57,9 @@ struct dirent_uncached {
|
||||||
#ifndef DIR_DEFINED
|
#ifndef DIR_DEFINED
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
||||||
|
struct fat_dir fatdir CACHEALIGN_ATTR;
|
||||||
bool busy;
|
bool busy;
|
||||||
long startcluster;
|
long startcluster;
|
||||||
struct fat_dir fatdir;
|
|
||||||
struct dirent_uncached theent;
|
struct dirent_uncached theent;
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
int volumecounter; /* running counter for faked volume entries */
|
int volumecounter; /* running counter for faked volume entries */
|
||||||
|
@ -69,7 +69,7 @@ typedef struct {
|
||||||
void *dir; /* actually a DIR* dir */
|
void *dir; /* actually a DIR* dir */
|
||||||
char *name;
|
char *name;
|
||||||
#endif
|
#endif
|
||||||
} DIR_UNCACHED;
|
} DIR_UNCACHED CACHEALIGN_ATTR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue