1
0
Fork 0
forked from len0rd/rockbox

loader-initialized global plugin API:

struct plugin_api *rb is declared in PLUGIN_HEADER, and pointed to by
__header.api

the loader uses this pointer to initialize rb before calling entry_point

entry_point is no longer passed a pointer to the plugin API

all plugins, and pluginlib functions, are modified to refer to the
global rb

pluginlib functions which only served to copy the API pointer are
removed

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19776 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-01-16 10:34:40 +00:00
parent 35677cbc54
commit 23d9812273
179 changed files with 586 additions and 1183 deletions

View file

@ -27,19 +27,19 @@
/*
* Print a checkbox
*/
void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked)
void checkbox(int x, int y, int width, int height, bool checked)
{
/* draw box */
api->lcd_drawrect(x, y, width, height);
rb->lcd_drawrect(x, y, width, height);
/* clear inner area */
api->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
api->lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
api->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
rb->lcd_set_drawmode(DRMODE_SOLID);
if (checked){
api->lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
api->lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
rb->lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
rb->lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
}
}

View file

@ -26,6 +26,6 @@
/*
* Print a checkbox
*/
void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked);
void checkbox(int x, int y, int width, int height, bool checked);
#endif

View file

@ -21,27 +21,20 @@
#include "plugin.h"
#include "configfile.h"
static const struct plugin_api *cfg_rb;
void configfile_init(const struct plugin_api* newrb)
{
cfg_rb = newrb;
}
static void get_cfg_filename(char* buf, int buf_len, const char* filename)
{
char *s;
cfg_rb->strcpy(buf, cfg_rb->plugin_get_current_filename());
s = cfg_rb->strrchr(buf, '/');
rb->strcpy(buf, rb->plugin_get_current_filename());
s = rb->strrchr(buf, '/');
if (!s) /* should never happen */
{
cfg_rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename);
rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename);
}
else
{
s++;
*s = '\0';
cfg_rb->strcat(s, filename);
rb->strcat(s, filename);
}
}
@ -53,30 +46,30 @@ int configfile_save(const char *filename, struct configdata *cfg,
char buf[MAX_PATH];
get_cfg_filename(buf, MAX_PATH, filename);
fd = cfg_rb->creat(buf);
fd = rb->creat(buf);
if(fd < 0)
return fd*10 - 1;
/* pre-allocate 10 bytes for INT */
cfg_rb->fdprintf(fd, "file version: %10d\n", version);
rb->fdprintf(fd, "file version: %10d\n", version);
for(i = 0;i < num_items;i++) {
switch(cfg[i].type) {
case TYPE_INT:
/* pre-allocate 10 bytes for INT */
cfg_rb->fdprintf(fd, "%s: %10d\n",
rb->fdprintf(fd, "%s: %10d\n",
cfg[i].name,
*cfg[i].val);
break;
case TYPE_ENUM:
cfg_rb->fdprintf(fd, "%s: %s\n",
rb->fdprintf(fd, "%s: %s\n",
cfg[i].name,
cfg[i].values[*cfg[i].val]);
break;
case TYPE_STRING:
cfg_rb->fdprintf(fd, "%s: %s\n",
rb->fdprintf(fd, "%s: %s\n",
cfg[i].name,
cfg[i].string);
break;
@ -84,7 +77,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
}
}
cfg_rb->close(fd);
rb->close(fd);
return 0;
}
@ -100,27 +93,27 @@ int configfile_load(const char *filename, struct configdata *cfg,
int tmp;
get_cfg_filename(buf, MAX_PATH, filename);
fd = cfg_rb->open(buf, O_RDONLY);
fd = rb->open(buf, O_RDONLY);
if(fd < 0)
return fd*10 - 1;
while(cfg_rb->read_line(fd, buf, MAX_PATH) > 0) {
cfg_rb->settings_parseline(buf, &name, &val);
while(rb->read_line(fd, buf, MAX_PATH) > 0) {
rb->settings_parseline(buf, &name, &val);
/* Bail out if the file version is too old */
if(!cfg_rb->strcmp("file version", name)) {
file_version = cfg_rb->atoi(val);
if(!rb->strcmp("file version", name)) {
file_version = rb->atoi(val);
if(file_version < min_version) {
cfg_rb->close(fd);
rb->close(fd);
return -1;
}
}
for(i = 0;i < num_items;i++) {
if(!cfg_rb->strcmp(cfg[i].name, name)) {
if(!rb->strcmp(cfg[i].name, name)) {
switch(cfg[i].type) {
case TYPE_INT:
tmp = cfg_rb->atoi(val);
tmp = rb->atoi(val);
/* Only set it if it's within range */
if(tmp >= cfg[i].min && tmp <= cfg[i].max)
*cfg[i].val = tmp;
@ -128,21 +121,21 @@ int configfile_load(const char *filename, struct configdata *cfg,
case TYPE_ENUM:
for(j = 0;j < cfg[i].max;j++) {
if(!cfg_rb->strcmp(cfg[i].values[j], val)) {
if(!rb->strcmp(cfg[i].values[j], val)) {
*cfg[i].val = j;
}
}
break;
case TYPE_STRING:
cfg_rb->strncpy(cfg[i].string, val, cfg[i].max);
rb->strncpy(cfg[i].string, val, cfg[i].max);
break;
}
}
}
}
cfg_rb->close(fd);
rb->close(fd);
return 0;
}
@ -154,21 +147,21 @@ int configfile_get_value(const char* filename, const char* name)
char buf[MAX_PATH];
get_cfg_filename(buf, MAX_PATH, filename);
fd = cfg_rb->open(buf, O_RDONLY);
fd = rb->open(buf, O_RDONLY);
if(fd < 0)
return -1;
while(cfg_rb->read_line(fd, buf, MAX_PATH) > 0)
while(rb->read_line(fd, buf, MAX_PATH) > 0)
{
cfg_rb->settings_parseline(buf, &pname, &pval);
if(!cfg_rb->strcmp(name, pname))
rb->settings_parseline(buf, &pname, &pval);
if(!rb->strcmp(name, pname))
{
cfg_rb->close(fd);
return cfg_rb->atoi(pval);
rb->close(fd);
return rb->atoi(pval);
}
}
cfg_rb->close(fd);
rb->close(fd);
return -1;
}
@ -185,20 +178,20 @@ int configfile_update_entry(const char* filename, const char* name, int val)
/* open the current config file */
get_cfg_filename(path, MAX_PATH, filename);
fd = cfg_rb->open(path, O_RDWR);
fd = rb->open(path, O_RDWR);
if(fd < 0)
return -1;
/* read in the current stored settings */
while((line_len = cfg_rb->read_line(fd, buf, 256)) > 0)
while((line_len = rb->read_line(fd, buf, 256)) > 0)
{
cfg_rb->settings_parseline(buf, &pname, &pval);
if(!cfg_rb->strcmp(name, pname))
rb->settings_parseline(buf, &pname, &pval);
if(!rb->strcmp(name, pname))
{
found = 1;
cfg_rb->lseek(fd, pos, SEEK_SET);
rb->lseek(fd, pos, SEEK_SET);
/* pre-allocate 10 bytes for INT */
cfg_rb->fdprintf(fd, "%s: %10d\n", pname, val);
rb->fdprintf(fd, "%s: %10d\n", pname, val);
break;
}
pos += line_len;
@ -207,9 +200,9 @@ int configfile_update_entry(const char* filename, const char* name, int val)
/* if (name/val) is a new entry just append to file */
if (found == 0)
/* pre-allocate 10 bytes for INT */
cfg_rb->fdprintf(fd, "%s: %10d\n", name, val);
rb->fdprintf(fd, "%s: %10d\n", name, val);
cfg_rb->close(fd);
rb->close(fd);
return found;
}

View file

@ -39,8 +39,6 @@ struct configdata
NULL otherwise */
};
void configfile_init(const struct plugin_api* newrb);
/* configfile_save - Given configdata entries this function will
create a config file with these entries, destroying any
previous config file of the same name */

View file

@ -52,7 +52,7 @@
#define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */
/* Library initialisation and release */
bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
bool grey_init(unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken);
void grey_release(void);
@ -172,7 +172,6 @@ struct _grey_info
int bheight; /* 4-pixel or 8-pixel units */
#endif
unsigned long flags; /* various flags, see #defines */
const struct plugin_api *rb; /* plugin API pointer */
unsigned char *values; /* start of greyscale pixel values */
unsigned char *phases; /* start of greyscale pixel phases */
unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */

View file

@ -336,16 +336,16 @@ static inline void _deferred_update(void)
int y2 = MIN(_grey_info.y + _grey_info.height, LCD_HEIGHT);
if (y1 > 0) /* refresh part above overlay, full width */
_grey_info.rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
if (y2 < LCD_HEIGHT) /* refresh part below overlay, full width */
_grey_info.rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
if (x1 > 0) /* refresh part to the left of overlay */
_grey_info.rb->lcd_update_rect(0, y1, x1, y2 - y1);
rb->lcd_update_rect(0, y1, x1, y2 - y1);
if (x2 < LCD_WIDTH) /* refresh part to the right of overlay */
_grey_info.rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
}
#ifdef SIMULATOR
@ -373,7 +373,7 @@ static unsigned long _grey_get_pixel(int x, int y)
static void _timer_isr(void)
{
#if defined(HAVE_BACKLIGHT_INVERSION) && !defined(SIMULATOR)
unsigned long check = _grey_info.rb->is_backlight_on(true)
unsigned long check = rb->is_backlight_on(true)
? 0 : _GREY_BACKLIGHT_ON;
if ((_grey_info.flags & (_GREY_BACKLIGHT_ON|GREY_RAWMAPPED)) == check)
@ -384,12 +384,12 @@ static void _timer_isr(void)
}
#endif
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
_grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
_grey_info.bx, _grey_info.y,
_grey_info.bwidth, _grey_info.height,
_grey_info.width);
#else /* vertical packing or vertical interleaved */
_grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
_grey_info.x, _grey_info.by,
_grey_info.width, _grey_info.bheight,
_grey_info.width);
@ -501,7 +501,7 @@ static void fill_gvalues(void)
The function is authentic regarding memory usage on the simulator, even
if it doesn't use all of the allocated memory. */
bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
bool grey_init(unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken)
{
int bdim, i;
@ -511,8 +511,6 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
unsigned *dst, *end;
#endif
_grey_info.rb = newrb;
if ((unsigned) width > LCD_WIDTH
|| (unsigned) height > LCD_HEIGHT)
return false;
@ -559,7 +557,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
return false;
/* Init to white */
_grey_info.rb->memset(_grey_info.values, 0x80, plane_size);
rb->memset(_grey_info.values, 0x80, plane_size);
#ifndef SIMULATOR
/* Init phases with random bits */
@ -567,7 +565,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
end = (unsigned*)(_grey_info.phases + plane_size);
do
*dst++ = _grey_info.rb->rand();
*dst++ = rb->rand();
while (dst < end);
#endif
@ -601,7 +599,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
else
{
#if defined(HAVE_BACKLIGHT_INVERSION) && !defined(SIMULATOR)
if (_grey_info.rb->is_backlight_on(true))
if (rb->is_backlight_on(true))
_grey_info.flags |= _GREY_BACKLIGHT_ON;
#endif
fill_gvalues();
@ -636,40 +634,40 @@ void grey_show(bool enable)
{
_grey_info.flags |= _GREY_RUNNING;
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_init(129, _grey_get_pixel);
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_init(129, _grey_get_pixel);
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#else /* !SIMULATOR */
#ifdef NEED_BOOST
_grey_info.rb->cpu_boost(true);
rb->cpu_boost(true);
#endif
#if NUM_CORES > 1
_grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
1, _timer_isr,
(_grey_info.flags & GREY_ON_COP) ? COP : CPU);
#else
_grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
_timer_isr);
#endif
#endif /* !SIMULATOR */
_grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
rb->screen_dump_set_hook(grey_screendump_hook);
}
else if (!enable && (_grey_info.flags & _GREY_RUNNING))
{
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_init(0, NULL);
rb->sim_lcd_ex_init(0, NULL);
#else /* !SIMULATOR */
_grey_info.rb->timer_unregister();
rb->timer_unregister();
#if NUM_CORES > 1 /* Make sure the ISR has finished before calling lcd_update() */
_grey_info.rb->sleep(HZ/100);
rb->sleep(HZ/100);
#endif
#ifdef NEED_BOOST
_grey_info.rb->cpu_boost(false);
rb->cpu_boost(false);
#endif
#endif /* !SIMULATOR */
_grey_info.flags &= ~_GREY_RUNNING;
_grey_info.rb->screen_dump_set_hook(NULL);
_grey_info.rb->lcd_update(); /* restore whatever there was before */
rb->screen_dump_set_hook(NULL);
rb->lcd_update(); /* restore whatever there was before */
}
}
@ -699,7 +697,7 @@ void grey_deferred_lcd_update(void)
#endif
}
else
_grey_info.rb->lcd_update();
rb->lcd_update();
}
/*** Screenshot ***/
@ -786,10 +784,10 @@ static void grey_screendump_hook(int fd)
unsigned char *clut_entry;
unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)];
_grey_info.rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
/* build clut */
_grey_info.rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
clut_entry = linebuf;
for (i = 0; i <= 128; i++)
@ -808,17 +806,17 @@ static void grey_screendump_hook(int fd)
#endif
clut_entry++;
}
_grey_info.rb->write(fd, linebuf, 4*BMP_VARCOLORS);
rb->write(fd, linebuf, 4*BMP_VARCOLORS);
/* BMP image goes bottom -> top */
for (y = LCD_HEIGHT - 1; y >= 0; y--)
{
_grey_info.rb->memset(linebuf, 0, BMP_LINESIZE);
rb->memset(linebuf, 0, BMP_LINESIZE);
gy = y - _grey_info.y;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#if LCD_DEPTH == 2
lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
for (x = 0; x < LCD_WIDTH; x += 4)
{
@ -846,7 +844,7 @@ static void grey_screendump_hook(int fd)
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
#if LCD_DEPTH == 1
mask = 1 << (y & 7);
lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
for (x = 0; x < LCD_WIDTH; x++)
{
@ -869,7 +867,7 @@ static void grey_screendump_hook(int fd)
}
#elif LCD_DEPTH == 2
shift = 2 * (y & 3);
lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
for (x = 0; x < LCD_WIDTH; x++)
{
@ -894,7 +892,7 @@ static void grey_screendump_hook(int fd)
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
#if LCD_DEPTH == 2
shift = y & 7;
lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
for (x = 0; x < LCD_WIDTH; x++)
{
@ -919,6 +917,6 @@ static void grey_screendump_hook(int fd)
#endif /* LCD_DEPTH */
#endif /* LCD_PIXELFORMAT */
_grey_info.rb->write(fd, linebuf, BMP_LINESIZE);
rb->write(fd, linebuf, BMP_LINESIZE);
}
}

View file

@ -63,7 +63,7 @@ void grey_clear_display(void)
int value = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
_grey_info.rb->memset(_grey_info.buffer, value,
rb->memset(_grey_info.buffer, value,
_GREY_MULUQ(_grey_info.width, _grey_info.height));
}
@ -196,7 +196,7 @@ void grey_hline(int x1, int x2, int y)
dst = &_grey_info.buffer[_GREY_MULUQ(_grey_info.width, y) + x1];
if (fillopt)
_grey_info.rb->memset(dst, value, x2 - x1 + 1);
rb->memset(dst, value, x2 - x1 + 1);
else
{
unsigned char *dst_end = dst + x2 - x1;
@ -381,7 +381,7 @@ void grey_fillrect(int x, int y, int width, int height)
do
{
if (fillopt)
_grey_info.rb->memset(dst, value, width);
rb->memset(dst, value, width);
else
{
unsigned char *dst_row = dst;
@ -516,7 +516,7 @@ void grey_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
do
{
_grey_info.rb->memcpy(dst, src, width);
rb->memcpy(dst, src, width);
dst += _grey_info.width;
src += stride;
}
@ -535,9 +535,9 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
{
int ch;
unsigned short *ucs;
struct font* pf = _grey_info.rb->font_get(_grey_info.curfont);
struct font* pf = rb->font_get(_grey_info.curfont);
ucs = _grey_info.rb->bidi_l2v(str, 1);
ucs = rb->bidi_l2v(str, 1);
while ((ch = *ucs++) != 0 && x < _grey_info.width)
{
@ -545,7 +545,7 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
const unsigned char *bits;
/* get proportional width and glyph bits */
width = _grey_info.rb->font_get_width(pf, ch);
width = rb->font_get_width(pf, ch);
if (ofs > width)
{
@ -553,7 +553,7 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
continue;
}
bits = _grey_info.rb->font_get_bits(pf, ch);
bits = rb->font_get_bits(pf, ch);
grey_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
@ -577,10 +577,10 @@ void grey_ub_clear_display(void)
_grey_info.fg_brightness :
_grey_info.bg_brightness];
_grey_info.rb->memset(_grey_info.values, value,
rb->memset(_grey_info.values, value,
_GREY_MULUQ(_grey_info.width, _grey_info.height));
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@ -655,7 +655,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
}
while (++yc < ye);
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x + x, _grey_info.y + y,
rb->sim_lcd_ex_update_rect(_grey_info.x + x, _grey_info.y + y,
width, height);
#endif
}

View file

@ -51,7 +51,7 @@ void grey_set_position(int x, int y)
if (_grey_info.flags & _GREY_RUNNING)
{
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width,
_grey_info.height);
grey_deferred_lcd_update();
@ -114,5 +114,5 @@ void grey_setfont(int newfont)
/* Get width and height of a text when printed with the current font */
int grey_getstringsize(const unsigned char *str, int *w, int *h)
{
return _grey_info.rb->font_getstringsize(str, w, h, _grey_info.curfont);
return rb->font_getstringsize(str, w, h, _grey_info.curfont);
}

View file

@ -47,9 +47,9 @@ void grey_scroll_left(int count)
do
{
_grey_info.rb->memmove(data, data + count, length);
rb->memmove(data, data + count, length);
data += length;
_grey_info.rb->memset(data, blank, count);
rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
@ -72,8 +72,8 @@ void grey_scroll_right(int count)
do
{
_grey_info.rb->memmove(data + count, data, length);
_grey_info.rb->memset(data, blank, count);
rb->memmove(data + count, data, length);
rb->memset(data, blank, count);
data += _grey_info.width;
}
while (data < data_end);
@ -93,9 +93,9 @@ void grey_scroll_up(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
_grey_info.rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
length);
_grey_info.rb->memset(_grey_info.buffer + length, blank, shift);
rb->memset(_grey_info.buffer + length, blank, shift);
}
/* Scroll down */
@ -112,9 +112,9 @@ void grey_scroll_down(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
_grey_info.rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
length);
_grey_info.rb->memset(_grey_info.buffer, blank, shift);
rb->memset(_grey_info.buffer, blank, shift);
}
/*** Unbuffered scrolling functions ***/
@ -137,14 +137,14 @@ void grey_ub_scroll_left(int count)
_grey_info.bg_brightness];
do
{
_grey_info.rb->memmove(data, data + count, length);
rb->memmove(data, data + count, length);
data += length;
_grey_info.rb->memset(data, blank, count);
rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@ -167,13 +167,13 @@ void grey_ub_scroll_right(int count)
_grey_info.bg_brightness];
do
{
_grey_info.rb->memmove(data + count, data, length);
_grey_info.rb->memset(data, blank, count);
rb->memmove(data + count, data, length);
rb->memset(data, blank, count);
data += _grey_info.width << _GREY_BSHIFT;
}
while (data < data_end);
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@ -240,12 +240,12 @@ void grey_ub_scroll_up(int count)
int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width);
src = dst + _GREY_MULUQ(count, _grey_info.width);
_grey_info.rb->memmove(dst, src, blen);
rb->memmove(dst, src, blen);
dst += blen;
}
_grey_info.rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@ -316,12 +316,12 @@ void grey_ub_scroll_down(int count)
int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width);
dst -= blen;
_grey_info.rb->memmove(dst, start, blen);
rb->memmove(dst, start, blen);
}
_grey_info.rb->memset(start, blank, dst - start);
rb->memset(start, blank, dst - start);
/* Fill remainder at once. */
#ifdef SIMULATOR
_grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}

