diff options
-rw-r--r-- | apps/Makefile | 2 | ||||
-rw-r--r-- | apps/plugin.c | 7 | ||||
-rw-r--r-- | apps/plugin.h | 10 | ||||
-rw-r--r-- | apps/plugins/Makefile | 10 | ||||
-rw-r--r-- | apps/plugins/plugin.lds | 6 |
5 files changed, 26 insertions, 9 deletions
diff --git a/apps/Makefile b/apps/Makefile index 9614050cda..55ef599d4f 100644 --- a/apps/Makefile +++ b/apps/Makefile | |||
@@ -74,7 +74,7 @@ endif | |||
74 | all : $(OBJDIR)/$(OUTNAME) rocks | 74 | all : $(OBJDIR)/$(OUTNAME) rocks |
75 | 75 | ||
76 | rocks: | 76 | rocks: |
77 | $(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" | 77 | $(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM} |
78 | 78 | ||
79 | $(OBJDIR)/librockbox.a: | 79 | $(OBJDIR)/librockbox.a: |
80 | make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) | 80 | make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) |
diff --git a/apps/plugin.c b/apps/plugin.c index 01604c0e24..ad3cbdca43 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #define PREFIX(_x_) _x_ | 49 | #define PREFIX(_x_) _x_ |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | static int plugin_test(int api_version, int model); | 52 | static int plugin_test(int api_version, int model, int memsize); |
53 | 53 | ||
54 | static struct plugin_api rockbox_api = { | 54 | static struct plugin_api rockbox_api = { |
55 | PLUGIN_API_VERSION, | 55 | PLUGIN_API_VERSION, |
@@ -230,7 +230,7 @@ int plugin_load(char* plugin, void* parameter) | |||
230 | return PLUGIN_OK; | 230 | return PLUGIN_OK; |
231 | } | 231 | } |
232 | 232 | ||
233 | int plugin_test(int api_version, int model) | 233 | int plugin_test(int api_version, int model, int memsize) |
234 | { | 234 | { |
235 | if (api_version != PLUGIN_API_VERSION) | 235 | if (api_version != PLUGIN_API_VERSION) |
236 | return PLUGIN_WRONG_API_VERSION; | 236 | return PLUGIN_WRONG_API_VERSION; |
@@ -238,5 +238,8 @@ int plugin_test(int api_version, int model) | |||
238 | if (model != MODEL) | 238 | if (model != MODEL) |
239 | return PLUGIN_WRONG_MODEL; | 239 | return PLUGIN_WRONG_MODEL; |
240 | 240 | ||
241 | if (memsize != MEM) | ||
242 | return PLUGIN_WRONG_MODEL; | ||
243 | |||
241 | return PLUGIN_OK; | 244 | return PLUGIN_OK; |
242 | } | 245 | } |
diff --git a/apps/plugin.h b/apps/plugin.h index 12953ebc4d..dab3320b2a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -25,6 +25,10 @@ | |||
25 | #define NO_REDEFINES_PLEASE | 25 | #define NO_REDEFINES_PLEASE |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifndef MEM | ||
29 | #define MEM 2 | ||
30 | #endif | ||
31 | |||
28 | #include <stdbool.h> | 32 | #include <stdbool.h> |
29 | #include <stdio.h> | 33 | #include <stdio.h> |
30 | #include <stdlib.h> | 34 | #include <stdlib.h> |
@@ -37,7 +41,7 @@ | |||
37 | #include "lcd.h" | 41 | #include "lcd.h" |
38 | 42 | ||
39 | /* increase this every time the api struct changes */ | 43 | /* increase this every time the api struct changes */ |
40 | #define PLUGIN_API_VERSION 3 | 44 | #define PLUGIN_API_VERSION 4 |
41 | 45 | ||
42 | /* plugin return codes */ | 46 | /* plugin return codes */ |
43 | enum plugin_status { | 47 | enum plugin_status { |
@@ -64,7 +68,7 @@ enum model { | |||
64 | /* compatibility test macro */ | 68 | /* compatibility test macro */ |
65 | #define TEST_PLUGIN_API(_api_) \ | 69 | #define TEST_PLUGIN_API(_api_) \ |
66 | do { \ | 70 | do { \ |
67 | int _rc_ = _api_->plugin_test(PLUGIN_API_VERSION, MODEL); \ | 71 | int _rc_ = _api_->plugin_test(PLUGIN_API_VERSION, MODEL, MEM); \ |
68 | if (_rc_<0) \ | 72 | if (_rc_<0) \ |
69 | return _rc_; \ | 73 | return _rc_; \ |
70 | } while(0) | 74 | } while(0) |
@@ -73,7 +77,7 @@ struct plugin_api { | |||
73 | /* these two fields must always be first, to ensure | 77 | /* these two fields must always be first, to ensure |
74 | TEST_PLUGIN_API will always work */ | 78 | TEST_PLUGIN_API will always work */ |
75 | int version; | 79 | int version; |
76 | int (*plugin_test)(int api_version, int model); | 80 | int (*plugin_test)(int api_version, int model, int memsize); |
77 | 81 | ||
78 | /* lcd */ | 82 | /* lcd */ |
79 | void (*lcd_clear_display)(void); | 83 | void (*lcd_clear_display)(void); |
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 4c02207016..dca7babcc6 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile | |||
@@ -13,9 +13,10 @@ OC = sh-elf-objcopy | |||
13 | FIRMWARE = ../../firmware | 13 | FIRMWARE = ../../firmware |
14 | 14 | ||
15 | INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I.. | 15 | INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I.. |
16 | CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) | 16 | CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM} |
17 | 17 | ||
18 | LINKFILE = plugin.lds | 18 | LDS := plugin.lds |
19 | LINKFILE := $(OBJDIR)/pluginlink.lds | ||
19 | 20 | ||
20 | SRC := $(wildcard *.c) | 21 | SRC := $(wildcard *.c) |
21 | ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock) | 22 | ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock) |
@@ -41,5 +42,10 @@ $(OBJDIR)/%.o: %.c ../plugin.h Makefile | |||
41 | all: $(ROCKS) | 42 | all: $(ROCKS) |
42 | @echo done | 43 | @echo done |
43 | 44 | ||
45 | # MEM should be passed on to this makefile with the chosen memory size given | ||
46 | # in number of MB | ||
47 | $(LINKFILE): $(LDS) | ||
48 | cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(DEFINES) -E -P - >$@ | ||
49 | |||
44 | clean: | 50 | clean: |
45 | -rm -f $(ROCKS) | 51 | -rm -f $(ROCKS) |
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index bc24901dad..c8354fae11 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds | |||
@@ -1,8 +1,12 @@ | |||
1 | OUTPUT_FORMAT(elf32-sh) | 1 | OUTPUT_FORMAT(elf32-sh) |
2 | 2 | ||
3 | #define PLUGIN_LENGTH 0x8000 | ||
4 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH | ||
5 | #define PLUGIN_ORIGIN (0x09000000 + (DRAMSIZE)) | ||
6 | |||
3 | MEMORY | 7 | MEMORY |
4 | { | 8 | { |
5 | PLUGIN_RAM : ORIGIN = 0x091f8000, LENGTH = 0x8000 | 9 | PLUGIN_RAM : ORIGIN = PLUGIN_ORIGIN, LENGTH = PLUGIN_LENGTH |
6 | } | 10 | } |
7 | 11 | ||
8 | SECTIONS | 12 | SECTIONS |