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 /firmware | |
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
Diffstat (limited to 'firmware')
-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 |
3 files changed, 136 insertions, 20 deletions
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. |