From 57d71e4267ecf66c84173f8ff3606091187b93b1 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 8 Nov 2007 05:17:20 +0000 Subject: Add some CACHEALIGN_* macros and a helper function to assist in aligning data and buffers on PortalPlayer processors to cache line boundaries. They're noops when PROC_NEED_CACHEALIGN isn't defined. Go safe and increase the value to 32 since I'm not sure yet if 16 is sufficient - changing that is a one-liner. Add helper to plugin API which will be needed shortly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15523 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 4 ++++ apps/plugin.h | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/plugin.c b/apps/plugin.c index ff23a55537..a80e9dd86d 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -518,6 +518,10 @@ static const struct plugin_api rockbox_api = { #endif thread_wait, + +#ifdef PROC_NEEDS_CACHEALIGN + align_buffer, +#endif }; int plugin_load(const char* plugin, void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 300cad0781..f56590c29e 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -37,6 +37,7 @@ #include "config.h" #include "system.h" #include "dir.h" +#include "general.h" #include "kernel.h" #include "thread.h" #include "button.h" @@ -112,7 +113,7 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 88 +#define PLUGIN_API_VERSION 89 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -640,6 +641,10 @@ struct plugin_api { #endif void (*thread_wait)(struct thread_entry *thread); + +#ifdef PROC_NEEDS_CACHEALIGN + size_t (*align_buffer)(void **start, size_t size, size_t align); +#endif }; /* plugin header */ @@ -742,4 +747,12 @@ enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter) #endif /* CACHE_FUNCTION_WRAPPERS */ +#ifndef ALIGN_BUFFER_WRAPPER +#define ALIGN_BUFFER_WRAPPER(api) \ + size_t align_buffer(void **start, size_t size, size_t align) \ + { \ + return (api)->align_buffer(start, size, align); \ + } +#endif /* ALIGN_BUFFER_WRAPPER */ + #endif -- cgit v1.2.3