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:
parent
35677cbc54
commit
23d9812273
179 changed files with 586 additions and 1183 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue