Remote LCD support added to the x11 simulator, take 1. The win32 simulator

still builds, but shows no remote LCD yet.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6510 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2005-05-23 16:23:25 +00:00
parent ed42300bff
commit ac31e6af87
12 changed files with 215 additions and 30 deletions

View File

@ -46,13 +46,9 @@ LIBROCKBOX = $(BUILDDIR)/librockbox.a
ifdef SIMVER
# this is a sim build
COMMONLIB = $(BUILDDIR)/comsim/libcomsim.a
all: $(COMMONLIB) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS)
@$(MAKE) -C $(SIMDIR)
all: $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS)
$(COMMONLIB):
@$(MAKE) -C $(ROOTDIR)/uisimulator/common
else
# regular target build
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
@ -120,11 +116,6 @@ $(BUILDDIR)/$(BINARY) : $(OBJS) $(DEPFILE) $(BUILDDIR)/libsim.a \
@echo "LD $(BINARY)"
@$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map
$(BUILDDIR)/libsim.a:
@$(MAKE) -C $(SIMDIR) OBJDIR=$(BUILDDIR)/sim
$(BUILDDIR)/libcomsim.a:
@$(MAKE) -C $(ROOTDIR)/uisimulator/common OBJDIR=$(BUILDDIR)/comsim
endif
$(BUILDDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin

View File

@ -24,9 +24,9 @@
#define DISPLAY_HEIGHT LCD_HEIGHT
#define RAND_SCALE 5
#if defined(IRIVER_H100) && !defined(SIMULATOR)
#define REMOTE_WIDTH 134
#define REMOTE_HEIGHT 65
#ifdef HAVE_REMOTE_LCD
#define REMOTE_WIDTH LCD_REMOTE_WIDTH
#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
#define REMOTE_LOGO_WIDTH 91
#define REMOTE_LOGO_HEIGHT 32
#define REMOTE_LOGO rockbox91x32

View File

@ -112,9 +112,9 @@ descramble.S
#endif
drivers/lcd.S
#ifdef IRIVER_H100
drivers/lcd-h100-remote.c
#ifndef SIMULATOR
drivers/uda1380.c
drivers/lcd-h100-remote.c
pcm_playback.c
#endif
#endif

View File

@ -65,8 +65,10 @@ struct scrollinfo {
static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */
#ifndef SIMULATOR
static void scroll_thread(void);
static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)];
#endif
static const char scroll_name[] = "remote_scroll";
static char scroll_ticks = 12; /* # of ticks between updates*/
static int scroll_delay = HZ/2; /* ticks delay before start */
@ -87,6 +89,7 @@ static struct scrollinfo scroll[SCROLLABLE_LINES];
/* delay loop */
#define DELAY do { int _x; for(_x=0;_x<3;_x++);} while (0)
#ifndef SIMULATOR
void lcd_remote_backlight_on(void)
{
GPIO_OUT &= ~0x00000800;
@ -225,6 +228,8 @@ int lcd_remote_default_contrast(void)
return 32;
}
#endif
void lcd_remote_bitmap(const unsigned char *src, int x, int y, int nx, int ny, bool clear) __attribute__ ((section (".icode")));
void lcd_remote_bitmap(const unsigned char *src, int x, int y, int nx, int ny, bool clear)
{
@ -371,6 +376,7 @@ void lcd_remote_clear_display(void)
memset(lcd_remote_framebuffer, 0, sizeof lcd_remote_framebuffer);
}
#ifndef SIMULATOR
/*
* Update the display.
* This must be called after all other LCD functions that change the display.
@ -430,6 +436,7 @@ void lcd_remote_init(void)
sizeof(scroll_stack), scroll_name);
}
/*
* Update a fraction of the display.
*/
@ -480,6 +487,9 @@ void lcd_remote_roll(int lines)
lcd_remote_write_data(data, 2);
}
#endif
void lcd_remote_setmargins(int x, int y)
{
xmargin = x;
@ -903,6 +913,7 @@ void lcd_remote_bidir_scroll(int percent)
bidir_limit = percent;
}
#ifndef SIMULATOR
static void scroll_thread(void)
{
struct font* pf;
@ -964,3 +975,5 @@ static void scroll_thread(void)
sleep(scroll_ticks);
}
}
#endif /* SIMULATOR */

View File

