diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-07 21:14:29 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-07 21:14:29 +0000 |
commit | ece03129b66e4b4843287935a0ed1fb2ed0e3102 (patch) | |
tree | 24a7bef009ffb9248949b6040e009438107daaa3 | |
parent | ca7a98b82cef2b2989767e2999ddaf5e5d359fe2 (diff) | |
download | rockbox-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.c | 25 | ||||
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-100/lcd-as-mr100.S | 115 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-100/lcd-mr100.c | 40 |
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] = { | |||
183 | }; | 183 | }; |
184 | #define LCD_SCANRATE 70 /* Hz */ | 184 | #define LCD_SCANRATE 70 /* Hz */ |
185 | 185 | ||
186 | #elif defined MROBE_100 /* verified */ | ||
187 | /* Average measurements of 2 m:robe 100 s */ | ||
188 | static const unsigned char lcdlinear[256] = { | ||
189 | 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 49, 53, 56, 60, 63, 67, | ||
190 | 70, 73, 76, 79, 81, 84, 87, 90, 92, 95, 97, 100, 102, 105, 107, 110, | ||
191 | 112, 114, 116, 118, 119, 121, 123, 125, 126, 128, 130, 131, 133, 135, 136, 138, | ||
192 | 139, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, | ||
193 | 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, | ||
194 | 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 178, 178, 179, 180, 180, | ||
195 | 181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 187, 187, 188, 188, | ||
196 | 189, 189, 190, 190, 191, 191, 192, 192, 193, 193, 193, 194, 194, 195, 195, 195, | ||
197 | 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 200, 201, 201, 202, 202, 202, | ||
198 | 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, 207, 208, 208, 209, 209, 209, | ||
199 | 210, 210, 210, 211, 211, 212, 212, 212, 213, 213, 213, 214, 214, 215, 215, 215, | ||
200 | 216, 216, 216, 217, 217, 218, 218, 218, 219, 219, 219, 220, 220, 221, 221, 221, | ||
201 | 222, 222, 222, 223, 223, 224, 224, 224, 225, 225, 225, 226, 226, 227, 227, 227, | ||
202 | 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234, | ||
203 | 235, 235, 235, 236, 236, 237, 237, 237, 238, 238, 238, 239, 239, 240, 240, 240, | ||
204 | 241, 241, 242, 242, 243, 243, 244, 244, 247, 248, 248, 249, 250, 250, 251, 252 | ||
205 | }; | ||
206 | #define LCD_SCANRATE 51 /* Hz */ | ||
207 | |||
186 | #else /* not yet calibrated targets - generic linear mapping */ | 208 | #else /* not yet calibrated targets - generic linear mapping */ |
187 | /* TODO: calibrate iFP7xx | 209 | /* TODO: calibrate iFP7xx */ |
188 | * TODO: Olympus m:robe 100 */ | ||
189 | static const unsigned char lcdlinear[256] = { | 210 | static const unsigned char lcdlinear[256] = { |
190 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 211 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
191 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 212 | 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 | |||
704 | target/arm/olympus/mrobe-100/backlight-mr100.c | 704 | target/arm/olympus/mrobe-100/backlight-mr100.c |
705 | target/arm/olympus/mrobe-100/button-mr100.c | 705 | target/arm/olympus/mrobe-100/button-mr100.c |
706 | target/arm/olympus/mrobe-100/lcd-mr100.c | 706 | target/arm/olympus/mrobe-100/lcd-mr100.c |
707 | target/arm/olympus/mrobe-100/lcd-as-mr100.S | ||
707 | target/arm/olympus/mrobe-100/power-mr100.c | 708 | target/arm/olympus/mrobe-100/power-mr100.c |
708 | target/arm/olympus/mrobe-100/powermgmt-mr100.c | 709 | target/arm/olympus/mrobe-100/powermgmt-mr100.c |
709 | target/arm/usb-fw-pp502x.c | 710 | 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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | |||
23 | .text | ||
24 | .align 2 | ||
25 | |||
26 | |||
27 | .global lcd_write_data | ||
28 | .type lcd_write_data,%function | ||
29 | |||
30 | lcd_write_data: | ||
31 | str lr, [sp, #-4]! | ||
32 | ldr lr, =LCD1_BASE | ||
33 | |||
34 | .loop: | ||
35 | ldrb r2, [r0], #1 | ||
36 | 1: | ||
37 | ldr r3, [lr] | ||
38 | tst r3, #LCD1_BUSY_MASK | ||
39 | bne 1b | ||
40 | str r2, [lr, #0x10] | ||
41 | |||
42 | subs r1, r1, #1 | ||
43 | bne .loop | ||
44 | |||
45 | ldr pc, [sp], #4 | ||
46 | .size lcd_write_data,.-lcd_write_data | ||
47 | |||
48 | |||
49 | .global lcd_grey_data | ||
50 | .type lcd_grey_data,%function | ||
51 | |||
52 | /* A high performance function to write grey phase data to the display, | ||
53 | * one or multiple pixels. | ||
54 | * | ||
55 | * Arguments: | ||
56 | * r0 - pixel value data address | ||
57 | * r1 - pixel phase data address | ||
58 | * r2 - pixel block count | ||
59 | * | ||
60 | * Register usage: | ||
61 | * r3/r4 - current block of phases | ||
62 | * r5/r6 - current block of values | ||
63 | * r7 - lcd data accumulator | ||
64 | * r8 - phase signs mask | ||
65 | * lr - lcd bridge address | ||
66 | */ | ||
67 | |||
68 | lcd_grey_data: | ||
69 | stmfd sp!, {r4-r8, lr} | ||
70 | mov r8, #0x80 | ||
71 | orr r8, r8, r8, lsl #8 | ||
72 | orr r8, r8, r8, lsl #16 | ||
73 | ldr lr, =LCD1_BASE | ||
74 | |||
75 | .greyloop: | ||
76 | ldmia r1, {r3-r4} /* Fetch 8 pixel phases */ | ||
77 | ldmia r0!, {r5-r6} /* Fetch 8 pixel values */ | ||
78 | |||
79 | mov r7, #0xff | ||
80 | tst r3, #0x80 | ||
81 | biceq r7, r7, #0x80 | ||
82 | tst r3, #0x8000 | ||
83 | biceq r7, r7, #0x40 | ||
84 | tst r3, #0x800000 | ||
85 | biceq r7, r7, #0x20 | ||
86 | tst r3, #0x80000000 | ||
87 | biceq r7, r7, #0x10 | ||
88 | bic r3, r3, r8 | ||
89 | add r3, r3, r5 | ||
90 | |||
91 | tst r4, #0x80 | ||
92 | biceq r7, r7, #0x08 | ||
93 | tst r4, #0x8000 | ||
94 | biceq r7, r7, #0x04 | ||
95 | tst r4, #0x800000 | ||
96 | biceq r7, r7, #0x02 | ||
97 | tst r4, #0x80000000 | ||
98 | biceq r7, r7, #0x01 | ||
99 | bic r4, r4, r8 | ||
100 | add r4, r4, r6 | ||
101 | |||
102 | stmia r1!, {r3-r4} | ||
103 | |||
104 | 1: | ||
105 | ldr r5, [lr] | ||
106 | tst r5, #LCD1_BUSY_MASK | ||
107 | bne 1b | ||
108 | str r7, [lr, #0x10] | ||
109 | |||
110 | subs r2, r2, #1 | ||
111 | bne .greyloop | ||
112 | |||
113 | ldmfd sp!, {r4-r8, pc} | ||
114 | .size lcd_grey_data,.-lcd_grey_data | ||
115 | |||
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) | |||
76 | LCD1_CMD = byte; | 76 | LCD1_CMD = byte; |
77 | } | 77 | } |
78 | 78 | ||
79 | /* send LCD data */ | ||
80 | |||
81 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
82 | { | ||
83 | while (count--) | ||
84 | { | ||
85 | while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */ | ||
86 | LCD1_DATA = *(p_bytes++); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static int xoffset; /* needed for flip */ | 79 | static int xoffset; /* needed for flip */ |
91 | 80 | ||
92 | /*** hardware configuration ***/ | 81 | /*** hardware configuration ***/ |
@@ -146,8 +135,7 @@ void lcd_init_device(void) | |||
146 | LCD1_CONTROL |= 0x4; | 135 | LCD1_CONTROL |= 0x4; |
147 | udelay(10); | 136 | udelay(10); |
148 | 137 | ||
149 | LCD1_CONTROL = 0x690; | 138 | LCD1_CONTROL = 0x0094; |
150 | LCD1_CONTROL = 0x694; | ||
151 | 139 | ||
152 | /* OF just reads these */ | 140 | /* OF just reads these */ |
153 | LCD1_CONTROL; | 141 | LCD1_CONTROL; |
@@ -206,18 +194,30 @@ void lcd_blit_mono(const unsigned char* data, int x, int by, int width, | |||
206 | } | 194 | } |
207 | } | 195 | } |
208 | 196 | ||
197 | /* Helper function for lcd_grey_phase_blit(). */ | ||
198 | void lcd_grey_data(unsigned char *values, unsigned char *phases, int count); | ||
199 | |||
209 | /* Performance function that works with an external buffer | 200 | /* Performance function that works with an external buffer |
210 | note that by and bheight are in 8-pixel units! */ | 201 | note that by and bheight are in 8-pixel units! */ |
211 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, | 202 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, |
212 | int x, int by, int width, int bheight, int stride) | 203 | int x, int by, int width, int bheight, int stride) |
213 | { | 204 | { |
214 | (void)values; | 205 | int cmd1, cmd2; |
215 | (void)phases; | 206 | |
216 | (void)x; | 207 | stride <<= 3; /* 8 pixels per block */ |
217 | (void)by; | 208 | cmd1 = LCD_CNTL_HIGHCOL | (((x + xoffset) >> 4) & 0xf); |
218 | (void)width; | 209 | cmd2 = LCD_CNTL_LOWCOL | ((x + xoffset) & 0xf); |
219 | (void)bheight; | 210 | |
220 | (void)stride; | 211 | while (bheight--) |
212 | { | ||
213 | lcd_write_command(LCD_CNTL_PAGE | (by++ & 0xff)); | ||
214 | lcd_write_command(cmd1); | ||
215 | lcd_write_command(cmd2); | ||
216 | |||
217 | lcd_grey_data(values, phases, width); | ||
218 | values += stride; | ||
219 | phases += stride; | ||
220 | } | ||
221 | } | 221 | } |
222 | 222 | ||
223 | /* Update the display. | 223 | /* Update the display. |