View file

@ -23,7 +23,7 @@
#include "helper.h"
/* Force the backlight on */
void backlight_force_on(const struct plugin_api* rb)
void backlight_force_on(void)
{
if(!rb)
return;
@ -36,7 +36,7 @@ void backlight_force_on(const struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
void backlight_use_settings(const struct plugin_api* rb)
void backlight_use_settings(void)
{
if (!rb)
return;
@ -49,7 +49,7 @@ void backlight_use_settings(const struct plugin_api* rb)
#ifdef HAVE_REMOTE_LCD
/* Force the backlight on */
void remote_backlight_force_on(const struct plugin_api* rb)
void remote_backlight_force_on(void)
{
if (!rb)
return;
@ -62,7 +62,7 @@ void remote_backlight_force_on(const struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
void remote_backlight_use_settings(const struct plugin_api* rb)
void remote_backlight_use_settings(void)
{
if (!rb)
return;
@ -77,7 +77,7 @@ void remote_backlight_use_settings(const struct plugin_api* rb)
#ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */
void buttonlight_force_on(const struct plugin_api* rb)
void buttonlight_force_on(void)
{
if (!rb)
return;
@ -86,7 +86,7 @@ void buttonlight_force_on(const struct plugin_api* rb)
}
/* Reset buttonlight operation to its settings */
void buttonlight_use_settings(const struct plugin_api* rb)
void buttonlight_use_settings(void)
{
if (!rb)
return;
@ -95,15 +95,14 @@ void buttonlight_use_settings(const struct plugin_api* rb)
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_brightness_set(const struct plugin_api *rb,
int brightness)
void backlight_brightness_set(int brightness)
{
if (!rb)
return;
rb->backlight_set_brightness(brightness);
}
void backlight_brightness_use_setting(const struct plugin_api *rb)
void backlight_brightness_use_setting(void)
{
if (!rb)
return;

View file

@ -26,24 +26,23 @@
/**
* Backlight on/off operations
*/
void backlight_force_on(const struct plugin_api* rb);
void backlight_use_settings(const struct plugin_api* rb);
void backlight_force_on(void);
void backlight_use_settings(void);
#ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(const struct plugin_api* rb);
void remote_backlight_use_settings(const struct plugin_api* rb);
void remote_backlight_force_on(void);
void remote_backlight_use_settings(void);
#endif
#ifdef HAVE_BUTTON_LIGHT
void buttonlight_force_on(const struct plugin_api* rb);
void buttonlight_use_settings(const struct plugin_api* rb);
void buttonlight_force_on(void);
void buttonlight_use_settings(void);
#endif
/**
* Backlight brightness adjustment settings
*/
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_brightness_set(const struct plugin_api *rb,
int brightness);
void backlight_brightness_use_setting(const struct plugin_api *rb);
void backlight_brightness_set(int brightness);
void backlight_brightness_use_setting(void);
#endif

View file

@ -21,13 +21,6 @@
#include "plugin.h"
#include "highscore.h"
static const struct plugin_api *rb;
void highscore_init(const struct plugin_api* newrb)
{
rb = newrb;
}
int highscore_save(char *filename, struct highscore *scores, int num_scores)
{
int i;

View file

@ -28,7 +28,6 @@ struct highscore
int level;
};
void highscore_init(const struct plugin_api* newrb);
int highscore_save(char *filename, struct highscore *scores, int num_scores);
int highscore_load(char *filename, struct highscore *scores, int num_scores);
int highscore_update(int score, int level, struct highscore *scores, int num_scores);

View file

@ -27,13 +27,6 @@
#include "plugin.h"
#include "md5.h"
static const struct plugin_api *rb;
void md5_init( const struct plugin_api *api )
{
rb = api;
}
#ifdef ROCKBOX_BIG_ENDIAN
static inline uint32_t GetDWLE( const void * _p )
{

View file

@ -27,8 +27,6 @@
#ifndef _VLC_MD5_H
# define _VLC_MD5_H
void md5_init( const struct plugin_api * );
/*****************************************************************************
* md5_s: MD5 message structure
*****************************************************************************

View file

@ -29,8 +29,6 @@
#include "plugin.h"
#include "oldmenuapi.h"
const struct plugin_api *rb = NULL;
struct menu {
struct menu_item* items;
int (*callback)(int, int);
@ -67,12 +65,11 @@ static int menu_find_free(void)
return(i);
}
int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int menu_init(const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3)
{
int menu=menu_find_free();
rb = api;
if(menu==-1)/* Out of menus */
return -1;
menus[menu].items = (struct menu_item*)mitems; /* de-const */

View file

@ -33,7 +33,7 @@ struct menu_item {
bool (*function) (void); /* return true if USB was connected */
};
int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int menu_init(const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3);
void menu_exit(int menu);

View file

@ -46,7 +46,7 @@
The linker script for the overlay should use a base address towards the
end of the audiobuffer, just low enough to make the overlay fit. */
enum plugin_status run_overlay(const struct plugin_api* rb, const void* parameter,
enum plugin_status run_overlay(const void* parameter,
unsigned char *filename, unsigned char *name)
{
int fd, readsize;
@ -107,6 +107,7 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete
rb->memset(header.load_addr + readsize, 0,
header.end_addr - (header.load_addr + readsize));
return header.entry_point(rb, parameter);
*(header.api) = rb;
return header.entry_point(parameter);
}
#endif

View file

@ -28,7 +28,7 @@
#include "plugin.h"
/* load and run a plugin linked as an overlay. */
enum plugin_status run_overlay(const struct plugin_api* api, const void* parameter,
enum plugin_status run_overlay(const void* parameter,
unsigned char *filename, unsigned char *name);
#endif /* !SIMULATOR */

View file

@ -22,70 +22,69 @@
#include "plugin.h"
#include "playback_control.h"
const struct plugin_api* api = 0;
struct viewport *parentvp = NULL;
static bool prevtrack(void)
{
api->audio_prev();
rb->audio_prev();
return false;
}
static bool play(void)
{
int audio_status = api->audio_status();
if (!audio_status && api->global_status->resume_index != -1)
int audio_status = rb->audio_status();
if (!audio_status && rb->global_status->resume_index != -1)
{
if (api->playlist_resume() != -1)
if (rb->playlist_resume() != -1)
{
api->playlist_start(api->global_status->resume_index,
api->global_status->resume_offset);
rb->playlist_start(rb->global_status->resume_index,
rb->global_status->resume_offset);
}
}
else if (audio_status & AUDIO_STATUS_PAUSE)
api->audio_resume();
rb->audio_resume();
else
api->audio_pause();
rb->audio_pause();
return false;
}
static bool stop(void)
{
api->audio_stop();
rb->audio_stop();
return false;
}
static bool nexttrack(void)
{
api->audio_next();
rb->audio_next();
return false;
}
static bool volume(void)
{
const struct settings_list* vol =
api->find_setting(&api->global_settings->volume, NULL);
return api->option_screen((struct settings_list*)vol, parentvp, false, "Volume");
rb->find_setting(&rb->global_settings->volume, NULL);
return rb->option_screen((struct settings_list*)vol, parentvp, false, "Volume");
}
static bool shuffle(void)
{
const struct settings_list* shuffle =
api->find_setting(&api->global_settings->playlist_shuffle, NULL);
return api->option_screen((struct settings_list*)shuffle, parentvp, false, "Shuffle");
rb->find_setting(&rb->global_settings->playlist_shuffle, NULL);
return rb->option_screen((struct settings_list*)shuffle, parentvp, false, "Shuffle");
}
static bool repeat_mode(void)
{
const struct settings_list* repeat =
api->find_setting(&api->global_settings->repeat_mode, NULL);
int old_repeat = api->global_settings->repeat_mode;
rb->find_setting(&rb->global_settings->repeat_mode, NULL);
int old_repeat = rb->global_settings->repeat_mode;
api->option_screen((struct settings_list*)repeat, parentvp, false, "Repeat");
rb->option_screen((struct settings_list*)repeat, parentvp, false, "Repeat");
if (old_repeat != api->global_settings->repeat_mode &&
(api->audio_status() & AUDIO_STATUS_PLAY))
api->audio_flush_and_reload_tracks();
if (old_repeat != rb->global_settings->repeat_mode &&
(rb->audio_status() & AUDIO_STATUS_PLAY))
rb->audio_flush_and_reload_tracks();
return false;
}
@ -107,17 +106,13 @@ MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON,
&prevtrack_item, &playpause_item, &stop_item, &nexttrack_item,
&volume_item, &shuffle_item, &repeat_mode_item);
void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS])
void playback_control_init(struct viewport parent[NB_SCREENS])
{
api = newapi;
parentvp = parent;
}
bool playback_control(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS])
bool playback_control(struct viewport parent[NB_SCREENS])
{
api = newapi;
parentvp = parent;
return api->do_menu(&playback_control_menu, NULL, parent, false) == MENU_ATTACHED_USB;
return rb->do_menu(&playback_control_menu, NULL, parent, false) == MENU_ATTACHED_USB;
}

View file

@ -27,11 +27,9 @@
So, make sure you use the same viewport for the rb->do_menu() call
that you use in the playback_control_init() call
*/
void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS]);
void playback_control_init(struct viewport parent[NB_SCREENS]);
/* Use this if your menu still uses the old menu api */
bool playback_control(const struct plugin_api* api,
struct viewport parent[NB_SCREENS]);
bool playback_control(struct viewport parent[NB_SCREENS]);
#endif /* __PLAYBACK_CONTROL_H__ */

View file

@ -28,7 +28,6 @@
/*** globals ***/
static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */
static int char_width;
static int char_height;
static int pixel_height;
@ -40,14 +39,13 @@ static int drawmode = DRMODE_SOLID;
/*** Special functions ***/
/* library init */
bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
bool pgfx_init(int cwidth, int cheight)
{
int i;
if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2)
return false;
pgfx_rb = newrb;
char_width = cwidth;
char_height = cheight;
pixel_height = 7 * char_height;
@ -55,7 +53,7 @@ bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
for (i = 0; i < cwidth * cheight; i++)
{
if ((gfx_chars[i] = pgfx_rb->lcd_get_locked_pattern()) == 0)
if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0)
{
pgfx_release();
return false;
@ -72,7 +70,7 @@ void pgfx_release(void)
for (i = 0; i < 8; i++)
if (gfx_chars[i])
pgfx_rb->lcd_unlock_pattern(gfx_chars[i]);
rb->lcd_unlock_pattern(gfx_chars[i]);
}
/* place the display */
@ -84,12 +82,12 @@ void pgfx_display(int cx, int cy)
for (i = 0; i < width; i++)
for (j = 0; j < height; j++)
pgfx_rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
}
void pgfx_display_block(int cx, int cy, int x, int y)
{
pgfx_rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
}
@ -100,9 +98,9 @@ void pgfx_update(void)
int i;
for (i = 0; i < char_width * char_height; i++)
pgfx_rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
pgfx_rb->lcd_update();
rb->lcd_update();
}
/*** Parameter handling ***/
@ -203,7 +201,7 @@ void pgfx_clear_display(void)
{
unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0;
pgfx_rb->memset(gfx_buffer, bits, char_width * pixel_height);
rb->memset(gfx_buffer, bits, char_width * pixel_height);
}
/* Set a single pixel */

View file

@ -28,7 +28,7 @@
#ifdef HAVE_LCD_CHARCELLS /* Player only :) */
bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight);
bool pgfx_init(int cwidth, int cheight);
void pgfx_release(void);
void pgfx_display(int cx, int cy);
void pgfx_display_block(int cx, int cy, int x, int y);

View file

@ -524,12 +524,12 @@ static const struct button_mapping* get_context_map(int context)
else return NULL;
}
int pluginlib_getaction(const struct plugin_api *api,int timeout,
int pluginlib_getaction(int timeout,
const struct button_mapping *plugin_contexts[],
int count)
{
plugin_context_order = (struct button_mapping **)plugin_contexts;
plugin_context_count = count;
last_context = 0;
return api->get_custom_action(CONTEXT_CUSTOM,timeout,get_context_map);
return rb->get_custom_action(CONTEXT_CUSTOM,timeout,get_context_map);
}

View file

@ -60,7 +60,7 @@ extern const struct button_mapping generic_left_right_fire[];
extern const struct button_mapping generic_actions[];
extern const struct button_mapping generic_increase_decrease[];
int pluginlib_getaction(const struct plugin_api *api,int timeout,
int pluginlib_getaction(int timeout,
const struct button_mapping *plugin_contexts[],
int count);

View file

@ -34,7 +34,7 @@
/**
* Save to 24 bit bitmap.
*/
int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb )
int save_bmp_file( char* filename, struct bitmap *bm )
{
/* I'm not really sure about this one :) */
int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0);
@ -125,14 +125,7 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst)
#else /* LCD_DEPTH == 1 */
#include "wrappers.h"
static const struct plugin_api *rb;
/* import the core bmp loader */
#include "../../recorder/bmp.c"
/* initialize rb for use by the bmp loader */
void bmp_init(const struct plugin_api *api)
{
rb = api;
}
#endif

View file

@ -24,12 +24,11 @@
#include "lcd.h"
#include "plugin.h"
#if LCD_DEPTH > 1 /* save is only available for color, resize for >1bpp */
#ifdef HAVE_LCD_COLOR
/**
* Save bitmap to file
*/
int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb );
int save_bmp_file( char* filename, struct bitmap *bm );
#endif
/**
@ -44,13 +43,4 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst);
*/
void smooth_resize_bitmap(struct bitmap *src, struct bitmap *dst);
#else
/*
BMP loader is built with scaling support in pluginlib on 1bpp targets, as
these do not provide scaling support in the core BMP loader. bmp_init is
needed to copy the plugin API pointer for the pluginlib loader's use.
*/
void bmp_init(const struct plugin_api *api);
#endif
#endif

