summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit-common.c18
-rw-r--r--firmware/drivers/lcd-16bit-vert.c15
-rw-r--r--firmware/drivers/lcd-16bit.c15
-rw-r--r--firmware/drivers/lcd-1bit-vert.c22
-rw-r--r--firmware/drivers/lcd-2bit-horz.c27
-rw-r--r--firmware/drivers/lcd-2bit-vert.c27
-rw-r--r--firmware/drivers/lcd-2bit-vi.c30
-rw-r--r--firmware/drivers/lcd-memframe.c4
-rw-r--r--firmware/drivers/lcd-remote-1bit-v.c2
-rw-r--r--firmware/drivers/lcd-remote-2bit-vi.c2
-rw-r--r--firmware/export/lcd-remote.h5
-rw-r--r--firmware/export/lcd.h9
-rw-r--r--firmware/screendump.c14
-rw-r--r--firmware/target/arm/as3525/lcd-fuze.c2
-rw-r--r--firmware/target/arm/as3525/lcd-ssd1303.c4
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c2
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c2
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c8
-rw-r--r--firmware/target/arm/ipod/lcd-color_nano.c2
-rw-r--r--firmware/target/arm/ipod/lcd-gray.c4
-rw-r--r--firmware/target/arm/ipod/video/lcd-video.c2
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_20gb.c2
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_5gb.c2
-rw-r--r--firmware/target/arm/lcd-c200_c200v2.c2
-rw-r--r--firmware/target/arm/lcd-ssd1815.c4
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-mr100.c4
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-remote-mr100.c2
-rw-r--r--firmware/target/arm/pbell/vibe500/lcd-vibe500.c2
-rw-r--r--firmware/target/arm/philips/hdd1630/lcd-hdd1630.c2
-rw-r--r--firmware/target/arm/philips/hdd6330/lcd-hdd6330.c2
-rw-r--r--firmware/target/arm/philips/sa9200/lcd-sa9200.c6
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c4
-rw-r--r--firmware/target/arm/rk27xx/lcd-hifiman.c2
-rw-r--r--firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c2
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c2
-rw-r--r--firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c2
-rw-r--r--firmware/target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c4
-rw-r--r--firmware/target/arm/s5l8700/yps3/lcd-yps3.c4
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c2
-rw-r--r--firmware/target/arm/samsung/yh820/lcd-yh820.c2
-rw-r--r--firmware/target/arm/samsung/yh920/lcd-yh920.c2
-rw-r--r--firmware/target/arm/samsung/yh925/lcd-yh925.c2
-rw-r--r--firmware/target/arm/sandisk/sansa-view/lcd-view.c2
-rw-r--r--firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c2
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c2
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c6
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c8
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c2
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c2
-rw-r--r--firmware/target/coldfire/iaudio/lcd-remote-iaudio.c4
-rw-r--r--firmware/target/coldfire/iaudio/m3/lcd-m3.c4
-rw-r--r--firmware/target/coldfire/iaudio/m5/lcd-m5.c4
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-x5.c2
-rw-r--r--firmware/target/coldfire/iriver/h100/lcd-h100.c4
-rw-r--r--firmware/target/coldfire/iriver/h300/lcd-h300.c4
-rw-r--r--firmware/target/coldfire/iriver/lcd-remote-iriver.c4
-rw-r--r--firmware/target/coldfire/mpio/hd200/lcd-hd200.c4
-rw-r--r--firmware/target/coldfire/mpio/hd300/lcd-hd300.c4
-rw-r--r--firmware/target/hosted/android/lcd-android.c6
-rw-r--r--firmware/target/hosted/sdl/lcd-bitmap.c18
-rw-r--r--firmware/target/hosted/sdl/lcd-remote-bitmap.c4
-rw-r--r--firmware/target/hosted/ypr0/lcd-ypr0.c4
-rw-r--r--firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c4
-rw-r--r--firmware/target/sh/archos/lcd-archos-bitmap.c4
64 files changed, 191 insertions, 179 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index 1a845675ad..c9e88b2137 100644
--- a/firmware/drivers/lcd-16bit-common.c
+++ b/firmware/drivers/lcd-16bit-common.c
@@ -35,9 +35,9 @@ enum fill_opt {
};
/*** globals ***/
-fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
+fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
IRAM_LCDFRAMEBUFFER CACHEALIGN_AT_LEAST_ATTR(16);
-
+fb_data *lcd_framebuffer = &lcd_static_framebuffer[0][0];
static fb_data* lcd_backdrop = NULL;
static long lcd_backdrop_offset IDATA_ATTR = 0;
@@ -234,7 +234,7 @@ void lcd_set_backdrop(fb_data* backdrop)
lcd_backdrop = backdrop;
if (backdrop)
{
- lcd_backdrop_offset = (long)backdrop - (long)&lcd_framebuffer[0][0];
+ lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer;
lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop;
}
else
@@ -271,7 +271,7 @@ void lcd_drawpixel(int x, int y)
&& ((unsigned)y < (unsigned)LCD_HEIGHT)
#endif
)
- lcd_fastpixelfuncs[current_vp->drawmode](LCDADDR(current_vp->x+x, current_vp->y+y));
+ lcd_fastpixelfuncs[current_vp->drawmode](FBADDR(current_vp->x+x, current_vp->y+y));
}
/* Draw a line */
@@ -346,7 +346,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
&& ((unsigned)y < (unsigned)LCD_HEIGHT)
#endif
)
- pfunc(LCDADDR(x + current_vp->x, y + current_vp->y));
+ pfunc(FBADDR(x + current_vp->x, y + current_vp->y));
if (d < 0)
{
@@ -459,7 +459,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
src_end = src + width;
- dst_col = LCDADDR(x, y);
+ dst_col = FBADDR(x, y);
if (drmode & DRMODE_INVERSEVID)
@@ -747,7 +747,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
dmask = ~dmask;
}
- dst_row = LCDADDR(x, y);
+ dst_row = FBADDR(x, y);
int col, row = height;
unsigned data, pixels;
@@ -1020,10 +1020,10 @@ void lcd_blit_yuv(unsigned char * const src[3],
linecounter = height >> 1;
#if LCD_WIDTH >= LCD_HEIGHT
- dst = &lcd_framebuffer[y][x];
+ dst = FBADDR(x, y);
row_end = dst + width;
#else
- dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1];
+ dst = FBADDR(LCD_WIDTH - y - 1, x);
row_end = dst + LCD_WIDTH * width;
#endif
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
index f020d74757..6f59af9f70 100644
--- a/firmware/drivers/lcd-16bit-vert.c
+++ b/firmware/drivers/lcd-16bit-vert.c
@@ -41,10 +41,7 @@
#define ROW_INC 1
#define COL_INC LCD_HEIGHT
-#define LCDADDR(x, y) (&lcd_framebuffer[0][0] + LCD_HEIGHT*(x) + (y))
-
#include "lcd-16bit-common.c"
-
#include "lcd-bitmap-common.c"
/*** drawing functions ***/
@@ -54,7 +51,7 @@ void lcd_clear_viewport(void)
{
fb_data *dst, *dst_end;
- dst = LCDADDR(current_vp->x, current_vp->y);
+ dst = FBADDR(current_vp->x, current_vp->y);
dst_end = dst + current_vp->width * LCD_HEIGHT;
if (current_vp->drawmode & DRMODE_INVERSEVID)
@@ -145,7 +142,7 @@ void lcd_hline(int x1, int x2, int y)
x2 = LCD_WIDTH-1;
#endif
- dst = LCDADDR(x1 , y );
+ dst = FBADDR(x1 , y );
dst_end = dst + (x2 - x1) * LCD_HEIGHT;
do
@@ -230,7 +227,7 @@ void lcd_vline(int x, int y1, int y2)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
- dst = LCDADDR(x, y1);
+ dst = FBADDR(x, y1);
switch (fillopt)
{
@@ -333,7 +330,7 @@ void lcd_fillrect(int x, int y, int width, int height)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
dst_end = dst + width * LCD_HEIGHT;
do
@@ -426,7 +423,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
#endif
src += stride * src_x + src_y; /* move starting point */
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
fb_data *dst_end = dst + width * LCD_HEIGHT;
do
@@ -500,7 +497,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
#endif
src += stride * src_x + src_y; /* move starting point */
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
dst_end = dst + width * LCD_HEIGHT;
do
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index f7d3cf22d4..71768b6744 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -41,10 +41,7 @@
#define ROW_INC LCD_WIDTH
#define COL_INC 1
-#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
-
#include "lcd-16bit-common.c"
-
#include "lcd-bitmap-common.c"
/*** drawing functions ***/
@@ -54,7 +51,7 @@ void lcd_clear_viewport(void)
{
fb_data *dst, *dst_end;
- dst = LCDADDR(current_vp->x, current_vp->y);
+ dst = FBADDR(current_vp->x, current_vp->y);
dst_end = dst + current_vp->height * LCD_WIDTH;
if (current_vp->drawmode & DRMODE_INVERSEVID)
@@ -173,7 +170,7 @@ void lcd_hline(int x1, int x2, int y)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
- dst = LCDADDR(x1, y);
+ dst = FBADDR(x1, y);
switch (fillopt)
{
@@ -241,7 +238,7 @@ void lcd_vline(int x, int y1, int y2)
y2 = LCD_HEIGHT-1;
#endif
- dst = LCDADDR(x , y1);
+ dst = FBADDR(x , y1);
dst_end = dst + (y2 - y1) * LCD_WIDTH;
do
@@ -333,7 +330,7 @@ void lcd_fillrect(int x, int y, int width, int height)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
dst_end = dst + height * LCD_WIDTH;
do
@@ -426,7 +423,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
#endif
src += stride * src_y + src_x; /* move starting point */
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
do
{
@@ -500,7 +497,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
#endif
src += stride * src_y + src_x; /* move starting point */
- dst = LCDADDR(x, y);
+ dst = FBADDR(x, y);
#ifdef CPU_ARM
{
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index fd77ba7578..3a90856819 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -37,14 +37,16 @@
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
#define LCDFN(fn) lcd_ ## fn
#define FBFN(fn) fb_ ## fn
+#define FBSIZE FRAMEBUFFER_SIZE
#define LCDM(ma) LCD_ ## ma
#define LCDNAME "lcd_"
+#define LCDFB(x,y) FBADDR(x, y)
#define MAIN_LCD
#endif
/*** globals ***/
-
-FBFN(data) LCDFN(framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
+FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
+FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
static struct viewport default_vp =
{
@@ -152,17 +154,17 @@ int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
- LCDFN(framebuffer)[y>>3][x] |= BIT_N(y & 7);
+ *LCDFB(x,y>>3) |= BIT_N(y & 7);
}
static void clearpixel(int x, int y)
{
- LCDFN(framebuffer)[y>>3][x] &= ~BIT_N(y & 7);
+ *LCDFB(x,y>>3) &= ~BIT_N(y & 7);
}
static void flippixel(int x, int y)
{
- LCDFN(framebuffer)[y>>3][x] ^= BIT_N(y & 7);
+ *LCDFB(x,y>>3) ^= BIT_N(y & 7);
}
static void nopixel(int x, int y)
@@ -242,7 +244,7 @@ void LCDFN(clear_display)(void)
{
unsigned bits = (current_vp->drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
- memset(LCDFN(framebuffer), bits, sizeof LCDFN(framebuffer));
+ memset(LCDFN(framebuffer), bits, FBSIZE);
LCDFN(scroll_info).lines = 0;
}
@@ -422,7 +424,7 @@ void LCDFN(hline)(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y>>3][x1];
+ dst = LCDFB(x1,y>>3);
mask = BIT_N(y & 7);
dst_end = dst + width;
@@ -478,7 +480,7 @@ void LCDFN(vline)(int x, int y1, int y2)
#endif
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y1>>3][x];
+ dst = LCDFB(x,y1>>3);
ny = y2 - (y1 & ~7);
mask = 0xFFu << (y1 & 7);
mask_bottom = 0xFFu >> (~ny & 7);
@@ -583,7 +585,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
}
}
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y>>3][x];
+ dst = LCDFB(x,y>>3);
ny = height - 1 + (y & 7);
mask = 0xFFu << (y & 7);
mask_bottom = 0xFFu >> (~ny & 7);
@@ -696,7 +698,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
- dst = &LCDFN(framebuffer)[y>>3][x];
+ dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index b4805094ff..3870bac644 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -39,7 +39,8 @@
/*** globals ***/
-unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
+unsigned char lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
+unsigned char *lcd_framebuffer = &lcd_static_framebuffer[0][0];
static const unsigned char pixmask[4] ICONST_ATTR = {
0xC0, 0x30, 0x0C, 0x03
@@ -193,7 +194,7 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
- fb_data *address = &lcd_framebuffer[y][x>>2];
+ fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@@ -202,7 +203,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
- fb_data *address = &lcd_framebuffer[y][x>>2];
+ fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@@ -211,7 +212,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
- fb_data *address = &lcd_framebuffer[y][x>>2];
+ fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
@@ -220,7 +221,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
- fb_data *address = &lcd_framebuffer[y][x>>2];
+ fb_data *address = FBADDR(x>>2,y);
*address ^= mask;
}
@@ -396,14 +397,14 @@ void lcd_clear_display(void)
{
if (current_vp->drawmode & DRMODE_INVERSEVID)
{
- memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
+ memset(lcd_framebuffer, fg_pattern, FRAMEBUFFER_SIZE);
}
else
{
if (lcd_backdrop)
- memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
+ memcpy(lcd_framebuffer, lcd_backdrop, FRAMEBUFFER_SIZE);
else
- memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
+ memset(lcd_framebuffer, bg_pattern, FRAMEBUFFER_SIZE);
}
lcd_scroll_info.lines = 0;
@@ -583,7 +584,7 @@ void lcd_hline(int x1, int x2, int y)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y][x1>>2];
+ dst = FBADDR(x1>>2,y);
nx = x2 - (x1 & ~3);
mask = 0xFFu >> (2 * (x1 & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
@@ -644,7 +645,7 @@ void lcd_vline(int x, int y1, int y2)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y1][x>>2];
+ dst = FBADDR(x>>2,y1);
mask = pixmask[x & 3];
dst_end = dst + (y2 - y1) * LCD_FBWIDTH;
@@ -729,7 +730,7 @@ void lcd_fillrect(int x, int y, int width, int height)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y][x>>2];
+ dst = FBADDR(x>>2,y);
nx = width - 1 + (x & 3);
mask = 0xFFu >> (2 * (x & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
@@ -836,7 +837,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src_y &= 7;
src_end = src + width;
- dst = &lcd_framebuffer[y][x >> 2];
+ dst = FBADDR(x >> 2,y);
dst_end = dst + height * LCD_FBWIDTH;
dst_mask = pixmask[x & 3];
@@ -1050,7 +1051,7 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
src += stride * src_y + (src_x >> 2); /* move starting point */
src_x &= 3;
x -= src_x;
- dst = &lcd_framebuffer[y][x>>2];
+ dst = FBADDR(x>>2,y);
shift = x & 3;
nx = width - 1 + shift + src_x;
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index 02699099d7..89c2dc365b 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -36,7 +36,8 @@
/*** globals ***/
-fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
+fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
+fb_data *lcd_framebuffer = &lcd_static_framebuffer[0][0];
const unsigned char lcd_dibits[16] ICONST_ATTR = {
0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
@@ -196,7 +197,7 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
- fb_data *address = &lcd_framebuffer[y>>2][x];
+ fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@@ -205,7 +206,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
- fb_data *address = &lcd_framebuffer[y>>2][x];
+ fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@@ -214,7 +215,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
- fb_data *address = &lcd_framebuffer[y>>2][x];
+ fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
@@ -223,7 +224,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
- fb_data *address = &lcd_framebuffer[y>>2][x];
+ fb_data *address = FBADDR(x,y>>2);
*address ^= mask;
}
@@ -399,14 +400,14 @@ void lcd_clear_display(void)
{
if (current_vp->drawmode & DRMODE_INVERSEVID)
{
- memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
+ memset(lcd_framebuffer, fg_pattern, FRAMEBUFFER_SIZE);
}
else
{
if (lcd_backdrop)
- memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
+ memcpy(lcd_framebuffer, lcd_backdrop, FRAMEBUFFER_SIZE);
else
- memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
+ memset(lcd_framebuffer, bg_pattern, FRAMEBUFFER_SIZE);
}
lcd_scroll_info.lines = 0;
@@ -589,7 +590,7 @@ void lcd_hline(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y>>2][x1];
+ dst = FBADDR(x1,y>>2);
mask = pixmask[y & 3];
dst_end = dst + width;
@@ -645,7 +646,7 @@ void lcd_vline(int x, int y1, int y2)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y1>>2][x];
+ dst = FBADDR(x,y1>>2);
ny = y2 - (y1 & ~3);
mask = 0xFFu << (2 * (y1 & 3));
mask_bottom = 0xFFu >> (2 * (~ny & 3));
@@ -751,7 +752,7 @@ void lcd_fillrect(int x, int y, int width, int height)
}
}
bfunc = lcd_blockfuncs[current_vp->drawmode];
- dst = &lcd_framebuffer[y>>2][x];
+ dst = FBADDR(x,y>>2);
ny = height - 1 + (y & 3);
mask = 0xFFu << (2 * (y & 3));
mask_bottom = 0xFFu >> (2 * (~ny & 3));
@@ -863,7 +864,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
- dst = &lcd_framebuffer[y>>2][x];
+ dst = FBADDR(x,y>>2);
shift = y & 3;
ny = height - 1 + shift + src_y;
mask = 0xFFFFu << (2 * (shift + src_y));
@@ -1060,7 +1061,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src += stride * (src_y >> 2) + src_x; /* move starting point */
src_y &= 3;
y -= src_y;
- dst = &lcd_framebuffer[y>>2][x];
+ dst = FBADDR(x,y>>2);
shift = y & 3;
ny = height - 1 + shift + src_y;
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c
index 697d1a7783..8dc746f521 100644
--- a/firmware/drivers/lcd-2bit-vi.c
+++ b/firmware/drivers/lcd-2bit-vi.c
@@ -40,13 +40,17 @@
#define LCDFN(fn) lcd_ ## fn
#define FBFN(fn) fb_ ## fn
#define LCDM(ma) LCD_ ## ma
+#define FBSIZE FRAMEBUFFER_SIZE
#define LCDNAME "lcd_"
+#define LCDFB(x,y) FBADDR(x, y)
#define MAIN_LCD
#endif
/*** globals ***/
-FBFN(data) LCDFN(framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
+FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
+FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
+
static const FBFN(data) patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
@@ -214,7 +218,7 @@ int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
- FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
+ FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@@ -223,7 +227,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
- FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
+ FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@@ -232,7 +236,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
- FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
+ FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ *(FBFN(data) *)((long)address
@@ -242,7 +246,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
- FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
+ FBFN(data) *address = LCDFB(x,y>>3);
*address ^= mask;
}
@@ -420,15 +424,15 @@ void LCDFN(clear_display)(void)
if (default_vp.drawmode & DRMODE_INVERSEVID)
{
memset(LCDFN(framebuffer), patterns[default_vp.fg_pattern & 3],
- sizeof LCDFN(framebuffer));
+ FBSIZE);
}
else
{
if (backdrop)
- memcpy(LCDFN(framebuffer), backdrop, sizeof LCDFN(framebuffer));
+ memcpy(LCDFN(framebuffer), backdrop, FBSIZE);
else
memset(LCDFN(framebuffer), patterns[default_vp.bg_pattern & 3],
- sizeof LCDFN(framebuffer));
+ FBSIZE);
}
LCDFN(scroll_info).lines = 0;
@@ -611,7 +615,7 @@ void LCDFN(hline)(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y>>3][x1];
+ dst = LCDFB(x1,y>>3);
mask = 0x0101 << (y & 7);
dst_end = dst + width;
@@ -667,7 +671,7 @@ void LCDFN(vline)(int x, int y1, int y2)
#endif
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y1>>3][x];
+ dst = LCDFB(x,y1>>3);
ny = y2 - (y1 & ~7);
mask = (0xFFu << (y1 & 7)) & 0xFFu;
mask |= mask << 8;
@@ -776,7 +780,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
}
}
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
- dst = &LCDFN(framebuffer)[y>>3][x];
+ dst = LCDFB(x,y>>3);
ny = height - 1 + (y & 7);
mask = (0xFFu << (y & 7)) & 0xFFu;
mask |= mask << 8;
@@ -890,7 +894,7 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
- dst = &LCDFN(framebuffer)[y>>3][x];
+ dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;
@@ -1058,7 +1062,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
- dst = &LCDFN(framebuffer)[y>>3][x];
+ dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;
diff --git a/firmware/drivers/lcd-memframe.c b/firmware/drivers/lcd-memframe.c
index dd878876bf..bb1682b074 100644
--- a/firmware/drivers/lcd-memframe.c
+++ b/firmware/drivers/lcd-memframe.c
@@ -66,7 +66,7 @@ void lcd_update(void)
return;
/* Copy the Rockbox framebuffer to the second framebuffer */
- lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), &lcd_framebuffer[0][0],
+ lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0),
LCD_WIDTH*LCD_HEIGHT, 1);
}
#endif /* LCD_OPTIMIZED_UPDATE */
@@ -95,7 +95,7 @@ void lcd_update_rect(int x, int y, int width, int height)
return; /* nothing left to do */
dst = LCD_FRAMEBUF_ADDR(x, y);
- src = &lcd_framebuffer[y][x];
+ src = FBADDR(x,y);
/* Copy part of the Rockbox framebuffer to the second framebuffer */
if (width < LCD_WIDTH)
diff --git a/firmware/drivers/lcd-remote-1bit-v.c b/firmware/drivers/lcd-remote-1bit-v.c
index f2588323e7..24b91509c7 100644
--- a/firmware/drivers/lcd-remote-1bit-v.c
+++ b/firmware/drivers/lcd-remote-1bit-v.c
@@ -24,7 +24,9 @@
/* Compile 1 bit vertical packing LCD driver for remote LCD */
#define LCDFN(fn) lcd_remote_ ## fn
#define FBFN(fn) fb_remote_ ## fn
+#define FBSIZE FRAMEBUFFER_REMOTE_SIZE
#define LCDM(ma) LCD_REMOTE_ ## ma
+#define LCDFB(x,y) FBREMOTEADDR(x, y)
#define LCDNAME "lcd_remote_"
#include "lcd-1bit-vert.c"
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c
index 34af8dde6f..fd4de6f6af 100644
--- a/firmware/drivers/lcd-remote-2bit-vi.c
+++ b/firmware/drivers/lcd-remote-2bit-vi.c
@@ -26,7 +26,9 @@
/* Compile 2 bit vertical interleaved LCD driver for remote LCD */
#define LCDFN(fn) lcd_remote_ ## fn
#define FBFN(fn) fb_remote_ ## fn
+#define FBSIZE FRAMEBUFFER_REMOTE_SIZE
#define LCDM(ma) LCD_REMOTE_ ## ma
+#define LCDFB(x,y) FBREMOTEADDR(x, y)
#define LCDNAME "lcd_remote_"
#include "lcd-2bit-vi.c"
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 2a48b6fc34..0f5f7ed6b7 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -96,7 +96,10 @@ extern unsigned lcd_remote_color_to_native(unsigned color);
#endif
/* The actual framebuffer */
-extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
+extern fb_remote_data *lcd_remote_framebuffer;
+extern fb_remote_data lcd_remote_static_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
+#define FBREMOTEADDR(x, y) (lcd_remote_framebuffer + ((y) * LCD_REMOTE_FBWIDTH) + (x))
+#define FRAMEBUFFER_REMOTE_SIZE (sizeof(lcd_remote_static_framebuffer))
#if LCD_REMOTE_DEPTH > 1
extern void lcd_remote_set_foreground(unsigned foreground);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 2d0123cfe3..052b368d9b 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -413,7 +413,14 @@ static inline unsigned lcd_color_to_native(unsigned color)
#define LCD_FBHEIGHT LCD_HEIGHT
#endif
/* The actual framebuffer */
-extern fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
+extern fb_data *lcd_framebuffer;
+extern fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
+#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
+#define FBADDR(x, y) (lcd_framebuffer + ((x) * LCD_FBHEIGHT) + (y))
+#else
+#define FBADDR(x, y) (lcd_framebuffer + ((y) * LCD_FBWIDTH) + (x))
+#endif
+#define FRAMEBUFFER_SIZE (sizeof(lcd_static_framebuffer))
/** Port-specific functions. Enable in port config file. **/
#ifdef HAVE_REMOTE_LCD_AS_MAIN
diff --git a/firmware/screendump.c b/firmware/screendump.c
index 4b431d5958..0dfe79a69f 100644
--- a/firmware/screendump.c
+++ b/firmware/screendump.c
@@ -154,7 +154,7 @@ void screen_dump(void)
#if LCD_DEPTH == 1
dst_end = dst + LCD_WIDTH/2;
- src = lcd_framebuffer[y >> 3];
+ src = FBADDR(0, y >> 3);
mask = BIT_N(y & 7);
do
@@ -173,7 +173,7 @@ void screen_dump(void)
dst_end = dst + LCD_WIDTH/2;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
- src = lcd_framebuffer[y];
+ src = FBADDR(0, y);
do
{
@@ -185,7 +185,7 @@ void screen_dump(void)
while (dst < dst_end);
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
- src = lcd_framebuffer[y >> 2];
+ src = FBADDR(0, y >> 2);
shift = 2 * (y & 3);
do
@@ -197,7 +197,7 @@ void screen_dump(void)
while (dst < dst_end);
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
- src = lcd_framebuffer[y >> 3];
+ src = FBADDR(0, y >> 3);
shift = y & 7;
do
@@ -214,7 +214,7 @@ void screen_dump(void)
#endif
#elif LCD_DEPTH == 16
dst_end = dst + LCD_WIDTH;
- src = lcd_framebuffer[y];
+ src = FBADDR(0, y);
do
{
@@ -318,7 +318,7 @@ void remote_screen_dump(void)
#if LCD_REMOTE_DEPTH == 1
dst_end = dst + LCD_REMOTE_WIDTH/2;
- src = lcd_remote_framebuffer[y >> 3];
+ src = FBREMOTEADDR(0, y >> 3);
mask = BIT_N(y & 7);
do
@@ -333,7 +333,7 @@ void remote_screen_dump(void)
dst_end = dst + LCD_REMOTE_WIDTH/2;
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
- src = lcd_remote_framebuffer[y >> 3];
+ src = FBREMOTEADDR(0, (y >> 3));
shift = y & 7;
do
diff --git a/firmware/target/arm/as3525/lcd-fuze.c b/firmware/target/arm/as3525/lcd-fuze.c
index 2acc7b3bf9..b2033738b6 100644
--- a/firmware/target/arm/as3525/lcd-fuze.c
+++ b/firmware/target/arm/as3525/lcd-fuze.c
@@ -332,7 +332,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
- ptr = &lcd_framebuffer[y][x];
+ ptr = FBADDR(x,y);
do
{
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c
index 213f12a424..9fcc85d243 100644
--- a/firmware/target/arm/as3525/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/lcd-ssd1303.c
@@ -273,7 +273,7 @@ void lcd_update(void)
lcd_write_command (LCD_CNTL_HIGHCOL | ((offset >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | (offset & 0xf));
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -304,6 +304,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset) >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf));
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
index 3952171e7e..7673b529cc 100644
--- a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
+++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
@@ -426,7 +426,7 @@ void lcd_update_rect(int x, int y, int width, int height)
/* write to GRAM */
for (row = y; row < y_end; row++) {
- lcd_write_data(&lcd_framebuffer[row][x], width);
+ lcd_write_data(FBADDR(x,row), width);
}
}
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index f875b40c05..2c80f89ff7 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -488,7 +488,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_window(x, y, x+width-1, y+height-1);
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
- ptr = &lcd_framebuffer[y][x];
+ ptr = FBADDR(x,y);
do
{
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
index c2e80ad1fc..b25fff8c3b 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c
@@ -533,12 +533,12 @@ void lcd_update_rect(int x, int y, int w, int h)
*/
if(w == LCD_WIDTH)
{
- memcpy((void *)FRAME, &lcd_framebuffer[y][x], w * h * sizeof(fb_data));
+ memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
}
else
{
for(int i = 0; i < h; i++)
- memcpy((fb_data *)FRAME + i * w, &lcd_framebuffer[y + i][x], w * sizeof(fb_data));
+ memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
}
/* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
* (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
@@ -599,10 +599,10 @@ void lcd_blit_yuv(unsigned char * const src[3],
linecounter = height >> 1;
#if LCD_WIDTH >= LCD_HEIGHT
- dst = &lcd_framebuffer[y][x];
+ dst = FBADDR(x,y);
row_end = dst + width;
#else
- dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1];
+ dst = FBADDR(LCD_WIDTH - y - 1,x);
row_end = dst + LCD_WIDTH * width;
#endif
diff --git a/firmware/target/arm/ipod/lcd-color_nano.c b/firmware/target/arm/ipod/lcd-color_nano.c
index 589e8654ae..c7676fa721 100644
--- a/firmware/target/arm/ipod/lcd-color_nano.c
+++ b/firmware/target/arm/ipod/lcd-color_nano.c
@@ -280,7 +280,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_setup_drawing_region(x, y, width, height);
- addr = (unsigned long*)&lcd_framebuffer[y][x];
+ addr = (unsigned long*)FBADDR(x, y);
while (height > 0) {
int r, h, pixels_to_write;
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c
index 11d4cba2f5..d8695cdb10 100644
--- a/firmware/target/arm/ipod/lcd-gray.c
+++ b/firmware/target/arm/ipod/lcd-gray.c
@@ -340,10 +340,10 @@ void lcd_update_rect(int x, int y, int width, int height)
#if defined(IPOD_MINI) || defined(IPOD_MINI2G)
if (pix_offset == -2)
- lcd_write_data_shifted(&lcd_framebuffer[y][2*x], width);
+ lcd_write_data_shifted(FBADDR(2*x, y), width);
else
#endif
- lcd_write_data(&lcd_framebuffer[y][2*x], width);
+ lcd_write_data(FBADDR(2*x, y), width);
}
}
diff --git a/firmware/target/arm/ipod/video/lcd-video.c b/firmware/target/arm/ipod/video/lcd-video.c
index c499e9f745..27d889aafa 100644
--- a/firmware/target/arm/ipod/video/lcd-video.c
+++ b/firmware/target/arm/ipod/video/lcd-video.c
@@ -410,7 +410,7 @@ void lcd_update_rect(int x, int y, int width, int height)
/* Prevent the tick from triggering BCM updates while we're writing. */
lcd_block_tick();
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x, y);
bcmaddr = BCMA_CMDPARAM + (LCD_WIDTH*2) * y + (x << 1);
if (width == LCD_WIDTH)
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
index df748a74fb..c7e339295d 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
@@ -527,7 +527,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
- addr = (unsigned short*)&lcd_framebuffer[y0][x0];
+ addr = (unsigned short*)FBADDR(x0,y0);
int c, r;
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_5gb.c b/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
index ce57af14d5..5e1ad9ce23 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
@@ -327,7 +327,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
- addr = (unsigned long*)&lcd_framebuffer[y0][x0];
+ addr = (unsigned long*)FBADDR(x0,y0);
while (height > 0) {
int c, r;
diff --git a/firmware/target/arm/lcd-c200_c200v2.c b/firmware/target/arm/lcd-c200_c200v2.c
index f82f8a809e..38877ccac9 100644
--- a/firmware/target/arm/lcd-c200_c200v2.c
+++ b/firmware/target/arm/lcd-c200_c200v2.c
@@ -395,7 +395,7 @@ void lcd_update_rect(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0))
return; /* Nothing left to do. */
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
if (width <= 1) {
/* The X end address must be larger than the X start address, so we
diff --git a/firmware/target/arm/lcd-ssd1815.c b/firmware/target/arm/lcd-ssd1815.c
index 35d8cf2275..891d4ef64d 100644
--- a/firmware/target/arm/lcd-ssd1815.c
+++ b/firmware/target/arm/lcd-ssd1815.c
@@ -303,7 +303,7 @@ void lcd_update(void)
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf));
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -331,6 +331,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
index a0ea2a6aab..d336ad7419 100644
--- a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
@@ -239,7 +239,7 @@ void lcd_update(void)
lcd_write_command(cmd1);
lcd_write_command(cmd2);
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -271,6 +271,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command(cmd1);
lcd_write_command(cmd2);
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-remote-mr100.c b/firmware/target/arm/olympus/mrobe-100/lcd-remote-mr100.c
index aa3d228952..edcdde7253 100644
--- a/firmware/target/arm/olympus/mrobe-100/lcd-remote-mr100.c
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-remote-mr100.c
@@ -255,7 +255,7 @@ static void remote_update_lcd(void)
data[6] = (y + 1) << 3; /* y2 */
for (x = 0; x < RC_WIDTH; x++)
- data[x + 7] = lcd_remote_framebuffer[y][x];
+ data[x + 7] = FBREMOTEADDR(x,y);
remote_tx(data, RC_WIDTH + 7);
diff --git a/firmware/target/arm/pbell/vibe500/lcd-vibe500.c b/firmware/target/arm/pbell/vibe500/lcd-vibe500.c
index 4cb073db7b..4dd2ec1206 100644
--- a/firmware/target/arm/pbell/vibe500/lcd-vibe500.c
+++ b/firmware/target/arm/pbell/vibe500/lcd-vibe500.c
@@ -483,7 +483,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
- addr = &lcd_framebuffer[y0][x0];
+ addr = FBADDR(x0, y0)
int c, r;
for (r = 0; r < height; r++)
diff --git a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
index 500120a432..28bef09463 100644
--- a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
@@ -373,7 +373,7 @@ void lcd_update_rect(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0))
return; /* Nothing left to do. */
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
lcd_send_cmd(CASET);
lcd_send_data(x);
diff --git a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
index 328c270b5e..cdd3064bba 100644
--- a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
+++ b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
@@ -285,7 +285,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM);
- addr = (unsigned long*)&lcd_framebuffer[y][x];
+ addr = (unsigned long*)FBADDR(x,y);
while (height > 0)
{
diff --git a/firmware/target/arm/philips/sa9200/lcd-sa9200.c b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
index 3db308ed09..e30a298045 100644
--- a/firmware/target/arm/philips/sa9200/lcd-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
@@ -495,8 +495,8 @@ void lcd_update(void)
if (!display_on)
return;
- addr = &lcd_framebuffer[0][0];
- end = &lcd_framebuffer[LCD_HEIGHT - 1][LCD_WIDTH];
+ addr = FBADDR(0,0);
+ end = FBADDR(LCD_WIDTH,LCD_HEIGHT - 1);
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH - 1) << 8);
lcd_write_reg(R_VERT_RAM_ADDR_POS, (LCD_HEIGHT - 1) << 8);
@@ -533,7 +533,7 @@ void lcd_update_rect(int x, int y, int width, int height)
if (height <= 0)
return; /* Nothing left to do. */
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((x + width - 1) << 8) | x);
lcd_write_reg(R_VERT_RAM_ADDR_POS, ((y + height - 1) << 8) | y);
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c b/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c
index c71e8fd6fb..1ad604d50c 100644
--- a/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c
+++ b/firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c
@@ -191,7 +191,7 @@ void lcd_update(void)
lcd_write_command (LCD_CNTL_HIGHCOL);
lcd_write_command (LCD_CNTL_LOWCOL | 4);
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -219,6 +219,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+4) >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+4) & 0xf));
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
index 91e55894e5..21ca321d1f 100644
--- a/firmware/target/arm/rk27xx/lcd-hifiman.c
+++ b/firmware/target/arm/rk27xx/lcd-hifiman.c
@@ -162,7 +162,7 @@ void lcd_update_rect(int x, int y, int width, int height)
for (px=x; px<pxmax; px++)
for (py=y; py<pymax; py++)
- lcd_data(lcd_framebuffer[py][px]);
+ lcd_data(FBADDR(px, py));
}
/* Blit a YUV bitmap directly to the LCD */
diff --git a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
index b184630ebe..6b989a6dd7 100644
--- a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
+++ b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
@@ -191,7 +191,7 @@ void lcd_update_rect(int x, int y, int width, int height)
for (py=y; py<pymax; py++)
{
for (px=x; px<pxmax; px++)
- LCD_DATA = lcd_pixel_transform(lcd_framebuffer[py][px]);
+ LCD_DATA = lcd_pixel_transform(FBADDR(px,py));
}
}
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
index 6434469881..13e5c5c1d4 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
@@ -394,7 +394,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_setup_drawing_region(x, y, width, height);
/* Copy display bitmap to hardware */
- p = &lcd_framebuffer[y][x];
+ p = FBADDR(x,y);
if (LCD_WIDTH == width) {
/* Write all lines at once */
lcd_write_line(p, height*LCD_WIDTH, LCD_BASE);
diff --git a/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c b/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c
index 3420e92d62..5ed6c752b7 100644
--- a/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c
+++ b/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c
@@ -295,7 +295,7 @@ void lcd_update(void)
LCD_WCMD = 0;
LCD_WCMD = 0x22;
}
- for(p=&lcd_framebuffer[0][0], i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) {
+ for(p=FBADDR(0,0), i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) {
while (LCD_STATUS & STAT_FULL);
LCD_WDATA = RGB_UNPACK_RED(*p);
while (LCD_STATUS & STAT_FULL);
diff --git a/firmware/target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c b/firmware/target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c
index 6ab5c08a50..5e722d5a87 100644
--- a/firmware/target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c
+++ b/firmware/target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c
@@ -438,8 +438,8 @@ void lcd_init_device(void)
lcd_controller_init();
/* set framebuffer addresses */
- fb = (uint32_t) &lcd_framebuffer[0][0];
- fb_end = (uint32_t) &lcd_framebuffer[LCD_HEIGHT][0];
+ fb = (uint32_t) FBADDR(0,0);
+ fb_end = (uint32_t) FBADDR(0,LCD_HEIGHT);
window = 2 * LCD_WIDTH;
LCDB1SADDR1 = fb;
diff --git a/firmware/target/arm/s5l8700/yps3/lcd-yps3.c b/firmware/target/arm/s5l8700/yps3/lcd-yps3.c
index 3b57a50ec0..a9830bca57 100644
--- a/firmware/target/arm/s5l8700/yps3/lcd-yps3.c
+++ b/firmware/target/arm/s5l8700/yps3/lcd-yps3.c
@@ -306,7 +306,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_set_position1(x, y);
for (h = 0; h < height; h++) {
- p = &lcd_framebuffer[y][0];
+ p = FBADDR(0,y);
for (w = 0; w < LCD_WIDTH; w++) {
while (LCD_STATUS & 0x10);
LCD_WDATA = *p++;
@@ -319,7 +319,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_set_position2(x, y);
for (h = 0; h < height; h++) {
- p = &lcd_framebuffer[y][x];
+ p = FBADDR(x,y);
for (w = 0; w < width; w++) {
while (LCD_STATUS & 0x10);
LCD_WDATA = *p++;
diff --git a/firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c
index 84443551b9..f9dbab6180 100644
--- a/firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c
@@ -428,7 +428,7 @@ void lcd_update_rect(int, int, int, int) ICODE_ATTR;
void lcd_update_rect(int x, int y, int width, int height)
{
int pixels = width * height;
- fb_data* p = &lcd_framebuffer[y][x];
+ fb_data* p = FBADDR(x,y);
uint16_t* out = lcd_dblbuf[0];
#ifdef HAVE_LCD_SLEEP
diff --git a/firmware/target/arm/samsung/yh820/lcd-yh820.c b/firmware/target/arm/samsung/yh820/lcd-yh820.c
index 4773e27185..10934621d7 100644
--- a/firmware/target/arm/samsung/yh820/lcd-yh820.c
+++ b/firmware/target/arm/samsung/yh820/lcd-yh820.c
@@ -347,7 +347,7 @@ void lcd_update_rect(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0))
return; /* Nothing left to do. */
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
if (width <= 1) {
lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
diff --git a/firmware/target/arm/samsung/yh920/lcd-yh920.c b/firmware/target/arm/samsung/yh920/lcd-yh920.c
index d24396050a..5563c13f53 100644
--- a/firmware/target/arm/samsung/yh920/lcd-yh920.c
+++ b/firmware/target/arm/samsung/yh920/lcd-yh920.c
@@ -259,7 +259,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_reg(LCD_CNTL_PAGE, y);
lcd_write_reg(LCD_CNTL_COLUMN, x);
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
lcd_send_cmd(LCD_CNTL_DATA_WRITE);
lcd_write_data(addr, width);
diff --git a/firmware/target/arm/samsung/yh925/lcd-yh925.c b/firmware/target/arm/samsung/yh925/lcd-yh925.c
index ceed443654..93bfb3a5f2 100644
--- a/firmware/target/arm/samsung/yh925/lcd-yh925.c
+++ b/firmware/target/arm/samsung/yh925/lcd-yh925.c
@@ -639,7 +639,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
- addr = (unsigned short*)&lcd_framebuffer[y0][x0];
+ addr = (unsigned short*)FBADDR(x0,y0);
int c, r;
diff --git a/firmware/target/arm/sandisk/sansa-view/lcd-view.c b/firmware/target/arm/sandisk/sansa-view/lcd-view.c
index 99c972704d..cc67e838f9 100644
--- a/firmware/target/arm/sandisk/sansa-view/lcd-view.c
+++ b/firmware/target/arm/sandisk/sansa-view/lcd-view.c
@@ -363,7 +363,7 @@ void lcd_update(void)
{
const fb_data *addr;
- addr = &lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
+ addr = FBADDR(LCD_WIDTH,LCD_HEIGHT);
lcd_write_reg(0x20, 0x0);
lcd_write_reg(0x21, 0x0);
diff --git a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
index 4abd17741b..c53aadaf30 100644
--- a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
+++ b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
@@ -252,7 +252,7 @@ void lcd_update_rect(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0))
return; /* Nothing left to do. */
- addr = &lcd_framebuffer[y][x];
+ addr = FBADDR(x,y);
if (width <= 1) {
lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
diff --git a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c
index 5d2a2b8194..8b9a9bda83 100644
--- a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c
+++ b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c
@@ -211,7 +211,7 @@ void lcd_update_rect(int sx, int sy, int width, int height)
fb_data c;
unsigned long color;
- c = lcd_framebuffer[y][x];
+ c = FBADDR(x,y);
color =
((c & 0x1f) << 1) | ((c & 0x7e0) << 1) | ((c & 0xf800) <<
2);
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
index 204a99f87c..5f623dc239 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
@@ -380,7 +380,7 @@ void lcd_update_rect(int x, int y, int width, int height)
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
dst = (fb_data *)FRAME + LCD_WIDTH*y + x;
- src = &lcd_framebuffer[y][x];
+ src = FBADDR(x,y);
/* Copy part of the Rockbox framebuffer to the second framebuffer */
if (width < LCD_WIDTH)
@@ -394,7 +394,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1);
}
#else
- src = &lcd_framebuffer[y][x];
+ src = FBADDR(x,y);
register int xc, yc;
register fb_data *start=FRAME + LCD_HEIGHT*(LCD_WIDTH-x-1) + y + 1;
@@ -419,7 +419,7 @@ void lcd_update(void)
if (!lcd_on || direct_fb_access)
return;
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
- lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0],
+ lcd_copy_buffer_rect((fb_data *)FRAME, FBADDR(0,0),
LCD_WIDTH*LCD_HEIGHT, 1);
#else
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index 38631401f9..c3a96a3efd 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -500,12 +500,12 @@ void lcd_update_rect(int x, int y, int width, int height)
if (width < LCD_WIDTH)
{
/* Not full width - do line-by-line */
- lcd_copy_buffer_rect(dst, &lcd_framebuffer[y][x], width, height);
+ lcd_copy_buffer_rect(dst, FBADDR(x,y), width, height);
}
else
{
/* Full width - copy as one line */
- lcd_copy_buffer_rect(dst, &lcd_framebuffer[y][x], LCD_WIDTH*height, 1);
+ lcd_copy_buffer_rect(dst, FBADDR(x,y), LCD_WIDTH*height, 1);
}
#endif
@@ -519,7 +519,7 @@ void lcd_update_rect(int x, int y, int width, int height)
#else
fb_data *src;
fb_data *dst;
- src = &lcd_framebuffer[0][0] + (x*LCD_HEIGHT + y);
+ src = FBADDR(0,0) + (x*LCD_HEIGHT + y);
dst = FRAME + (LCD_HEIGHT*(LCD_WIDTH-1) - x * LCD_HEIGHT + y);
while(width > 0) {
@@ -532,7 +532,7 @@ void lcd_update_rect(int x, int y, int width, int height)
#else
register fb_data *dst, *src;
- src = &lcd_framebuffer[y][x];
+ src = FBADDR(x,y);
dst=FRAME + (LCD_NATIVE_WIDTH*(LCD_NATIVE_HEIGHT-1))
- LCD_NATIVE_WIDTH*x + y ;
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c
index d8f55ee63d..5b8b2f9437 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-remote-mr500.c
@@ -246,7 +246,7 @@ static void remote_tick(void)
for(i=7; i<remote_payload_size; i++)
{
remote_payload[i]=
- lcd_remote_framebuffer[remote_payload[4]>>3][i+remote_draw_x-7];
+ FBREMOTEADDR(i+remote_draw_x-7, remote_payload[4]>>3);
}
}
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c
index 403ce182be..27eb0b407a 100644
--- a/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c
+++ b/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c
@@ -167,7 +167,7 @@ static void dma_lcd_copy_buffer_rect(int x, int y, int width, int height)
/* Set source and destination addresses */
dst = (char*)(FRAME + LCD_WIDTH*y + x);
- src = (char*)(&lcd_framebuffer[y][x]);
+ src = (char*)(FBADDR(x,y));
/* Flush cache to memory */
commit_dcache();
diff --git a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c
index 88fc6fc563..e84760e197 100644
--- a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c
+++ b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c
@@ -228,7 +228,7 @@ void lcd_remote_update(void)
have to update one page at a time. */
lcd_remote_write_command(LCD_SET_PAGE | (y > 5 ? y + 2 : y));
lcd_remote_write_command_ex(LCD_SET_COLUMN | 0, 0);
- lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH);
+ lcd_remote_write_data(FBREMOTEADDR(0, y), LCD_REMOTE_WIDTH);
}
}
}
@@ -260,7 +260,7 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
lcd_remote_write_command_ex(LCD_SET_COLUMN | ((x >> 4) & 0xf),
x & 0xf);
- lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width);
+ lcd_remote_write_data(FBREMOTEADDR(x,y), width);
}
}
}
diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
index 380789e7f7..1d61daf323 100644
--- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
@@ -265,7 +265,7 @@ void lcd_update(void)
have to update one page at a time. */
lcd_write_command(LCD_SET_PAGE | (y > 5 ? y + 2 : y));
lcd_write_command_e(LCD_SET_COLUMN | 0, 0);
- lcd_write_data(lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data(FBADDR(0, y), LCD_WIDTH);
}
}
}
@@ -295,7 +295,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command(LCD_SET_PAGE | ((y > 5 ? y + 2 : y) & 0xf));
lcd_write_command_e(LCD_SET_COLUMN | ((x >> 4) & 0xf), x & 0xf);
- lcd_write_data(&lcd_framebuffer[y][x], width);
+ lcd_write_data(FBADDR(x,y), width);
}
}
}
diff --git a/firmware/target/coldfire/iaudio/m5/lcd-m5.c b/firmware/target/coldfire/iaudio/m5/lcd-m5.c
index ae8f14bb25..8f022adf96 100644
--- a/firmware/target/coldfire/iaudio/m5/lcd-m5.c
+++ b/firmware/target/coldfire/iaudio/m5/lcd-m5.c
@@ -207,7 +207,7 @@ void lcd_update(void)
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -235,6 +235,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 19b0725ce4..cf6e301c16 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -530,7 +530,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_begin_write_gram();
- ptr = (unsigned short *)&lcd_framebuffer[y][x];
+ ptr = (unsigned short *)FBADDR(x,y);
do
{
diff --git a/firmware/target/coldfire/iriver/h100/lcd-h100.c b/firmware/target/coldfire/iriver/h100/lcd-h100.c
index ae77affd18..b13751b9eb 100644
--- a/firmware/target/coldfire/iriver/h100/lcd-h100.c
+++ b/firmware/target/coldfire/iriver/h100/lcd-h100.c
@@ -216,7 +216,7 @@ void lcd_update(void)
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -244,6 +244,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/coldfire/iriver/h300/lcd-h300.c b/firmware/target/coldfire/iriver/h300/lcd-h300.c
index 6c21a7e260..191c769c97 100644
--- a/firmware/target/coldfire/iriver/h300/lcd-h300.c
+++ b/firmware/target/coldfire/iriver/h300/lcd-h300.c
@@ -447,13 +447,13 @@ void lcd_update_rect(int x, int y, int width, int height)
if (width == LCD_WIDTH)
{
dma_count = 1;
- SAR3 = (unsigned long)lcd_framebuffer[y];
+ SAR3 = (unsigned long)FBADDR(0, y);
BCR3 = (LCD_WIDTH*sizeof(fb_data)) * height;
}
else
{
dma_count = height;
- SAR3 = dma_addr = (unsigned long)&lcd_framebuffer[y][x];
+ SAR3 = dma_addr = (unsigned long)FBADDR(x,y);
BCR3 = dma_len = width * sizeof(fb_data);
}
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
diff --git a/firmware/target/coldfire/iriver/lcd-remote-iriver.c b/firmware/target/coldfire/iriver/lcd-remote-iriver.c
index 0ff041f033..03c0e40dbe 100644
--- a/firmware/target/coldfire/iriver/lcd-remote-iriver.c
+++ b/firmware/target/coldfire/iriver/lcd-remote-iriver.c
@@ -312,7 +312,7 @@ void lcd_remote_update(void)
lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y);
lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | (xoffset & 0xf));
- lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH);
+ lcd_remote_write_data(FBREMOTEADDR(0, y), LCD_REMOTE_WIDTH);
}
}
@@ -346,6 +346,6 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y);
lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | ((x+xoffset) & 0xf));
- lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width);
+ lcd_remote_write_data(FBREMOTEADDR(x,y), width);
}
}
diff --git a/firmware/target/coldfire/mpio/hd200/lcd-hd200.c b/firmware/target/coldfire/mpio/hd200/lcd-hd200.c
index 879352f7b4..3c00959745 100644
--- a/firmware/target/coldfire/mpio/hd200/lcd-hd200.c
+++ b/firmware/target/coldfire/mpio/hd200/lcd-hd200.c
@@ -187,7 +187,7 @@ void DMA3(void)
lcd_write_command_e(LCD_SET_COLUMN | ((column >> 4) & 0xf),
column & 0x0f);
- SAR3 = (unsigned long)&lcd_framebuffer[page][column];
+ SAR3 = (unsigned long)FBADDR(column,page);
BCR3 = dma_len;
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
@@ -261,7 +261,7 @@ void lcd_update_rect(int x, int y, int width, int height)
dma_count = ymax - y + 1;
/* Initialize DMA transfer */
- SAR3 = (unsigned long)&lcd_framebuffer[page][column];
+ SAR3 = (unsigned long)FBADDR(column,page);
BCR3 = dma_len;
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
diff --git a/firmware/target/coldfire/mpio/hd300/lcd-hd300.c b/firmware/target/coldfire/mpio/hd300/lcd-hd300.c
index 31087a5d43..509ed4cd53 100644
--- a/firmware/target/coldfire/mpio/hd300/lcd-hd300.c
+++ b/firmware/target/coldfire/mpio/hd300/lcd-hd300.c
@@ -211,7 +211,7 @@ void lcd_update(void)
lcd_write_command(LCD_CNTL_DATA_WRITE);
/* Copy display bitmap to hardware */
- lcd_write_data (&lcd_framebuffer[0][0], LCD_WIDTH*LCD_FBHEIGHT);
+ lcd_write_data (FBADDR(0,0), LCD_WIDTH*LCD_FBHEIGHT);
}
/* Update a fraction of the display. */
@@ -238,6 +238,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
lcd_write_command(LCD_CNTL_DATA_WRITE);
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c
index abde72155d..c9a3fd6edf 100644
--- a/firmware/target/hosted/android/lcd-android.c
+++ b/firmware/target/hosted/android/lcd-android.c
@@ -75,7 +75,7 @@ void connect_with_java(JNIEnv* env, jobject fb_instance)
/* Create native_buffer */
jobject buffer = (*env)->NewDirectByteBuffer(env, lcd_framebuffer,
- (jlong) sizeof(lcd_framebuffer));
+ (jlong) FRAMEBUFFER_SIZE);
/* we need to setup parts for the java object every time */
(*env)->CallVoidMethod(env, fb_instance, java_lcd_init,
@@ -206,10 +206,10 @@ void lcd_blit_yuv(unsigned char * const src[3],
linecounter = height >> 1;
#if LCD_WIDTH >= LCD_HEIGHT
- dst = &lcd_framebuffer[y][x];
+ dst = FBADDR(x,y);
row_end = dst + width;
#else
- dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1];
+ dst = FBADDR(LCD_WIDTH - y - 1,x);
row_end = dst + LCD_WIDTH * width;
#endif
diff --git a/firmware/target/hosted/sdl/lcd-bitmap.c b/firmware/target/hosted/sdl/lcd-bitmap.c
index 4ee0bbef5c..7e9bc297ef 100644
--- a/firmware/target/hosted/sdl/lcd-bitmap.c
+++ b/firmware/target/hosted/sdl/lcd-bitmap.c
@@ -92,29 +92,25 @@ static unsigned long get_lcd_pixel(int x, int y)
{
#if LCD_DEPTH == 1
#ifdef HAVE_NEGATIVE_LCD
- return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? (NUM_SHADES-1) : 0;
+ return (*FBADDR(x, y/8) & (1 << (y & 7))) ? (NUM_SHADES-1) : 0;
#else
- return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? 0 : (NUM_SHADES-1);
+ return (*FBADDR(x, y/8) & (1 << (y & 7))) ? 0 : (NUM_SHADES-1);
#endif
#elif LCD_DEPTH == 2
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
- return colorindex[(lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3];
+ return colorindex[(*FBADDR(x/4, y) >> (2 * (~x & 3))) & 3];
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
- return colorindex[(lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3];
+ return colorindex[(*FBADDR(x, y/4) >> (2 * (y & 3))) & 3];
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
- unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
+ unsigned bits = (*FBADDR(x, y/8) >> (y & 7)) & 0x0101;
return colorindex[(bits | (bits >> 7)) & 3];
#endif
#elif LCD_DEPTH == 16
#if LCD_PIXELFORMAT == RGB565SWAPPED
- unsigned bits = lcd_framebuffer[y][x];
+ unsigned bits = *FBADDR(x, y);
return (bits >> 8) | (bits << 8);
#else
-#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
- return *(&lcd_framebuffer[0][0]+LCD_HEIGHT*x+y);
-#else
- return lcd_framebuffer[y][x];
-#endif
+ return *FBADDR(x, y);
#endif
#endif
}
diff --git a/firmware/target/hosted/sdl/lcd-remote-bitmap.c b/firmware/target/hosted/sdl/lcd-remote-bitmap.c
index 86d45ef446..5f08b4440b 100644
--- a/firmware/target/hosted/sdl/lcd-remote-bitmap.c
+++ b/firmware/target/hosted/sdl/lcd-remote-bitmap.c
@@ -50,10 +50,10 @@ static const unsigned char colorindex[4] = {128, 85, 43, 0};
static unsigned long get_lcd_remote_pixel(int x, int y)
{
#if LCD_REMOTE_DEPTH == 1
- return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
+ return *FBREMOTEADDR(x, y/8) & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
#elif LCD_REMOTE_DEPTH == 2
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
- unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
+ unsigned bits = (*FBREMOTEADDR(x, y/8) >> (y & 7)) & 0x0101;
return colorindex[(bits | (bits >> 7)) & 3];
#endif
#endif
diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/ypr0/lcd-ypr0.c
index 083a9fbe28..40528c298a 100644
--- a/firmware/target/hosted/ypr0/lcd-ypr0.c
+++ b/firmware/target/hosted/ypr0/lcd-ypr0.c
@@ -39,7 +39,7 @@ fb_data *dev_fb = 0;
void lcd_shutdown(void)
{
printf("FB closed.");
- munmap(dev_fb, sizeof(lcd_framebuffer));
+ munmap(dev_fb, FRAMEBUFFER_SIZE);
close(dev_fd);
}
@@ -80,7 +80,7 @@ void lcd_init_device(void)
/* Figure out the size of the screen in bytes */
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
- if (screensize != sizeof(lcd_framebuffer))
+ if (screensize != FRAMEBUFFER_SIZE)
{
exit(4);
perror("Display and framebuffer mismatch!\n");
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
index e74e227e47..c644b9f477 100644
--- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
@@ -101,7 +101,7 @@ void lcd_update_rect(int x, int y, int width, int height)
dma_enable();
REG_DMAC_DCCSR(DMA_LCD_CHANNEL) = DMAC_DCCSR_NDES;
- REG_DMAC_DSAR(DMA_LCD_CHANNEL) = PHYSADDR((unsigned long)&lcd_framebuffer[y][x]);
+ REG_DMAC_DSAR(DMA_LCD_CHANNEL) = PHYSADDR((unsigned long)FBADDR(x,y));
REG_DMAC_DRSR(DMA_LCD_CHANNEL) = DMAC_DRSR_RS_SLCD;
REG_DMAC_DTAR(DMA_LCD_CHANNEL) = PHYSADDR(SLCD_FIFO);
REG_DMAC_DTCR(DMA_LCD_CHANNEL) = (width * height) >> 3;
@@ -195,7 +195,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
IPU_SET_Y_ADDR(PHYSADDR((unsigned long)yuv_src[0]));
IPU_SET_U_ADDR(PHYSADDR((unsigned long)yuv_src[1]));
IPU_SET_V_ADDR(PHYSADDR((unsigned long)yuv_src[2]));
- IPU_SET_OUT_ADDR(PHYSADDR((unsigned long)&lcd_framebuffer[x][y]));
+ IPU_SET_OUT_ADDR(PHYSADDR((unsigned long)FBADDR(y,x)));
IPU_SET_OUT_FM(height, width);
IPU_SET_OUT_STRIDE(height);
diff --git a/firmware/target/sh/archos/lcd-archos-bitmap.c b/firmware/target/sh/archos/lcd-archos-bitmap.c
index 8d8a98432d..f23289053d 100644
--- a/firmware/target/sh/archos/lcd-archos-bitmap.c
+++ b/firmware/target/sh/archos/lcd-archos-bitmap.c
@@ -192,7 +192,7 @@ void lcd_update(void)
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf));
- lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
+ lcd_write_data (FBADDR(0, y), LCD_WIDTH);
}
}
@@ -219,6 +219,6 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
- lcd_write_data (&lcd_framebuffer[y][x], width);
+ lcd_write_data (FBADDR(x,y), width);
}
}