@ -17,6 +17,9 @@
/* Define this if you do software codec */
#define CONFIG_HWCODEC MASNONE
/* Define this if you have an remote lcd */
#define HAVE_REMOTE_LCD
#ifndef SIMULATOR
/* Define this if you have a Motorola SCF5249 */
@ -66,7 +69,4 @@
/* Define this if you can control the S/PDIF power */
#define HAVE_SPDIF_POWER
/* Define this if you have an remote lcd */
#define HAVE_REMOTE_LCD
#endif

View File

@ -60,6 +60,13 @@ extern void lcd_blit (const unsigned char* p_data, int x, int y, int width,
/* update a fraction of the screen */
extern void lcd_update_rect(int x, int y, int width, int height);
#ifdef HAVE_REMOTE_LCD
extern void lcd_remote_update(void);
/* update a fraction of the screen */
extern void lcd_remote_update_rect(int x, int y, int width, int height);
#endif
#else
#define lcd_update()
#define lcd_update_rect(x,y,w,h)

View File

@ -46,3 +46,27 @@ void lcd_set_flip(bool yesno)
(void)yesno;
}
void lcd_set_invert_display(bool invert)
{
(void)invert;
}
void lcd_remote_set_invert_display(bool invert)
{
(void)invert;
}
#ifdef HAVE_REMOTE_LCD
void lcd_remote_set_contrast(int val)
{
(void)val;
}
void lcd_remote_backlight_on(int val)
{
(void)val;
}
void lcd_remote_backlight_off(int val)
{
(void)val;
}
#endif

View File

@ -48,11 +48,6 @@ extern unsigned char hardware_buffer_lcd[11][2];
static unsigned char lcd_buffer_copy[11][2];
#endif
void lcd_set_invert_display(bool invert)
{
(void)invert;
}
/* lcd_update()
update lcd */
void lcd_update()
@ -128,6 +123,20 @@ void lcd_update_rect(int x_start, int y_start,
InvalidateRect (hGUIWnd, &r, FALSE);
}
void lcd_remote_update(void)
{
}
void lcd_remote_update_rect(int x_start, int y_start,
int width, int height)
{
(void)x_start;
(void)y_start;
(void)width;
(void)height;
}
/* lcd_backlight()
set backlight state of lcd */
void lcd_backlight (bool on)

View File

@ -45,7 +45,6 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS)
OUTFILE = $(BUILDDIR)/libsim.a
all: $(OUTFILE)
@$(MAKE) -C $(SIMCOMMON)
include $(TOOLSDIR)/make.inc

View File