View file

@ -1,29 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2009 by Andrew Mahone
*
* This is a header for the pluginlib extensions to the core resize.c file
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _LIB_RESIZE_H_
#define _LIB_RESIZE_H_
void resize_init(const struct plugin_api *api);
#endif

View file

@ -23,22 +23,15 @@
#include "plugin.h"
static const struct plugin_api *local_rb = NULL; /* global api struct pointer */
void profile_init(const struct plugin_api* pa)
{
local_rb = pa;
}
void __cyg_profile_func_enter(void *this_fn, void *call_site) {
#ifdef CPU_COLDFIRE
(void)call_site;
local_rb->profile_func_enter(this_fn, __builtin_return_address(1));
rb->profile_func_enter(this_fn, __builtin_return_address(1));
#else
local_rb->profile_func_enter(this_fn, call_site);
rb->profile_func_enter(this_fn, call_site);
#endif
}
void __cyg_profile_func_exit(void *this_fn, void *call_site) {
local_rb->profile_func_exit(this_fn,call_site);
rb->profile_func_exit(this_fn,call_site);
}

View file

@ -26,8 +26,6 @@
#include "plugin.h"
void profile_init(const struct plugin_api* pa);
void __cyg_profile_func_enter(void *this_fn, void *call_site)
NO_PROF_ATTR ICODE_ATTR;
void __cyg_profile_func_exit(void *this_fn, void *call_site)

