summaryrefslogtreecommitdiff
path: root/apps/plugin.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-09 16:17:21 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-09 16:17:21 +0000
commit0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch)
tree70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/plugin.h
parentcec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff)
downloadrockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.bz2
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.xz
Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugin.h')
-rw-r--r--apps/plugin.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
index bafd407..a69b85b 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -53,6 +53,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#include "thread.h"
#include "button.h"
#include "action.h"
+#include "load_code.h"
#include "usb.h"
#include "font.h"
#include "lcd.h"
@@ -895,15 +896,17 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
struct dirinfo (*dir_get_info)(DIR* parent, struct dirent *entry);
+
+ /* load code api for overlay */
+ void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size);
+ void* (*lc_open_from_mem)(void* addr, size_t blob_size);
+ void* (*lc_get_header)(void *handle);
+ void (*lc_close)(void *handle);
};
/* plugin header */
struct plugin_header {
- unsigned long magic;
- unsigned short target_id;
- unsigned short api_version;
- unsigned char *load_addr;
- unsigned char *end_addr;
+ struct lc_header lc_hdr; /* must be the first */
enum plugin_status(*entry_point)(const void*);
const struct plugin_api **api;
};
@@ -916,15 +919,15 @@ extern unsigned char plugin_end_addr[];
const struct plugin_api *rb DATA_ATTR; \
const struct plugin_header __header \
__attribute__ ((section (".header")))= { \
- PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- plugin_start_addr, plugin_end_addr, plugin__start, &rb };
+ { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
+ plugin_start_addr, plugin_end_addr }, plugin__start, &rb };
#else /* PLATFORM_HOSTED */
#define PLUGIN_HEADER \
const struct plugin_api *rb DATA_ATTR; \
const struct plugin_header __header \
__attribute__((visibility("default"))) = { \
- PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- NULL, NULL, plugin__start, &rb };
+ { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL },
+ plugin__start, &rb };
#endif /* CONFIG_PLATFORM */
#endif /* PLUGIN */