diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
commit | 0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch) | |
tree | 70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/plugin.h | |
parent | cec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff) | |
download | rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip |
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.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index bafd4070f6..a69b85bbfd 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -53,6 +53,7 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
53 | #include "thread.h" | 53 | #include "thread.h" |
54 | #include "button.h" | 54 | #include "button.h" |
55 | #include "action.h" | 55 | #include "action.h" |
56 | #include "load_code.h" | ||
56 | #include "usb.h" | 57 | #include "usb.h" |
57 | #include "font.h" | 58 | #include "font.h" |
58 | #include "lcd.h" | 59 | #include "lcd.h" |
@@ -895,15 +896,17 @@ struct plugin_api { | |||
895 | /* new stuff at the end, sort into place next time | 896 | /* new stuff at the end, sort into place next time |
896 | the API gets incompatible */ | 897 | the API gets incompatible */ |
897 | struct dirinfo (*dir_get_info)(DIR* parent, struct dirent *entry); | 898 | struct dirinfo (*dir_get_info)(DIR* parent, struct dirent *entry); |
899 | |||
900 | /* load code api for overlay */ | ||
901 | void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size); | ||
902 | void* (*lc_open_from_mem)(void* addr, size_t blob_size); | ||
903 | void* (*lc_get_header)(void *handle); | ||
904 | void (*lc_close)(void *handle); | ||
898 | }; | 905 | }; |
899 | 906 | ||
900 | /* plugin header */ | 907 | /* plugin header */ |
901 | struct plugin_header { | 908 | struct plugin_header { |
902 | unsigned long magic; | 909 | struct lc_header lc_hdr; /* must be the first */ |
903 | unsigned short target_id; | ||
904 | unsigned short api_version; | ||
905 | unsigned char *load_addr; | ||
906 | unsigned char *end_addr; | ||
907 | enum plugin_status(*entry_point)(const void*); | 910 | enum plugin_status(*entry_point)(const void*); |
908 | const struct plugin_api **api; | 911 | const struct plugin_api **api; |
909 | }; | 912 | }; |
@@ -916,15 +919,15 @@ extern unsigned char plugin_end_addr[]; | |||
916 | const struct plugin_api *rb DATA_ATTR; \ | 919 | const struct plugin_api *rb DATA_ATTR; \ |
917 | const struct plugin_header __header \ | 920 | const struct plugin_header __header \ |
918 | __attribute__ ((section (".header")))= { \ | 921 | __attribute__ ((section (".header")))= { \ |
919 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 922 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
920 | plugin_start_addr, plugin_end_addr, plugin__start, &rb }; | 923 | plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; |
921 | #else /* PLATFORM_HOSTED */ | 924 | #else /* PLATFORM_HOSTED */ |
922 | #define PLUGIN_HEADER \ | 925 | #define PLUGIN_HEADER \ |
923 | const struct plugin_api *rb DATA_ATTR; \ | 926 | const struct plugin_api *rb DATA_ATTR; \ |
924 | const struct plugin_header __header \ | 927 | const struct plugin_header __header \ |
925 | __attribute__((visibility("default"))) = { \ | 928 | __attribute__((visibility("default"))) = { \ |
926 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 929 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, |
927 | NULL, NULL, plugin__start, &rb }; | 930 | plugin__start, &rb }; |
928 | #endif /* CONFIG_PLATFORM */ | 931 | #endif /* CONFIG_PLATFORM */ |
929 | #endif /* PLUGIN */ | 932 | #endif /* PLUGIN */ |
930 | 933 | ||