View file

@ -28,7 +28,6 @@
#ifdef HAVE_LCD_BITMAP
void xlcd_init(const struct plugin_api* newrb);
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void xlcd_filltriangle_screen(struct screen* display,
int x1, int y1, int x2, int y2, int x3, int y3);
@ -50,9 +49,6 @@ void xlcd_scroll_right(int count);
void xlcd_scroll_up(int count);
void xlcd_scroll_down(int count);
/* internal stuff */
extern const struct plugin_api *_xlcd_rb; /* global api struct pointer */
#endif /* HAVE_LCD_BITMAP */
#endif /* __XLCD_H__ */

View file

@ -27,17 +27,5 @@
#ifdef HAVE_LCD_BITMAP
#include "xlcd.h"
/*** globals ***/
const struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */
/*** functions ***/
/* library init */
void xlcd_init(const struct plugin_api* newrb)
{
_xlcd_rb = newrb;
}
#endif /* HAVE_LCD_BITMAP */

View file

@ -155,7 +155,7 @@ void xlcd_filltriangle(int x1, int y1,
int x3, int y3)
{
/* default is main screen */
xlcd_filltriangle_screen(_xlcd_rb->screens[SCREEN_MAIN],
xlcd_filltriangle_screen(rb->screens[SCREEN_MAIN],
x1, y1, x2, y2, x3, y3);
}
@ -276,7 +276,7 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
src += stride * src_y + src_x; /* move starting point */
src_end = src + stride * height;
dst = _xlcd_rb->lcd_framebuffer + LCD_WIDTH * y + x;
dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
do
{
@ -336,7 +336,7 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
src += 3 * (stride * src_y + src_x); /* move starting point */
src_end = src + 3 * stride * height;
dst = _xlcd_rb->lcd_framebuffer + LCD_WIDTH * y + x;
dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
do
{

View file

@ -50,12 +50,12 @@ void xlcd_scroll_left(int count)
if (blockcount)
{
unsigned char *data = _xlcd_rb->lcd_framebuffer;
unsigned char *data = rb->lcd_framebuffer;
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
do
{
_xlcd_rb->memmove(data, data + blockcount, blocklen);
rb->memmove(data, data + blockcount, blocklen);
data += LCD_FBWIDTH;
}
while (data < data_end);
@ -63,9 +63,9 @@ void xlcd_scroll_left(int count)
if (bitcount)
{
int bx, y;
unsigned char *addr = _xlcd_rb->lcd_framebuffer + blocklen;
unsigned char *addr = rb->lcd_framebuffer + blocklen;
#if LCD_DEPTH == 2
unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#endif
for (y = 0; y < LCD_HEIGHT; y++)
@ -82,10 +82,10 @@ void xlcd_scroll_left(int count)
addr += LCD_FBWIDTH;
}
}
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(LCD_WIDTH - count, 0, count, LCD_HEIGHT);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(LCD_WIDTH - count, 0, count, LCD_HEIGHT);
rb->lcd_set_drawmode(oldmode);
}
/* Scroll right */
@ -105,12 +105,12 @@ void xlcd_scroll_right(int count)
if (blockcount)
{
unsigned char *data = _xlcd_rb->lcd_framebuffer;
unsigned char *data = rb->lcd_framebuffer;
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
do
{
_xlcd_rb->memmove(data + blockcount, data, blocklen);
rb->memmove(data + blockcount, data, blocklen);
data += LCD_FBWIDTH;
}
while (data < data_end);
@ -118,9 +118,9 @@ void xlcd_scroll_right(int count)
if (bitcount)
{
int bx, y;
unsigned char *addr = _xlcd_rb->lcd_framebuffer + blockcount;
unsigned char *addr = rb->lcd_framebuffer + blockcount;
#if LCD_DEPTH == 2
unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#endif
for (y = 0; y < LCD_HEIGHT; y++)
@ -137,10 +137,10 @@ void xlcd_scroll_right(int count)
addr += LCD_FBWIDTH;
}
}
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
rb->lcd_set_drawmode(oldmode);
}
#else /* LCD_PIXELFORMAT vertical packed or >= 8bit / pixel */
@ -154,21 +154,21 @@ void xlcd_scroll_left(int count)
if ((unsigned)count >= LCD_WIDTH)
return;
data = _xlcd_rb->lcd_framebuffer;
data = rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
length = LCD_WIDTH - count;
do
{
_xlcd_rb->memmove(data, data + count, length * sizeof(fb_data));
rb->memmove(data, data + count, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
rb->lcd_set_drawmode(oldmode);
}
/* Scroll right */
@ -180,21 +180,21 @@ void xlcd_scroll_right(int count)
if ((unsigned)count >= LCD_WIDTH)
return;
data = _xlcd_rb->lcd_framebuffer;
data = rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
length = LCD_WIDTH - count;
do
{
_xlcd_rb->memmove(data + count, data, length * sizeof(fb_data));
rb->memmove(data + count, data, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
rb->lcd_set_drawmode(oldmode);
}
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
@ -211,14 +211,14 @@ void xlcd_scroll_up(int count)
length = LCD_HEIGHT - count;
_xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer,
_xlcd_rb->lcd_framebuffer + count * LCD_FBWIDTH,
rb->memmove(rb->lcd_framebuffer,
rb->lcd_framebuffer + count * LCD_FBWIDTH,
length * LCD_FBWIDTH * sizeof(fb_data));
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, length, LCD_WIDTH, count);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, length, LCD_WIDTH, count);
rb->lcd_set_drawmode(oldmode);
}
/* Scroll down */
@ -231,14 +231,14 @@ void xlcd_scroll_down(int count)
length = LCD_HEIGHT - count;
_xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer + count * LCD_FBWIDTH,
_xlcd_rb->lcd_framebuffer,
rb->memmove(rb->lcd_framebuffer + count * LCD_FBWIDTH,
rb->lcd_framebuffer,
length * LCD_FBWIDTH * sizeof(fb_data));
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
rb->lcd_set_drawmode(oldmode);
}
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING,
@ -265,8 +265,8 @@ void xlcd_scroll_up(int count)
if (blockcount)
{
_xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer,
_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
rb->memmove(rb->lcd_framebuffer,
rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
blocklen * LCD_FBWIDTH * sizeof(fb_data));
}
if (bitcount)
@ -336,7 +336,7 @@ void xlcd_scroll_up(int count)
"bt .su_cloop \n"
: /* outputs */
: /* inputs */
[addr]"r"(_xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[addr]"r"(rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[wide]"r"(LCD_FBWIDTH),
[rows]"r"(blocklen),
[cnt] "r"(bitcount)
@ -374,17 +374,17 @@ void xlcd_scroll_up(int count)
: /* inputs */
[wide]"r"(LCD_FBWIDTH),
[rows]"r"(blocklen),
[addr]"a"(_xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[addr]"a"(rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[cnt] "d"(bitcount),
[bkg] "d"(0x55 * (~_xlcd_rb->lcd_get_background() & 3))
[bkg] "d"(0x55 * (~rb->lcd_get_background() & 3))
: /* clobbers */
"a1", "d0", "d1", "d2", "d3"
);
#else /* C version */
int x, by;
unsigned char *addr = _xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
unsigned char *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
#if LCD_DEPTH == 2
unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#else
const unsigned fill = 0;
#endif
@ -407,10 +407,10 @@ void xlcd_scroll_up(int count)
#if LCD_DEPTH == 2
int x, by;
fb_data *addr = _xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
fb_data *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
unsigned fill, mask;
fill = patterns[_xlcd_rb->lcd_get_background() & 3] << 8;
fill = patterns[rb->lcd_get_background() & 3] << 8;
mask = (0xFFu >> bitcount) << bitcount;
mask |= mask << 8;
@ -432,10 +432,10 @@ void xlcd_scroll_up(int count)
#endif /* LCD_PIXELFORMAT */
}
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, LCD_HEIGHT - count, LCD_WIDTH, count);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, LCD_HEIGHT - count, LCD_WIDTH, count);
rb->lcd_set_drawmode(oldmode);
}
/* Scroll up */
@ -459,8 +459,8 @@ void xlcd_scroll_down(int count)
if (blockcount)
{
_xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
_xlcd_rb->lcd_framebuffer,
rb->memmove(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
rb->lcd_framebuffer,
blocklen * LCD_FBWIDTH * sizeof(fb_data));
}
if (bitcount)
@ -529,7 +529,7 @@ void xlcd_scroll_down(int count)
"bt .sd_cloop \n"
: /* outputs */
: /* inputs */
[addr]"r"(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[addr]"r"(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[wide]"r"(LCD_WIDTH),
[rows]"r"(blocklen),
[cnt] "r"(bitcount)
@ -564,17 +564,17 @@ void xlcd_scroll_down(int count)
: /* inputs */
[wide]"r"(LCD_WIDTH),
[rows]"r"(blocklen),
[addr]"a"(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[addr]"a"(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[cnt] "d"(bitcount),
[bkg] "d"((0x55 * (~_xlcd_rb->lcd_get_background() & 3)) << bitcount)
[bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount)
: /* clobbers */
"a1", "d0", "d1", "d2", "d3"
);
#else /* C version */
int x, by;
unsigned char *addr = _xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
unsigned char *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
#if LCD_DEPTH == 2
unsigned fill = (0x55 * (~_xlcd_rb->lcd_get_background() & 3)) << bitcount;
unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
#else
const unsigned fill = 0;
#endif
@ -597,10 +597,10 @@ void xlcd_scroll_down(int count)
#if LCD_DEPTH == 2
int x, by;
fb_data *addr = _xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
fb_data *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
unsigned fill, mask;
fill = patterns[_xlcd_rb->lcd_get_background() & 3] >> (8 - bitcount);
fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);
mask = (0xFFu >> bitcount) << bitcount;
mask |= mask << 8;
@ -622,10 +622,10 @@ void xlcd_scroll_down(int count)
#endif /* LCD_PIXELFORMAT */
}
oldmode = _xlcd_rb->lcd_get_drawmode();
_xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
_xlcd_rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
_xlcd_rb->lcd_set_drawmode(oldmode);
oldmode = rb->lcd_get_drawmode();
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
rb->lcd_set_drawmode(oldmode);
}
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */