summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-23 16:23:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-23 16:23:25 +0000
commitac31e6af875eed8dce724604cff94da107a4700b (patch)
tree9f2e3cc33933ae69753314ffea509741b35ed45b
parented42300bff0d7e5d6f6af3a41fd5d0249830bdfa (diff)
downloadrockbox-ac31e6af875eed8dce724604cff94da107a4700b.tar.gz
rockbox-ac31e6af875eed8dce724604cff94da107a4700b.zip
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
-rw-r--r--apps/Makefile11
-rw-r--r--apps/plugins/logo.c6
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/drivers/lcd-h100-remote.c13
-rw-r--r--firmware/export/config-h100.h6
-rw-r--r--firmware/export/lcd.h7
-rw-r--r--uisimulator/common/lcd-common.c24
-rw-r--r--uisimulator/win32/lcd-win32.c19
-rw-r--r--uisimulator/x11/Makefile1
-rw-r--r--uisimulator/x11/lcd-x11.c134
-rw-r--r--uisimulator/x11/screenhack.c7
-rw-r--r--uisimulator/x11/uibasic.c15
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_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
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c
index fb0f5637e5..4b8713970a 100644
--- a/uisimulator/x11/screenhack.c
+++ b/uisimulator/x11/screenhack.c
@@ -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);
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index 0c3e9bb9d0..08fdf594ed 100644
--- a/uisimulator/x11/uibasic.c
+++ b/uisimulator/x11/uibasic.c
@@ -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
}