summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-01-09 07:24:43 +0000
committerMark Arigo <markarigo@gmail.com>2008-01-09 07:24:43 +0000
commite66ddd754fba4171e3fd99c5a1b911ed3f9faa3f (patch)
tree918000a401ae36817091cc4561573a5578f87ba5 /firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
parentf59a327f674c36487ed04e6cf36369a622da7f40 (diff)
downloadrockbox-e66ddd754fba4171e3fd99c5a1b911ed3f9faa3f.tar.gz
rockbox-e66ddd754fba4171e3fd99c5a1b911ed3f9faa3f.zip
Initial commit for the Olympus m:robe 100 port (PP5020). The LCD driver works. The ADC driver was copied from the H10 port (they can probably be combined later), but the battery readings aren't right and it shuts down. The touch pad buttons do not work. Install the bootloader and rockbox the H10 way. Still lots of work to do.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16030 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/olympus/mrobe-100/lcd-mr100.c')
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-mr100.c192
1 files changed, 192 insertions, 0 deletions
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
new file mode 100644
index 0000000000..501a0942e5
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
@@ -0,0 +1,192 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2008 by Mark Arigo
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+#include "cpu.h"
+#include "lcd.h"
+#include "kernel.h"
+#include "system.h"
+
+/* send LCD data */
+static void lcd_send_data(unsigned data)
+{
+ while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */
+ LCD1_DATA = data;
+}
+
+/* send LCD command */
+static void lcd_send_command(unsigned cmd)
+{
+ while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */
+ LCD1_CMD = cmd;
+}
+
+/* LCD init */
+void lcd_init_device(void)
+{
+ int i;
+
+ DEV_INIT1 &= ~0xfc000000;
+
+ i = DEV_INIT1;
+ DEV_INIT1 = i;
+
+ DEV_INIT2 &= ~0x400;
+ udelay(10000);
+
+ LCD1_CONTROL &= ~0x4;
+ udelay(15);
+
+ LCD1_CONTROL |= 0x4;
+ udelay(10);
+
+ LCD1_CONTROL = 0x690;
+ LCD1_CONTROL = 0x694;
+
+ /* OF just reads these */
+ i = LCD1_CONTROL;
+ i = inl(0x70003004);
+ i = LCD1_CMD;
+ i = inl(0x7000300c);
+
+#if 0
+ /* this is skipped in the OF */
+ LCD1_CONTROL &= ~0x200;
+ LCD1_CONTROL &= ~0x800;
+ LCD1_CONTROL &= ~0x400;
+#endif
+
+ LCD1_CONTROL |= 0x1;
+ udelay(15000);
+
+ lcd_send_command(0xe2);
+ lcd_send_command(0x2f);
+ lcd_send_command(0x26);
+ lcd_send_command(0xcc);
+ lcd_send_command(0xe8);
+ lcd_send_command(0x81);
+ lcd_send_command(0);
+ lcd_send_command(0x40);
+ lcd_send_command(0xa6);
+ lcd_send_command(0x88);
+ lcd_send_command(0xb0);
+ lcd_send_command(0x10);
+ lcd_send_command(0);
+}
+
+/*** hardware configuration ***/
+int lcd_default_contrast(void)
+{
+ return DEFAULT_CONTRAST_SETTING;
+}
+
+void lcd_set_contrast(int val)
+{
+ lcd_send_command(0x81);
+ lcd_send_command(val);
+}
+
+void lcd_set_invert_display(bool yesno)
+{
+ /* TODO: Implement lcd_set_invert_display() */
+ (void)yesno;
+}
+
+/* turn the display upside down (call lcd_update() afterwards) */
+void lcd_set_flip(bool yesno)
+{
+ /* TODO: Implement lcd_set_flip() */
+ (void)yesno;
+}
+
+/*** update functions ***/
+
+/* Performance function that works with an external buffer
+ note that by and bheight are in 4-pixel units! */
+void lcd_blit(const fb_data* data, int x, int by, int width,
+ int bheight, int stride)
+{
+ /* TODO: Implement lcd_blit() */
+ (void)data;
+ (void)x;
+ (void)by;
+ (void)width;
+ (void)bheight;
+ (void)stride;
+}
+
+/* Performance function to blit a YUV bitmap directly to the LCD */
+void lcd_yuv_blit(unsigned char * const src[3],
+ int src_x, int src_y, int stride,
+ int x, int y, int width, int height)
+{
+ (void)src;
+ (void)src_x;
+ (void)src_y;
+ (void)stride;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+}
+
+/* Update the display.
+ This must be called after all other LCD functions that change the display. */
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
+
+/* Update a fraction of the display. */
+void lcd_update_rect(int x0, int y0, int width, int height)
+{
+ unsigned char *addr;
+ unsigned int cmd0, cmd1, cmd2;
+ int r, c, x1, y1, start_row, last_row;
+
+ x1 = (x0 + width) - 1;
+ y1 = (y0 + height) - 1;
+ if ((x1 <= 0) || (y1 <= 0))
+ return;
+
+ if(x1 >= LCD_WIDTH)
+ x1 = LCD_WIDTH - 1;
+
+ if(y1 >= LCD_HEIGHT)
+ y1 = LCD_HEIGHT - 1;
+
+ start_row = y0/8;
+ last_row = y1/8;
+
+ cmd1 = (x0 & 0xff) >> 4;
+ cmd1 = (cmd1 + 5) | 0x10;
+ cmd2 = x0 & 0xf;
+
+ for (r = start_row; r <= last_row; r++) {
+ cmd0 = (r & 0xff) | 0xb0;
+ lcd_send_command(cmd0);
+ lcd_send_command(cmd1);
+ lcd_send_command(cmd2);
+
+ addr = (unsigned char*)&lcd_framebuffer[r][x0];
+ for (c = x0; c <= x1; c++)
+ lcd_send_data(*(addr++));
+ }
+
+ lcd_send_command(0xaf);
+}