From 0d4585b28ffcac1b62ed37cee2c34de0515df468 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 9 Sep 2010 16:17:21 +0000 Subject: 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 --- apps/plugin.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'apps/plugin.h') 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 */ -- cgit v1.1