summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/cube.c1
-rw-r--r--apps/plugins/doom/i_video.c1
-rw-r--r--apps/plugins/fire.c1
-rw-r--r--apps/plugins/greyscale.c1
-rw-r--r--apps/plugins/jpeg.c1
-rw-r--r--apps/plugins/lib/grey.h10
-rw-r--r--apps/plugins/lib/grey_core.c113
-rw-r--r--apps/plugins/lib/grey_draw.c14
-rw-r--r--apps/plugins/lib/grey_parm.c2
-rw-r--r--apps/plugins/lib/grey_scroll.c45
-rw-r--r--apps/plugins/mandelbrot.c1
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c4
-rw-r--r--apps/plugins/plasma.c1
-rw-r--r--apps/plugins/test_fps.c4
-rw-r--r--apps/plugins/zxbox/zxbox.c1
15 files changed, 110 insertions, 90 deletions
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 73d0630adc..187fcad1c1 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -214,6 +214,7 @@ static int y_off = LCD_HEIGHT/2;
#if LCD_DEPTH == 1
#define USE_GSLIB
+GREY_INFO_STRUCT
struct my_lcd {
void (*update)(void);
void (*clear_display)(void);
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index cc5036c59d..b466392319 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -118,6 +118,7 @@
#ifndef HAVE_LCD_COLOR
#include "../lib/grey.h"
+GREY_INFO_STRUCT_IRAM
static unsigned char greybuffer[LCD_WIDTH] IBSS_ATTR; /* off screen buffer */
static unsigned char *gbuf;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index 2d7a66ea16..ed3509c168 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -46,6 +46,7 @@ static unsigned char fire[LCD_HEIGHT+3][FIRE_WIDTH];
static unsigned char cooling_map[LCD_HEIGHT][FIRE_WIDTH];
#ifndef HAVE_LCD_COLOR
+GREY_INFO_STRUCT
static unsigned char *gbuf;
static size_t gbuf_size = 0;
static unsigned char draw_buffer[FIRE_WIDTH];
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index de90d5737f..6a574f3f6f 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -82,6 +82,7 @@ PLUGIN_HEADER
#endif
/******************************* Globals ***********************************/
+GREY_INFO_STRUCT
static struct plugin_api* rb; /* global api struct pointer */
static char pbuf[32]; /* global printf buffer */
static unsigned char *gbuf;
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c
index d14b03637b..978e1156b9 100644
--- a/apps/plugins/jpeg.c
+++ b/apps/plugins/jpeg.c
@@ -184,6 +184,7 @@ PLUGIN_HEADER
/* different graphics libraries */
#if LCD_DEPTH < 8
#define USEGSLIB
+GREY_INFO_STRUCT
#define MYLCD(fn) grey_ub_ ## fn
#define MYLCD_UPDATE()
#define MYXLCD(fn) grey_ub_ ## fn
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 5bef88a89a..84b6687de3 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -36,6 +36,12 @@
#define GREY_LIGHTGRAY GREY_BRIGHTNESS(170)
#define GREY_WHITE GREY_BRIGHTNESS(255)
+/* Greyscale library management structure declaration. You need one of these
+ * in every plugin using the library, depending on whether the structure should
+ * use IRAM or not. */
+#define GREY_INFO_STRUCT struct _grey_info _grey_info;
+#define GREY_INFO_STRUCT_IRAM struct _grey_info _grey_info IBSS_ATTR;
+
/* Library initialisation and release */
bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
bool buffered, int width, int height, long *buf_taken);
@@ -148,6 +154,7 @@ struct _grey_info
int bheight; /* 4-pixel or 8-pixel units */
#endif
unsigned long flags; /* various flags, see #defines */
+ struct plugin_api *rb; /* plugin API pointer */
#ifndef SIMULATOR
unsigned char *values; /* start of greyscale pixel values */
unsigned char *phases; /* start of greyscale pixel phases */
@@ -162,8 +169,7 @@ struct _grey_info
int curfont; /* current selected font */
};
-/* Global variables */
-extern struct plugin_api *_grey_rb;
+/* Global variable, defined in the plugin */
extern struct _grey_info _grey_info;
#endif /* HAVE_LCD_BITMAP && (LCD_DEPTH < 4) */
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 0fa7e28eb9..395a1130d5 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -30,13 +30,10 @@
#define NEED_BOOST
#endif
-/* Global variables */
-struct plugin_api *_grey_rb = NULL; /* global api struct pointer */
-struct _grey_info _grey_info; /* global info structure */
-
#ifndef SIMULATOR
-#if CONFIG_LCD == LCD_SSD1815 || CONFIG_LCD == LCD_IFP7XX || CONFIG_LCD == LCD_MROBE100
+#if CONFIG_LCD == LCD_SSD1815 || CONFIG_LCD == LCD_IFP7XX \
+ || CONFIG_LCD == LCD_MROBE100
/* measured and interpolated curve */
/* TODO: check for iFP & m:robe 100 */
static const unsigned char lcdlinear[256] = {
@@ -205,16 +202,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_rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
+ _grey_info.rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
if (y2 < LCD_HEIGHT) /* refresh part below overlay, full width */
- _grey_rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
+ _grey_info.rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
if (x1 > 0) /* refresh part to the left of overlay */
- _grey_rb->lcd_update_rect(0, y1, x1, y2 - y1);
+ _grey_info.rb->lcd_update_rect(0, y1, x1, y2 - y1);
if (x2 < LCD_WIDTH) /* refresh part to the right of overlay */
- _grey_rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
+ _grey_info.rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
}
#ifndef SIMULATOR
@@ -222,18 +219,18 @@ static inline void _deferred_update(void)
static void _timer_isr(void)
{
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
- _grey_rb->lcd_grey_phase_blit(_grey_info.values, _grey_info.phases,
- _grey_info.bx, _grey_info.y,
- _grey_info.bwidth, _grey_info.height,
- _grey_info.width);
+ _grey_info.rb->lcd_grey_phase_blit(_grey_info.values, _grey_info.phases,
+ _grey_info.bx, _grey_info.y,
+ _grey_info.bwidth, _grey_info.height,
+ _grey_info.width);
#else
- _grey_rb->lcd_grey_phase_blit(_grey_info.values, _grey_info.phases,
- _grey_info.x, _grey_info.by,
- _grey_info.width, _grey_info.bheight,
- _grey_info.width);
+ _grey_info.rb->lcd_grey_phase_blit(_grey_info.values, _grey_info.phases,
+ _grey_info.x, _grey_info.by,
+ _grey_info.width, _grey_info.bheight,
+ _grey_info.width);
#endif
- if (_grey_info.flags & _GREY_DEFERRED_UPDATE) /* lcd_update() requested? */
+ if (_grey_info.flags & _GREY_DEFERRED_UPDATE) /* lcd_update() requested? */
{
_deferred_update();
_grey_info.flags &= ~_GREY_DEFERRED_UPDATE; /* clear request */
@@ -246,7 +243,7 @@ static int exp_s16p16(int x)
{
int t;
int y = 0x00010000;
-
+
if (x < 0) x += 0xb1721, y >>= 16;
t = x - 0x58b91; if (t >= 0) x = t, y <<= 8;
t = x - 0x2c5c8; if (t >= 0) x = t, y <<= 4;
@@ -326,7 +323,7 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
unsigned *dst, *end;
#endif
- _grey_rb = newrb;
+ _grey_info.rb = newrb;
if ((unsigned) width > LCD_WIDTH
|| (unsigned) height > LCD_HEIGHT)
@@ -347,10 +344,10 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
plane_size = _GREY_MULUQ(width, height);
#ifdef CPU_COLDFIRE
- plane_size += (-plane_size) & 0xf; /* All buffers should be line aligned */
+ plane_size += (-plane_size) & 0xf; /* All buffers should be line aligned */
buftaken = (-(long)gbuf) & 0xf;
#else
- buftaken = (-(long)gbuf) & 3; /* All buffers must be long aligned. */
+ buftaken = (-(long)gbuf) & 3; /* All buffers must be long aligned. */
#endif
gbuf += buftaken;
@@ -371,17 +368,17 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
if (buftaken > gbuf_size)
return false;
-
+
#ifndef SIMULATOR
/* Init to white */
- _grey_rb->memset(_grey_info.values, 0x80, plane_size);
-
+ _grey_info.rb->memset(_grey_info.values, 0x80, plane_size);
+
/* Init phases with random bits */
dst = (unsigned*)(_grey_info.phases);
end = (unsigned*)(_grey_info.phases + plane_size);
do
- *dst++ = _grey_rb->rand();
+ *dst++ = _grey_info.rb->rand();
while (dst < end);
#endif
@@ -444,46 +441,46 @@ void grey_show(bool enable)
{
_grey_info.flags |= _GREY_RUNNING;
#ifdef SIMULATOR
- _grey_rb->sim_lcd_ex_init(129, _grey_get_pixel);
+ _grey_info.rb->sim_lcd_ex_init(129, _grey_get_pixel);
grey_update();
#else /* !SIMULATOR */
#ifdef NEED_BOOST
- _grey_rb->cpu_boost(true);
+ _grey_info.rb->cpu_boost(true);
#endif
#if CONFIG_LCD == LCD_SSD1815
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 67, 1, _timer_isr);
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 67, 1, _timer_isr);
#elif CONFIG_LCD == LCD_S1D15E06
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 70, 1, _timer_isr);
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 70, 1, _timer_isr);
#elif CONFIG_LCD == LCD_IPOD2BPP
#ifdef IPOD_1G2G
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 95, 1, _timer_isr); /* verified */
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 95, 1, _timer_isr); /* verified */
#elif defined IPOD_3G
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 87, 1, _timer_isr); /* verified */
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 87, 1, _timer_isr); /* verified */
#else
/* FIXME: verify value */
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 80, 1, _timer_isr);
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 80, 1, _timer_isr);
#endif
#elif CONFIG_LCD == LCD_IPODMINI
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 88, 1, _timer_isr);
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 88, 1, _timer_isr);
#elif CONFIG_LCD == LCD_IFP7XX
- _grey_rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr);
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr);
#endif /* CONFIG_LCD */
#endif /* !SIMULATOR */
- _grey_rb->screen_dump_set_hook(grey_screendump_hook);
+ _grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
}
else if (!enable && (_grey_info.flags & _GREY_RUNNING))
{
#ifdef SIMULATOR
- _grey_rb->sim_lcd_ex_init(0, NULL);
+ _grey_info.rb->sim_lcd_ex_init(0, NULL);
#else
- _grey_rb->timer_unregister();
+ _grey_info.rb->timer_unregister();
#ifdef NEED_BOOST
- _grey_rb->cpu_boost(false);
+ _grey_info.rb->cpu_boost(false);
#endif
#endif
_grey_info.flags &= ~_GREY_RUNNING;
- _grey_rb->screen_dump_set_hook(NULL);
- _grey_rb->lcd_update(); /* restore whatever there was before */
+ _grey_info.rb->screen_dump_set_hook(NULL);
+ _grey_info.rb->lcd_update(); /* restore whatever there was before */
}
}
@@ -512,7 +509,7 @@ void grey_update_rect(int x, int y, int width, int height)
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
- _grey_rb->sim_lcd_ex_update_rect(x, y, width, height);
+ _grey_info.rb->sim_lcd_ex_update_rect(x, y, width, height);
}
#else /* !SIMULATOR */
@@ -523,20 +520,20 @@ void grey_update_rect(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0))
return; /* nothing to do */
-
+
if (y + height > _grey_info.height)
height = _grey_info.height - y;
if (x + width > _grey_info.width)
width = _grey_info.width - x;
-
+
src = _grey_info.buffer + _GREY_MULUQ(_grey_info.width, y) + x;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
dst = _grey_info.values + _GREY_MULUQ(_grey_info.width, y) + x;
-
+
do
{
- _grey_rb->memcpy(dst, src, width);
+ _grey_info.rb->memcpy(dst, src, width);
dst += _grey_info.width;
src += _grey_info.width;
}
@@ -557,7 +554,7 @@ void grey_update_rect(int x, int y, int width, int height)
dst += _GREY_BSIZE;
}
while (src_row < src_end);
-
+
y++;
src += _grey_info.width;
}
@@ -587,7 +584,7 @@ void grey_deferred_lcd_update(void)
#endif
}
else
- _grey_rb->lcd_update();
+ _grey_info.rb->lcd_update();
}
/*** Screenshot ***/
@@ -662,10 +659,10 @@ static void grey_screendump_hook(int fd)
unsigned char *clut_entry;
unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)];
- _grey_rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
+ _grey_info.rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
/* build clut */
- _grey_rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
+ _grey_info.rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
clut_entry = linebuf;
for (i = 0; i <= 128; i++)
@@ -675,17 +672,17 @@ static void grey_screendump_hook(int fd)
*clut_entry++ = _GREY_MULUQ(BMP_RED, i) >> 7;
clut_entry++;
}
- _grey_rb->write(fd, linebuf, 4*BMP_VARCOLORS);
+ _grey_info.rb->write(fd, linebuf, 4*BMP_VARCOLORS);
/* BMP image goes bottom -> top */
for (y = LCD_HEIGHT - 1; y >= 0; y--)
{
- _grey_rb->memset(linebuf, 0, BMP_LINESIZE);
+ _grey_info.rb->memset(linebuf, 0, BMP_LINESIZE);
gy = y - _grey_info.y;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#if LCD_DEPTH == 2
- lcdptr = _grey_rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
+ lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
for (x = 0; x < LCD_WIDTH; x += 4)
{
@@ -718,7 +715,7 @@ static void grey_screendump_hook(int fd)
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
#if LCD_DEPTH == 1
mask = 1 << (y & 7);
- lcdptr = _grey_rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
+ lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
for (x = 0; x < LCD_WIDTH; x++)
{
@@ -734,8 +731,8 @@ static void grey_screendump_hook(int fd)
#else
linebuf[x] = BMP_FIXEDCOLORS
+ _grey_info.values[_GREY_MULUQ(_grey_info.width,
- gy & ~_GREY_BMASK)
- + (gx << _GREY_BSHIFT)
+ gy & ~_GREY_BMASK)
+ + (gx << _GREY_BSHIFT)
+ (~gy & _GREY_BMASK)];
#endif
}
@@ -747,7 +744,7 @@ static void grey_screendump_hook(int fd)
}
#elif LCD_DEPTH == 2
shift = 2 * (y & 3);
- lcdptr = _grey_rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
+ lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
for (x = 0; x < LCD_WIDTH; x++)
{
@@ -777,6 +774,6 @@ static void grey_screendump_hook(int fd)
#endif /* LCD_DEPTH */
#endif /* LCD_PIXELFORMAT */
- _grey_rb->write(fd, linebuf, BMP_LINESIZE);
+ _grey_info.rb->write(fd, linebuf, BMP_LINESIZE);
}
}
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index 683793129e..9b8acd4c37 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -61,8 +61,8 @@ void grey_clear_display(void)
int value = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_val : _grey_info.bg_val;
- _grey_rb->memset(_grey_info.buffer, value,
- _GREY_MULUQ(_grey_info.width, _grey_info.height));
+ _grey_info.rb->memset(_grey_info.buffer, value,
+ _GREY_MULUQ(_grey_info.width, _grey_info.height));
}
/* Set a single pixel */
@@ -194,7 +194,7 @@ void grey_hline(int x1, int x2, int y)
dst = &_grey_info.buffer[_GREY_MULUQ(_grey_info.width, y) + x1];
if (fillopt)
- _grey_rb->memset(dst, value, x2 - x1 + 1);
+ _grey_info.rb->memset(dst, value, x2 - x1 + 1);
else
{
unsigned char *dst_end = dst + x2 - x1;
@@ -379,7 +379,7 @@ void grey_fillrect(int x, int y, int width, int height)
do
{
if (fillopt)
- _grey_rb->memset(dst, value, width);
+ _grey_info.rb->memset(dst, value, width);
else
{
unsigned char *dst_row = dst;
@@ -539,7 +539,7 @@ void grey_gray_bitmap(const unsigned char *src, int x, int y, int width,
void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
{
int ch;
- struct font* pf = _grey_rb->font_get(_grey_info.curfont);
+ struct font* pf = _grey_info.rb->font_get(_grey_info.curfont);
while ((ch = *str++) != '\0' && x < _grey_info.width)
{
@@ -603,8 +603,8 @@ void grey_ub_clear_display(void)
int value = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_val : _grey_info.bg_val;
- _grey_rb->memset(_grey_info.values, value,
- _GREY_MULUQ(_grey_info.width, _grey_info.height));
+ _grey_info.rb->memset(_grey_info.values, value,
+ _GREY_MULUQ(_grey_info.width, _grey_info.height));
}
/* Draw a partial greyscale bitmap, canonical format */
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c
index 6d605059f8..e2accee518 100644
--- a/apps/plugins/lib/grey_parm.c
+++ b/apps/plugins/lib/grey_parm.c
@@ -112,5 +112,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_rb->font_getstringsize(str, w, h, _grey_info.curfont);
+ return _grey_info.rb->font_getstringsize(str, w, h, _grey_info.curfont);
}
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index 0e88655c89..5040dd4c74 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -45,9 +45,9 @@ void grey_scroll_left(int count)
do
{
- _grey_rb->memmove(data, data + count, length);
+ _grey_info.rb->memmove(data, data + count, length);
data += length;
- _grey_rb->memset(data, blank, count);
+ _grey_info.rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
@@ -70,8 +70,8 @@ void grey_scroll_right(int count)
do
{
- _grey_rb->memmove(data + count, data, length);
- _grey_rb->memset(data, blank, count);
+ _grey_info.rb->memmove(data + count, data, length);
+ _grey_info.rb->memset(data, blank, count);
data += _grey_info.width;
}
while (data < data_end);
@@ -91,8 +91,9 @@ void grey_scroll_up(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_val : _grey_info.bg_val;
- _grey_rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, length);
- _grey_rb->memset(_grey_info.buffer + length, blank, shift);
+ _grey_info.rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
+ length);
+ _grey_info.rb->memset(_grey_info.buffer + length, blank, shift);
}
/* Scroll down */
@@ -109,8 +110,9 @@ void grey_scroll_down(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_val : _grey_info.bg_val;
- _grey_rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, length);
- _grey_rb->memset(_grey_info.buffer, blank, shift);
+ _grey_info.rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
+ length);
+ _grey_info.rb->memset(_grey_info.buffer, blank, shift);
}
/*** Unbuffered scrolling functions ***/
@@ -155,7 +157,7 @@ void grey_ub_scroll_left(int count)
if ((unsigned)count >= (unsigned)_grey_info.width)
return;
-
+
data = _grey_info.values;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = (_grey_info.width - count) << _GREY_BSHIFT;
@@ -165,9 +167,9 @@ void grey_ub_scroll_left(int count)
do
{
- _grey_rb->memmove(data, data + count, length);
+ _grey_info.rb->memmove(data, data + count, length);
data += length;
- _grey_rb->memset(data, blank, count);
+ _grey_info.rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
@@ -181,7 +183,7 @@ void grey_ub_scroll_right(int count)
if ((unsigned)count >= (unsigned)_grey_info.width)
return;
-
+
data = _grey_info.values;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = (_grey_info.width - count) << _GREY_BSHIFT;
@@ -191,8 +193,8 @@ void grey_ub_scroll_right(int count)
do
{
- _grey_rb->memmove(data + count, data, length);
- _grey_rb->memset(data, blank, count);
+ _grey_info.rb->memmove(data + count, data, length);
+ _grey_info.rb->memset(data, blank, count);
data += _grey_info.width << _GREY_BSHIFT;
}
while (data < data_end);
@@ -206,7 +208,7 @@ void grey_ub_scroll_up(int count)
if ((unsigned)count >= (unsigned)_grey_info.height)
return;
-
+
dst = _grey_info.values;
end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width);
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
@@ -258,10 +260,10 @@ 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_rb->memmove(dst, src, blen);
+ _grey_info.rb->memmove(dst, src, blen);
dst += blen;
}
- _grey_rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
+ _grey_info.rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
}
/* Scroll down */
@@ -272,7 +274,7 @@ void grey_ub_scroll_down(int count)
if ((unsigned)count >= (unsigned)_grey_info.height)
return;
-
+
start = _grey_info.values;
dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width);
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
@@ -304,7 +306,7 @@ void grey_ub_scroll_down(int count)
}
while (dst < line_end);
}
- for (; ~yd & _GREY_BMASK; yd--) /* Fill remainder of current block. */
+ for (; ~yd & _GREY_BMASK; yd--) /* Fill remainder of current block. */
{
dst = _grey_info.values
+ _GREY_MULUQ(_grey_info.width, yd & ~_GREY_BMASK)
@@ -325,9 +327,10 @@ void grey_ub_scroll_down(int count)
int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width);
dst -= blen;
- _grey_rb->memmove(dst, start, blen);
+ _grey_info.rb->memmove(dst, start, blen);
}
- _grey_rb->memset(start, blank, dst - start); /* Fill remainder at once. */
+ _grey_info.rb->memset(start, blank, dst - start);
+ /* Fill remainder at once. */
}
#endif /* !SIMULATOR */
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index 76c5030874..11f4d34eea 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -211,6 +211,7 @@ static int step_log2;
static unsigned max_iter;
#ifdef USEGSLIB
+GREY_INFO_STRUCT
static unsigned char *gbuf;
static size_t gbuf_size = 0;
static unsigned char imgbuffer[LCD_HEIGHT];
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index b164254dd7..53b5631879 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -23,6 +23,10 @@
#include "grey.h"
#include "mpeg_settings.h"
+#ifndef HAVE_LCD_COLOR
+GREY_INFO_STRUCT_IRAM
+#endif
+
static struct event_queue stream_mgr_queue NOCACHEBSS_ATTR;
static struct queue_sender_list stream_mgr_queue_send NOCACHEBSS_ATTR;
static uint32_t stream_mgr_thread_stack[DEFAULT_STACK_SIZE*2/sizeof(uint32_t)];
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 4f5fc39eb2..ce2af5c87b 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -44,6 +44,7 @@ static int redfactor = 1, greenfactor = 2, bluefactor = 3;
static int redphase = 0, greenphase = 50, bluephase = 100;
/* lower chance of gray at regular intervals */
#else
+GREY_INFO_STRUCT
static unsigned char colours[256]; /* Smooth transition of shades */
static unsigned char greybuffer[LCD_HEIGHT*LCD_WIDTH]; /* off screen buffer */
static unsigned char *gbuf;
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index fd1ee2a89b..37a93cc489 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -257,6 +257,8 @@ static void time_remote_update(void)
#endif
#if LCD_DEPTH < 4
+
+GREY_INFO_STRUCT
static unsigned char greydata[LCD_HEIGHT][LCD_WIDTH];
static void make_grey_rect(int width, int height)
@@ -312,7 +314,7 @@ static void time_greyscale(void)
grey_release();
fps = calc_tenth_fps(frames_2, time_2);
- load = 100 - (100* frames_2 * time_1) / (frames_1 * time_2);
+ load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2);
rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
log_text(str);
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index ebb689ce9c..3d395986af 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -51,6 +51,7 @@ unsigned char image_array [ HEIGHT * WIDTH ];
static int previous_state;
#ifdef USE_GREY
+GREY_INFO_STRUCT_IRAM
static unsigned char *gbuf;
static size_t gbuf_size = 0;
#endif