@ -46,11 +46,6 @@ extern void screen_resized(int width, int height);
#ifdef HAVE_LCD_BITMAP
unsigned char lcd_framebuffer_copy[LCD_HEIGHT/8][LCD_WIDTH];
void lcd_set_invert_display(bool invert)
{
(void)invert;
}
void lcd_update (void)
{
int x, y;
@ -162,6 +157,135 @@ void lcd_update_rect(int x_start, int y_start,
XSync(dpy,False);
XtAppUnlock(app);
}
#ifdef LCD_REMOTE_HEIGHT
extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
unsigned char lcd_remote_framebuffer_copy[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
#define REMOTE_MARGIN_X 2
#define REMOTE_MARGIN_Y (LCD_HEIGHT + 2 + MARGIN_Y)
void lcd_remote_update (void)
{
int x, y;
int p=0;
int bit;
struct coordinate points[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
int cp=0;
struct coordinate clearpoints[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
for(y=0; y<LCD_REMOTE_HEIGHT; y+=8) {
for(x=0; x<LCD_REMOTE_WIDTH; x++) {
if(lcd_remote_framebuffer[y/8][x] ||
lcd_remote_framebuffer_copy[y/8][x]) {
/* one or more bits/pixels are changed */
unsigned char diff =
lcd_remote_framebuffer[y/8][x] ^
lcd_remote_framebuffer_copy[y/8][x];
for(bit=0; bit<8; bit++) {
if(lcd_remote_framebuffer[y/8][x]&(1<<bit)) {
/* set a dot */
points[p].x = x + REMOTE_MARGIN_X;
points[p].y = y+bit + REMOTE_MARGIN_Y;
p++; /* increase the point counter */
}
else if(diff &(1<<bit)) {
/* clear a dot */
clearpoints[cp].x = x + REMOTE_MARGIN_X;
clearpoints[cp].y = y+bit + REMOTE_MARGIN_Y;
cp++; /* increase the point counter */
}
}
}
}
}
/* copy a huge block */
memcpy(lcd_remote_framebuffer_copy, lcd_remote_framebuffer,
sizeof(lcd_remote_framebuffer));
drawdots(0, &clearpoints[0], cp);
drawdots(1, &points[0], p);
/* printf("lcd_update: Draws %d pixels, clears %d pixels (max %d/%d)\n",
p, cp, p+cp, LCD_HEIGHT*LCD_WIDTH); */
XtAppLock(app);
XSync(dpy,False);
XtAppUnlock(app);
}
void lcd_remote_update_rect(int x_start, int y_start,
int width, int height)
{
int x;
int yline=y_start;
int y;
int p=0;
int bit;
int cp=0;
int xmax;
int ymax;
struct coordinate points[LCD_WIDTH * LCD_HEIGHT];
struct coordinate clearpoints[LCD_WIDTH * LCD_HEIGHT];
#if 0
fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n",
counter++, x_start, y_start, width, height);
#endif
/* The Y coordinates have to work on even 8 pixel rows */
ymax = (yline + height)/8;
yline /= 8;
xmax = x_start + width;
if(xmax > LCD_REMOTE_WIDTH)
xmax = LCD_REMOTE_WIDTH;
if(ymax >= LCD_REMOTE_HEIGHT/8)
ymax = LCD_REMOTE_HEIGHT/8-1;
for(; yline<=ymax; yline++) {
y = yline * 8;
for(x=x_start; x<xmax; x++) {
if(lcd_remote_framebuffer[yline][x] ||
lcd_remote_framebuffer_copy[yline][x]) {
/* one or more bits/pixels are changed */
unsigned char diff =
lcd_remote_framebuffer[yline][x] ^
lcd_remote_framebuffer_copy[yline][x];
for(bit=0; bit<8; bit++) {
if(lcd_remote_framebuffer[yline][x]&(1<<bit)) {
/* set a dot */
points[p].x = x + REMOTE_MARGIN_X;
points[p].y = y+bit + REMOTE_MARGIN_Y;
p++; /* increase the point counter */
}
else if(diff &(1<<bit)) {
/* clear a dot */
clearpoints[cp].x = x + REMOTE_MARGIN_X;
clearpoints[cp].y = y+bit + REMOTE_MARGIN_Y;
cp++; /* increase the point counter */
}
}
/* update the copy */
lcd_remote_framebuffer_copy[yline][x] =
lcd_remote_framebuffer[yline][x];
}
}
}
drawdots(0, &clearpoints[0], cp);
drawdots(1, &points[0], p);
/* printf("lcd_update_rect: Draws %d pixels, clears %d pixels\n", p, cp);*/
XtAppLock(app);
XSync(dpy,False);
XtAppUnlock(app);
}
#endif
#endif
#ifdef HAVE_LCD_CHARCELLS

View File

@ -437,8 +437,13 @@ int main (int argc, char **argv)
{
static char geometry[40];
#ifdef HAVE_LCD_BITMAP
unsigned int height = LCD_HEIGHT;
#ifdef LCD_REMOTE_HEIGHT
height += LCD_REMOTE_HEIGHT;
#endif
printf("height: %d\n", height);
snprintf(geometry, 40, "*geometry: %dx%d",
LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8);
LCD_WIDTH*display_zoom+14, height*display_zoom+8);
#else
snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom,
132*display_zoom);

View File

@ -235,7 +235,7 @@ void screenhack()
void screen_redraw()
{
/* draw a border around the "Recorder" screen */
/* draw a border around the screen */
#define X1 0
#define Y1 0
#define X2 (LCD_WIDTH + MARGIN_X*2)
@ -246,4 +246,17 @@ void screen_redraw()
drawline(1, X1, Y2, X2, Y2);
drawline(1, X1, Y1, X1, Y2);
lcd_update();
#ifdef LCD_REMOTE_HEIGHT
/* draw a border around the remote LCD screen */
#define RX1 0
#define RY1 (Y2 +1)
#define RX2 (LCD_REMOTE_WIDTH + MARGIN_X*2)
#define RY2 (Y2 + 1 + LCD_REMOTE_HEIGHT)
drawline(1, RX1, RY1, RX2, RY1);
drawline(1, RX2, RY1, RX2, RY2);
drawline(1, RX1, RY2, RX2, RY2);
drawline(1, RX1, RY1, RX1, RY2);
lcd_remote_update();
#endif
}