forked from len0rd/rockbox
Added plugin support for 8MB-modified units. This bumps the plugin API version number again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3831 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9cb5e0e9f9
commit
13d56150b6
5 changed files with 26 additions and 9 deletions
|
@ -74,7 +74,7 @@ endif
|
||||||
all : $(OBJDIR)/$(OUTNAME) rocks
|
all : $(OBJDIR)/$(OUTNAME) rocks
|
||||||
|
|
||||||
rocks:
|
rocks:
|
||||||
$(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)"
|
$(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
|
||||||
|
|
||||||
$(OBJDIR)/librockbox.a:
|
$(OBJDIR)/librockbox.a:
|
||||||
make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR)
|
make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#define PREFIX(_x_) _x_
|
#define PREFIX(_x_) _x_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int plugin_test(int api_version, int model);
|
static int plugin_test(int api_version, int model, int memsize);
|
||||||
|
|
||||||
static struct plugin_api rockbox_api = {
|
static struct plugin_api rockbox_api = {
|
||||||
PLUGIN_API_VERSION,
|
PLUGIN_API_VERSION,
|
||||||
|
@ -230,7 +230,7 @@ int plugin_load(char* plugin, void* parameter)
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int plugin_test(int api_version, int model)
|
int plugin_test(int api_version, int model, int memsize)
|
||||||
{
|
{
|
||||||
if (api_version != PLUGIN_API_VERSION)
|
if (api_version != PLUGIN_API_VERSION)
|
||||||
return PLUGIN_WRONG_API_VERSION;
|
return PLUGIN_WRONG_API_VERSION;
|
||||||
|
@ -238,5 +238,8 @@ int plugin_test(int api_version, int model)
|
||||||
if (model != MODEL)
|
if (model != MODEL)
|
||||||
return PLUGIN_WRONG_MODEL;
|
return PLUGIN_WRONG_MODEL;
|
||||||
|
|
||||||
|
if (memsize != MEM)
|
||||||
|
return PLUGIN_WRONG_MODEL;
|
||||||
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
#define NO_REDEFINES_PLEASE
|
#define NO_REDEFINES_PLEASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MEM
|
||||||
|
#define MEM 2
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -37,7 +41,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 3
|
#define PLUGIN_API_VERSION 4
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -64,7 +68,7 @@ enum model {
|
||||||
/* compatibility test macro */
|
/* compatibility test macro */
|
||||||
#define TEST_PLUGIN_API(_api_) \
|
#define TEST_PLUGIN_API(_api_) \
|
||||||
do { \
|
do { \
|
||||||
int _rc_ = _api_->plugin_test(PLUGIN_API_VERSION, MODEL); \
|
int _rc_ = _api_->plugin_test(PLUGIN_API_VERSION, MODEL, MEM); \
|
||||||
if (_rc_<0) \
|
if (_rc_<0) \
|
||||||
return _rc_; \
|
return _rc_; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -73,7 +77,7 @@ struct plugin_api {
|
||||||
/* these two fields must always be first, to ensure
|
/* these two fields must always be first, to ensure
|
||||||
TEST_PLUGIN_API will always work */
|
TEST_PLUGIN_API will always work */
|
||||||
int version;
|
int version;
|
||||||
int (*plugin_test)(int api_version, int model);
|
int (*plugin_test)(int api_version, int model, int memsize);
|
||||||
|
|
||||||
/* lcd */
|
/* lcd */
|
||||||
void (*lcd_clear_display)(void);
|
void (*lcd_clear_display)(void);
|
||||||
|
|
|
@ -13,9 +13,10 @@ OC = sh-elf-objcopy
|
||||||
FIRMWARE = ../../firmware
|
FIRMWARE = ../../firmware
|
||||||
|
|
||||||
INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I..
|
INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I..
|
||||||
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
|
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
|
||||||
|
|
||||||
LINKFILE = plugin.lds
|
LDS := plugin.lds
|
||||||
|
LINKFILE := $(OBJDIR)/pluginlink.lds
|
||||||
|
|
||||||
SRC := $(wildcard *.c)
|
SRC := $(wildcard *.c)
|
||||||
ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock)
|
ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock)
|
||||||
|
@ -41,5 +42,10 @@ $(OBJDIR)/%.o: %.c ../plugin.h Makefile
|
||||||
all: $(ROCKS)
|
all: $(ROCKS)
|
||||||
@echo done
|
@echo done
|
||||||
|
|
||||||
|
# MEM should be passed on to this makefile with the chosen memory size given
|
||||||
|
# in number of MB
|
||||||
|
$(LINKFILE): $(LDS)
|
||||||
|
cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(DEFINES) -E -P - >$@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f $(ROCKS)
|
-rm -f $(ROCKS)
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
OUTPUT_FORMAT(elf32-sh)
|
OUTPUT_FORMAT(elf32-sh)
|
||||||
|
|
||||||
|
#define PLUGIN_LENGTH 0x8000
|
||||||
|
#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH
|
||||||
|
#define PLUGIN_ORIGIN (0x09000000 + (DRAMSIZE))
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
PLUGIN_RAM : ORIGIN = 0x091f8000, LENGTH = 0x8000
|
PLUGIN_RAM : ORIGIN = PLUGIN_ORIGIN, LENGTH = PLUGIN_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue