From ac31e6af875eed8dce724604cff94da107a4700b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 23 May 2005 16:23:25 +0000 Subject: [PATCH] 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 --- apps/Makefile | 11 +-- apps/plugins/logo.c | 6 +- firmware/SOURCES | 2 +- firmware/drivers/lcd-h100-remote.c | 13 +++ firmware/export/config-h100.h | 6 +- firmware/export/lcd.h | 7 ++ uisimulator/common/lcd-common.c | 24 ++++++ uisimulator/win32/lcd-win32.c | 19 ++-- uisimulator/x11/Makefile | 1 - uisimulator/x11/lcd-x11.c | 134 +++++++++++++++++++++++++++-- uisimulator/x11/screenhack.c | 7 +- uisimulator/x11/uibasic.c | 15 +++- 12 files changed, 215 insertions(+), 30 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index ca2b427155..38b213f372 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -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 diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index 9cace8943c..03250f888f 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c @@ -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 diff --git a/firmware/SOURCES b/firmware/SOURCES index d3d3b1c656..b6eeaec3f1 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -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 diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index a289f8a989..f4a5b48f6b 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c @@ -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 */ + diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 9ffdf5ed2d..0044e28009 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -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 diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index c5dd4f7399..08a02a8303 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -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) diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 95c42ad8db..5265b88083 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c @@ -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 diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c index 8b01803978..ef85214e8f 100644 --- a/uisimulator/win32/lcd-win32.c +++ b/uisimulator/win32/lcd-win32.c @@ -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) diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index 4d3e1e7fce..989ac65223 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile @@ -45,7 +45,6 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) OUTFILE = $(BUILDDIR)/libsim.a all: $(OUTFILE) - @$(MAKE) -C $(SIMCOMMON) include $(TOOLSDIR)/make.inc diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c index dada13d42d..1ee15f9169 100644 --- a/uisimulator/x11/lcd-x11.c +++ b/uisimulator/x11/lcd-x11.c @@ -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_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