Introduced LCD_FBHEIGHT in addition to the already existing LCD_FBWIDTH to ease framebuffer handling a bit. Added equivalent definitions for the remote LCD.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12419 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-02-20 19:31:34 +00:00
parent 283bfb16f1
commit 51223e5395
13 changed files with 57 additions and 41 deletions

View File

@ -434,7 +434,7 @@ void screen_dump(void)
/* BMP image goes bottom up */
#if LCD_DEPTH == 1
for (by = LCD_HEIGHT/8 - 1; by >= 0; by--)
for (by = LCD_FBHEIGHT - 1; by >= 0; by--)
{
unsigned char *src = &lcd_framebuffer[by][0];
unsigned char *dst = &line_block[0][0];
@ -467,16 +467,16 @@ void screen_dump(void)
}
#elif LCD_DEPTH == 2
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
for (by = LCD_HEIGHT - 1; by >= 0; by--)
for (by = LCD_FBHEIGHT - 1; by >= 0; by--)
{
unsigned char *src = &lcd_framebuffer[by][0];
unsigned char *dst = line_block;
memset(line_block, 0, sizeof(line_block));
for (bx = (LCD_WIDTH+3)/4; bx > 0; bx--)
for (bx = LCD_FBWIDTH; bx > 0; bx--)
{
unsigned src_byte = *src++;
*dst++ = ((src_byte >> 2) & 0x30) | ((src_byte >> 4) & 0x03);
*dst++ = ((src_byte << 2) & 0x30) | (src_byte & 0x03);
}
@ -484,7 +484,7 @@ void screen_dump(void)
write(fh, line_block, sizeof(line_block));
}
#else /* VERTICAL_PACKING */
for (by = LCD_HEIGHT/4 - 1; by >= 0; by--)
for (by = LCD_FBHEIGHT - 1; by >= 0; by--)
{
unsigned char *src = &lcd_framebuffer[by][0];
unsigned char *dst = &line_block[3][0];

View File

@ -48,7 +48,7 @@ enum fill_opt {
};
/*** globals ***/
fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH] IRAM_LCDFRAMEBUFFER __attribute__ ((aligned (16)));
fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER __attribute__ ((aligned (16)));
static fb_data* lcd_backdrop = NULL;
@ -599,7 +599,7 @@ void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
dst_end = dst_col + height * LCD_WIDTH;
do
{
switch (drawmode)
switch (drawmode)
{
case DRMODE_SOLID:
if (data & 0x01)

View File

@ -37,7 +37,7 @@
/*** globals ***/
unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
static int drawmode = DRMODE_SOLID;
static int xmargin = 0;

View File

@ -38,7 +38,7 @@
/*** globals ***/
unsigned char lcd_framebuffer[LCD_HEIGHT][LCD_FBWIDTH] IBSS_ATTR;
unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IBSS_ATTR;
static const unsigned char pixmask[4] ICONST_ATTR = {
0xC0, 0x30, 0x0C, 0x03

View File

@ -37,7 +37,7 @@
/*** globals ***/
fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH] IBSS_ATTR;
fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IBSS_ATTR;
const unsigned char lcd_dibits[16] ICONST_ATTR = {
0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,

View File

@ -65,7 +65,7 @@
/*** globals ***/
fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]
fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]
IBSS_ATTR;
static int drawmode = DRMODE_SOLID;
@ -629,7 +629,7 @@ void lcd_remote_update(void)
#endif
/* Copy display bitmap to hardware */
for (y = 0; y < LCD_REMOTE_HEIGHT/8; y++)
for (y = 0; y < LCD_REMOTE_FBHEIGHT; y++)
{
lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y);
lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
@ -655,8 +655,8 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
width = LCD_REMOTE_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_REMOTE_HEIGHT/8)
ymax = LCD_REMOTE_HEIGHT/8-1;
if(ymax >= LCD_REMOTE_FBHEIGHT)
ymax = LCD_REMOTE_FBHEIGHT-1;
#ifdef HAVE_REMOTE_LCD_TICKING
/* Adjust byte delay for emi reduction */

View File

@ -39,7 +39,7 @@
/*** globals ***/
fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_FBWIDTH]
fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]
IBSS_ATTR;
static const fb_remote_data patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};

View File

@ -82,14 +82,25 @@ extern unsigned lcd_remote_color_to_native(unsigned color);
#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
#endif
/* Memory copy of display bitmap */
/* Frame buffer dimensions (format checks only cover existing targets!) */
#if LCD_REMOTE_DEPTH == 1
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
#elif LCD_REMOTE_DEPTH == 2
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
#endif
#endif /* LCD_REMOTE_DEPTH */
/* Set defaults if not defined different yet. The defaults apply to both
* dimensions for LCD_REMOTE_DEPTH >= 8 */
#ifndef LCD_REMOTE_FBWIDTH
#define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
#endif
#ifndef LCD_REMOTE_FBHEIGHT
#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_HEIGHT
#endif
/* The actual framebuffer */
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
extern void lcd_remote_init(void);
extern int lcd_remote_default_contrast(void);

View File

@ -237,25 +237,30 @@ static inline unsigned lcd_color_to_native(unsigned color)
#define LCD_DEFAULT_BG LCD_WHITE
#endif
/* Memory copy of display bitmap */
/* Frame buffer dimensions */
#if LCD_DEPTH == 1
extern fb_data lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#define LCD_FBWIDTH ((LCD_WIDTH+7)/8)
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
#define LCD_FBHEIGHT ((LCD_HEIGHT+7)/8)
#endif
#elif LCD_DEPTH == 2
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#define LCD_FBWIDTH ((LCD_WIDTH+3)/4)
extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_FBWIDTH];
#else
extern fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH];
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
#define LCD_FBHEIGHT ((LCD_HEIGHT+3)/4)
#endif
#elif LCD_DEPTH == 16
extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
#elif LCD_DEPTH == 18
extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
#endif
#endif /* LCD_DEPTH */
/* Set defaults if not defined different yet. The defaults apply to both
* dimensions for LCD_DEPTH >= 8 */
#ifndef LCD_FBWIDTH
#define LCD_FBWIDTH LCD_WIDTH
#endif
#ifndef LCD_FBHEIGHT
#define LCD_FBHEIGHT LCD_HEIGHT
#endif
/* The actual framebuffer */
extern fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
/** Port-specific functions. Enable in port config file. **/
#ifdef HAVE_LCD_ENABLE

View File

@ -169,7 +169,7 @@ void lcd_update(void)
int y;
/* Copy display bitmap to hardware */
for (y = 0; y < LCD_HEIGHT/8; y++)
for (y = 0; y < LCD_FBHEIGHT; y++)
{
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL);
@ -193,8 +193,8 @@ void lcd_update_rect(int x, int y, int width, int height)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_HEIGHT/8)
ymax = LCD_HEIGHT/8-1;
if(ymax >= LCD_FBHEIGHT)
ymax = LCD_FBHEIGHT-1;
/* Copy specified rectange bitmap to hardware */
for (; y <= ymax; y++)

View File

@ -399,7 +399,7 @@ void lcd_remote_update(void)
{
int y;
if(remote_initialized) {
for(y = 0;y < LCD_REMOTE_HEIGHT/8;y++) {
for(y = 0;y < LCD_REMOTE_FBHEIGHT;y++) {
/* Copy display bitmap to hardware.
The COM48-COM63 lines are not connected so we have to skip
them. Further, the column address doesn't wrap, so we
@ -427,8 +427,8 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
width = LCD_REMOTE_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_REMOTE_HEIGHT)
ymax = LCD_REMOTE_HEIGHT-1;
if(ymax >= LCD_REMOTE_FBHEIGHT)
ymax = LCD_REMOTE_FBHEIGHT-1;
/* Copy specified rectangle bitmap to hardware
COM48-COM63 are not connected, so we need to skip those */

View File

@ -189,7 +189,7 @@ void lcd_update(void)
int y;
/* Copy display bitmap to hardware */
for (y = 0; y < LCD_HEIGHT/4; y++)
for (y = 0; y < LCD_FBHEIGHT; y++)
{
lcd_write_command_ex(LCD_CNTL_PAGE, y, -1);
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
@ -213,8 +213,8 @@ void lcd_update_rect(int x, int y, int width, int height)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_HEIGHT/4)
ymax = LCD_HEIGHT/4-1;
if(ymax >= LCD_FBHEIGHT)
ymax = LCD_FBHEIGHT-1;
/* Copy specified rectange bitmap to hardware */
for (; y <= ymax; y++)

View File

@ -164,7 +164,7 @@ void lcd_update(void)
int y;
/* Copy display bitmap to hardware */
for (y = 0; y < LCD_HEIGHT/8; y++)
for (y = 0; y < LCD_FBHEIGHT; y++)
{
lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
@ -188,8 +188,8 @@ void lcd_update_rect(int x, int y, int width, int height)
width = LCD_WIDTH - x;
if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if(ymax >= LCD_HEIGHT/8)
ymax = LCD_HEIGHT/8-1;
if(ymax >= LCD_FBHEIGHT)
ymax = LCD_FBHEIGHT-1;
/* Copy specified rectange bitmap to hardware */
for (; y <= ymax; y++)