summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-07 21:14:29 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-07 21:14:29 +0000
commitece03129b66e4b4843287935a0ed1fb2ed0e3102 (patch)
tree24a7bef009ffb9248949b6040e009438107daaa3
parentca7a98b82cef2b2989767e2999ddaf5e5d359fe2 (diff)
downloadrockbox-ece03129b66e4b4843287935a0ed1fb2ed0e3102.tar.gz
rockbox-ece03129b66e4b4843287935a0ed1fb2ed0e3102.zip
Make the greyscale library work on the m:robe 100. Testing on target done by Robert Kukla & Dominik Riebeling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17028 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/lib/grey_core.c25
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-as-mr100.S115
-rw-r--r--firmware/target/arm/olympus/mrobe-100/lcd-mr100.c40
4 files changed, 159 insertions, 22 deletions
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index b4e7dfd1f4..c38a8b8446 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -183,9 +183,30 @@ static const unsigned char lcdlinear[256] = {
};
#define LCD_SCANRATE 70 /* Hz */
+#elif defined MROBE_100 /* verified */
+/* Average measurements of 2 m:robe 100 s */
+static const unsigned char lcdlinear[256] = {
+ 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 49, 53, 56, 60, 63, 67,
+ 70, 73, 76, 79, 81, 84, 87, 90, 92, 95, 97, 100, 102, 105, 107, 110,
+112, 114, 116, 118, 119, 121, 123, 125, 126, 128, 130, 131, 133, 135, 136, 138,
+139, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157,
+158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171,
+172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 178, 178, 179, 180, 180,
+181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 187, 187, 188, 188,
+189, 189, 190, 190, 191, 191, 192, 192, 193, 193, 193, 194, 194, 195, 195, 195,
+196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 200, 201, 201, 202, 202, 202,
+203, 203, 204, 204, 205, 205, 206, 206, 207, 207, 207, 208, 208, 209, 209, 209,
+210, 210, 210, 211, 211, 212, 212, 212, 213, 213, 213, 214, 214, 215, 215, 215,
+216, 216, 216, 217, 217, 218, 218, 218, 219, 219, 219, 220, 220, 221, 221, 221,
+222, 222, 222, 223, 223, 224, 224, 224, 225, 225, 225, 226, 226, 227, 227, 227,
+228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234,
+235, 235, 235, 236, 236, 237, 237, 237, 238, 238, 238, 239, 239, 240, 240, 240,
+241, 241, 242, 242, 243, 243, 244, 244, 247, 248, 248, 249, 250, 250, 251, 252
+};
+#define LCD_SCANRATE 51 /* Hz */
+
#else /* not yet calibrated targets - generic linear mapping */
-/* TODO: calibrate iFP7xx
- * TODO: Olympus m:robe 100 */
+/* TODO: calibrate iFP7xx */
static const unsigned char lcdlinear[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 915d77875c..da7bf37f61 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -704,6 +704,7 @@ target/arm/adc-pp5020.c
target/arm/olympus/mrobe-100/backlight-mr100.c
target/arm/olympus/mrobe-100/button-mr100.c
target/arm/olympus/mrobe-100/lcd-mr100.c
+target/arm/olympus/mrobe-100/lcd-as-mr100.S
target/arm/olympus/mrobe-100/power-mr100.c
target/arm/olympus/mrobe-100/powermgmt-mr100.c
target/arm/usb-fw-pp502x.c
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-as-mr100.S b/firmware/target/arm/olympus/mrobe-100/lcd-as-mr100.S
new file mode 100644
index 0000000000..43ae3c5c6b
--- /dev/null
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-as-mr100.S
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2008 by Jens Arnold
+ *
+ * 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"
+
+ .text
+ .align 2
+
+
+ .global lcd_write_data
+ .type lcd_write_data,%function
+
+lcd_write_data:
+ str lr, [sp, #-4]!
+ ldr lr, =LCD1_BASE
+
+.loop:
+ ldrb r2, [r0], #1
+1:
+ ldr r3, [lr]
+ tst r3, #LCD1_BUSY_MASK
+ bne 1b
+ str r2, [lr, #0x10]
+
+ subs r1, r1, #1
+ bne .loop
+
+ ldr pc, [sp], #4
+ .size lcd_write_data,.-lcd_write_data
+
+
+ .global lcd_grey_data
+ .type lcd_grey_data,%function
+
+/* A high performance function to write grey phase data to the display,
+ * one or multiple pixels.
+ *
+ * Arguments:
+ * r0 - pixel value data address
+ * r1 - pixel phase data address
+ * r2 - pixel block count
+ *
+ * Register usage:
+ * r3/r4 - current block of phases
+ * r5/r6 - current block of values
+ * r7 - lcd data accumulator
+ * r8 - phase signs mask
+ * lr - lcd bridge address
+ */
+
+lcd_grey_data:
+ stmfd sp!, {r4-r8, lr}
+ mov r8, #0x80
+ orr r8, r8, r8, lsl #8
+ orr r8, r8, r8, lsl #16
+ ldr lr, =LCD1_BASE
+
+.greyloop:
+ ldmia r1, {r3-r4} /* Fetch 8 pixel phases */
+ ldmia r0!, {r5-r6} /* Fetch 8 pixel values */
+
+ mov r7, #0xff
+ tst r3, #0x80
+ biceq r7, r7, #0x80
+ tst r3, #0x8000
+ biceq r7, r7, #0x40
+ tst r3, #0x800000
+ biceq r7, r7, #0x20
+ tst r3, #0x80000000
+ biceq r7, r7, #0x10
+ bic r3, r3, r8
+ add r3, r3, r5
+
+ tst r4, #0x80
+ biceq r7, r7, #0x08
+ tst r4, #0x8000
+ biceq r7, r7, #0x04
+ tst r4, #0x800000
+ biceq r7, r7, #0x02
+ tst r4, #0x80000000
+ biceq r7, r7, #0x01
+ bic r4, r4, r8
+ add r4, r4, r6
+
+ stmia r1!, {r3-r4}
+
+1:
+ ldr r5, [lr]
+ tst r5, #LCD1_BUSY_MASK
+ bne 1b
+ str r7, [lr, #0x10]
+
+ subs r2, r2, #1
+ bne .greyloop
+
+ ldmfd sp!, {r4-r8, pc}
+ .size lcd_grey_data,.-lcd_grey_data
+
diff --git a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
index d3c913f4d7..9299b131f2 100644
--- a/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
+++ b/firmware/target/arm/olympus/mrobe-100/lcd-mr100.c
@@ -76,17 +76,6 @@ void lcd_write_command(int byte)
LCD1_CMD = byte;
}
-/* send LCD data */
-
-void lcd_write_data(const fb_data* p_bytes, int count)
-{
- while (count--)
- {
- while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */
- LCD1_DATA = *(p_bytes++);
- }
-}
-
static int xoffset; /* needed for flip */
/*** hardware configuration ***/
@@ -146,8 +135,7 @@ void lcd_init_device(void)
LCD1_CONTROL |= 0x4;
udelay(10);
- LCD1_CONTROL = 0x690;
- LCD1_CONTROL = 0x694;
+ LCD1_CONTROL = 0x0094;
/* OF just reads these */
LCD1_CONTROL;
@@ -206,18 +194,30 @@ void lcd_blit_mono(const unsigned char* data, int x, int by, int width,
}
}
+/* Helper function for lcd_grey_phase_blit(). */
+void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
+
/* Performance function that works with an external buffer
note that by and bheight are in 8-pixel units! */
void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
int x, int by, int width, int bheight, int stride)
{
- (void)values;
- (void)phases;
- (void)x;
- (void)by;
- (void)width;
- (void)bheight;
- (void)stride;
+ int cmd1, cmd2;
+
+ stride <<= 3; /* 8 pixels per block */
+ cmd1 = LCD_CNTL_HIGHCOL | (((x + xoffset) >> 4) & 0xf);
+ cmd2 = LCD_CNTL_LOWCOL | ((x + xoffset) & 0xf);
+
+ while (bheight--)
+ {
+ lcd_write_command(LCD_CNTL_PAGE | (by++ & 0xff));
+ lcd_write_command(cmd1);
+ lcd_write_command(cmd2);
+
+ lcd_grey_data(values, phases, width);
+ values += stride;
+ phases += stride;
+ }
}
/* Update the display.