diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-06 23:57:37 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-06 23:57:37 +0000 |
commit | 9737fc7c266bb2a859fd2d03540c2c4a70c74c9a (patch) | |
tree | c971ccdae24c184f2cf8eec781e975a67c0f512d /firmware | |
parent | 01eb385f577531187dcc0a34d6fdc5cee0bcad76 (diff) | |
download | rockbox-9737fc7c266bb2a859fd2d03540c2c4a70c74c9a.tar.gz rockbox-9737fc7c266bb2a859fd2d03540c2c4a70c74c9a.zip |
Iriver remote LCD driver: * Split out assembler parts. * Reintroduced the 2 transfer routine variants (low/high CPU clock), and made the version for high CPU clock a little slower because there were problems reported. The function can be slowed down more if there are still problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17006 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/lcd-remote-as-iriver.S | 302 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/lcd-remote-iriver.c | 211 |
3 files changed, 311 insertions, 204 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 3864a3478b..915d77875c 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -535,6 +535,7 @@ target/coldfire/ata-as-coldfire.S | |||
535 | target/coldfire/pcf50606-coldfire.c | 535 | target/coldfire/pcf50606-coldfire.c |
536 | target/coldfire/iriver/ata-iriver.c | 536 | target/coldfire/iriver/ata-iriver.c |
537 | target/coldfire/iriver/lcd-remote-iriver.c | 537 | target/coldfire/iriver/lcd-remote-iriver.c |
538 | target/coldfire/iriver/lcd-remote-as-iriver.S | ||
538 | target/coldfire/iriver/system-iriver.c | 539 | target/coldfire/iriver/system-iriver.c |
539 | target/coldfire/iriver/fmradio_i2c-iriver.c | 540 | target/coldfire/iriver/fmradio_i2c-iriver.c |
540 | target/coldfire/iriver/h300/sw_i2c-h300.c | 541 | target/coldfire/iriver/h300/sw_i2c-h300.c |
@@ -559,6 +560,7 @@ drivers/sw_i2c.c | |||
559 | target/coldfire/ata-as-coldfire.S | 560 | target/coldfire/ata-as-coldfire.S |
560 | target/coldfire/iriver/ata-iriver.c | 561 | target/coldfire/iriver/ata-iriver.c |
561 | target/coldfire/iriver/lcd-remote-iriver.c | 562 | target/coldfire/iriver/lcd-remote-iriver.c |
563 | target/coldfire/iriver/lcd-remote-as-iriver.S | ||
562 | target/coldfire/iriver/system-iriver.c | 564 | target/coldfire/iriver/system-iriver.c |
563 | target/coldfire/iriver/fmradio_i2c-iriver.c | 565 | target/coldfire/iriver/fmradio_i2c-iriver.c |
564 | target/coldfire/iriver/h100/adc-h100.c | 566 | target/coldfire/iriver/h100/adc-h100.c |
diff --git a/firmware/target/coldfire/iriver/lcd-remote-as-iriver.S b/firmware/target/coldfire/iriver/lcd-remote-as-iriver.S new file mode 100644 index 0000000000..0325e5176c --- /dev/null +++ b/firmware/target/coldfire/iriver/lcd-remote-as-iriver.S | |||
@@ -0,0 +1,302 @@ | |||
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 | |||
22 | #define RS_MASK 0x00010000 | ||
23 | #define CLOCK_MASK 0x10000000 | ||
24 | #define GPIO_OUT_ADDR 0x80000004 | ||
25 | |||
26 | #define CS_MASK 0x00000004 /* used in moveq.l */ | ||
27 | #define DATA_MASK 0x00040000 | ||
28 | #define GPIO1_OUT_ADDR 0x800000b4 | ||
29 | |||
30 | #define CS_TIMEOUT 10 /* HZ/10 */ | ||
31 | |||
32 | .extern cpu_frequency /* Global variable from system.c */ | ||
33 | .extern remote_byte_delay /* Global variable from lcd-remote-iriver.c */ | ||
34 | .extern remote_cs_countdown /* Global variable from lcd-remote-iriver.c */ | ||
35 | |||
36 | .section .icode,"ax",@progbits | ||
37 | |||
38 | /* Output 8 bits to the LCD. Instruction order is devised to maximize the | ||
39 | * delay between changing the data line and the CLK L->H transition, which | ||
40 | * makes the LCD controller sample DATA. | ||
41 | * Requires CLK = 0 on entry. | ||
42 | * | ||
43 | * Custom calling convention: | ||
44 | * %a0 - GPIO_OUT_ADDR | ||
45 | * %a1 - GPIO1_OUT_ADDR | ||
46 | * %d4 - data byte | ||
47 | * %d6 - DATA_MASK | ||
48 | * Clobbers: | ||
49 | * %d0..%d4 | ||
50 | */ | ||
51 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
52 | .write_byte_delayed: | ||
53 | move.l remote_byte_delay, %d0 | ||
54 | 1: | ||
55 | subq.l #1, %d0 | ||
56 | bne.s 1b | ||
57 | #endif | ||
58 | |||
59 | .write_byte: | ||
60 | move.w %sr, %d3 /* Get current interrupt level */ | ||
61 | move.w #0x2700, %sr /* Disable interrupts */ | ||
62 | |||
63 | move.l (%a1), %d0 /* Get current state of data port */ | ||
64 | move.l %d0, %d1 | ||
65 | and.l %d6, %d1 /* Check current state of data line */ | ||
66 | beq.s 1f /* and set it as previous-state bit */ | ||
67 | bset #8, %d4 | ||
68 | 1: | ||
69 | move.l %d4, %d1 /* Compute the 'bit derivative', i.e. a value */ | ||
70 | lsr.l #1, %d1 /* with 1's where the data changes from the */ | ||
71 | eor.l %d1, %d4 /* previous state, and 0's where it doesn't */ | ||
72 | swap %d4 /* Shift data to upper byte */ | ||
73 | lsl.l #8, %d4 | ||
74 | |||
75 | move.l (%a0),%d1 /* Get current state of clock port */ | ||
76 | move.l %d1, %d2 /* Precalculate opposite state of clock line */ | ||
77 | eor.l #CLOCK_MASK, %d2 | ||
78 | |||
79 | lsl.l #1, %d4 /* Invert data line for bit7 ? */ | ||
80 | bcc.s 1f /* no: skip */ | ||
81 | eor.l %d6, %d0 /* invert data bit */ | ||
82 | move.l %d0, (%a1) /* output data bit7 */ | ||
83 | nop | ||
84 | 1: | ||
85 | |||
86 | .macro bit_out | ||
87 | lsl.l #1, %d4 /* Invert data line for bit6 ? */ | ||
88 | bcc.s 1f /* no: skip */ | ||
89 | eor.l %d6, %d0 /* Invert data bit */ | ||
90 | move.l %d2, (%a0) /* Bit7: set CLK = 1 */ | ||
91 | move.l %d1, (%a0) /* set CLK = 0 */ | ||
92 | move.l %d0, (%a1) /* Output data bit6 */ | ||
93 | bra.s 2f /* slower than trapf.l - required here */ | ||
94 | 1: /* else */ | ||
95 | move.l %d2, (%a0) /* Bit7: set CLK = 1 */ | ||
96 | move.l %d1, (%a0) /* set CLK = 0 */ | ||
97 | 2: | ||
98 | .endm | ||
99 | bit_out | ||
100 | bit_out | ||
101 | bit_out | ||
102 | bit_out | ||
103 | bit_out | ||
104 | bit_out | ||
105 | bit_out | ||
106 | |||
107 | nop /* Let data line settle */ | ||
108 | move.l %d2, (%a0) /* Bit0: Set CLK = 1 */ | ||
109 | move.l %d1, (%a0) /* Set CLK = 0 */ | ||
110 | |||
111 | move.w %d3, %sr /* Restore interrupt level */ | ||
112 | rts | ||
113 | |||
114 | /* Output 8 bits to the LCD as fast as possible. Use only at < 60MHz. | ||
115 | * | ||
116 | * Custom calling convention: | ||
117 | * %a0 - GPIO_OUT_ADDR | ||
118 | * %a1 - GPIO1_OUT_ADDR | ||
119 | * %d4 - data word | ||
120 | * %d6 - DATA_MASK | ||
121 | * Clobbers: | ||
122 | * %d0..%d4 | ||
123 | */ | ||
124 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
125 | .write_byte_fast_delayed: | ||
126 | move.l remote_byte_delay, %d0 | ||
127 | 1: | ||
128 | subq.l #1, %d0 | ||
129 | bne.s 1b | ||
130 | #endif | ||
131 | |||
132 | .write_byte_fast: | ||
133 | move.w %sr, %d3 /* Get current interrupt level */ | ||
134 | move.w #0x2700,%sr /* Disable interrupts */ | ||
135 | |||
136 | move.l (%a1), %d0 /* Get current state of data port */ | ||
137 | move.l %d0, %d1 | ||
138 | and.l %d6, %d1 /* Check current state of data line */ | ||
139 | beq.s 1f /* and set it as previous-state bit */ | ||
140 | bset #8, %d4 | ||
141 | 1: | ||
142 | move.l %d4, %d1 /* Compute the 'bit derivative', i.e. a value */ | ||
143 | lsr.l #1, %d1 /* with 1's where the data changes from the */ | ||
144 | eor.l %d1, %d4 /* previous state, and 0's where it doesn't */ | ||
145 | swap %d4 /* Shift data to upper byte */ | ||
146 | lsl.l #8, %d4 | ||
147 | |||
148 | move.l (%a0), %d1 /* Get current state of clock port */ | ||
149 | move.l %d1, %d2 /* Precalculate opposite state of clock line */ | ||
150 | eor.l #CLOCK_MASK, %d2 | ||
151 | |||
152 | .macro bit_out_fast | ||
153 | lsl.l #1,%d4 /* Shift out MSB */ | ||
154 | bcc.s 1f | ||
155 | eor.l %d6, %d0 /* 1: flip data bit */ | ||
156 | move.l %d0, (%a1) /* and output new DATA state */ | ||
157 | 1: | ||
158 | move.l %d2, (%a0) /* Set CLK */ | ||
159 | move.l %d1, (%a0) /* Reset CLK */ | ||
160 | .endm | ||
161 | bit_out_fast | ||
162 | bit_out_fast | ||
163 | bit_out_fast | ||
164 | bit_out_fast | ||
165 | bit_out_fast | ||
166 | bit_out_fast | ||
167 | bit_out_fast | ||
168 | bit_out_fast | ||
169 | |||
170 | move.w %d3, %sr /* Restore interrupt level */ | ||
171 | rts | ||
172 | |||
173 | |||
174 | .global lcd_remote_write_command | ||
175 | .type lcd_remote_write_command, @function | ||
176 | |||
177 | lcd_remote_write_command: | ||
178 | lea.l (-4*4, %sp), %sp | ||
179 | movem.l %d2-%d4/%d6, (%sp) | ||
180 | |||
181 | move.l (4*4+4, %sp), %d4 /* cmd */ | ||
182 | |||
183 | lea.l GPIO_OUT_ADDR, %a0 | ||
184 | lea.l GPIO1_OUT_ADDR, %a1 | ||
185 | move.l #DATA_MASK, %d6 | ||
186 | |||
187 | clr.l remote_cs_countdown | ||
188 | |||
189 | move.l #~RS_MASK, %d0 | ||
190 | and.l %d0, (%a0) | ||
191 | moveq.l #~CS_MASK, %d0 | ||
192 | and.l %d0, (%a1) | ||
193 | |||
194 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
195 | tst.l remote_byte_delay | ||
196 | ble.s 1f | ||
197 | bsr.w .write_byte_delayed | ||
198 | bra.s 2f | ||
199 | 1: | ||
200 | #endif | ||
201 | bsr.w .write_byte | ||
202 | 2: | ||
203 | |||
204 | moveq.l #CS_TIMEOUT, %d0 | ||
205 | move.l %d0, remote_cs_countdown | ||
206 | |||
207 | movem.l (%sp), %d2-%d4/%d6 | ||
208 | lea.l (4*4, %sp), %sp | ||
209 | rts | ||
210 | |||
211 | |||
212 | .global lcd_remote_write_command_ex | ||
213 | .type lcd_remote_write_command_ex, @function | ||
214 | |||
215 | lcd_remote_write_command_ex: | ||
216 | lea.l (-4*4, %sp), %sp | ||
217 | movem.l %d2-%d4/%d6, (%sp) | ||
218 | |||
219 | lea.l GPIO_OUT_ADDR, %a0 | ||
220 | lea.l GPIO1_OUT_ADDR, %a1 | ||
221 | move.l #DATA_MASK, %d6 | ||
222 | |||
223 | clr.l remote_cs_countdown | ||
224 | |||
225 | move.l #~RS_MASK, %d0 | ||
226 | and.l %d0, (%a0) | ||
227 | moveq.l #~CS_MASK, %d0 | ||
228 | and.l %d0, (%a1) | ||
229 | |||
230 | move.l (4*4+4, %sp), %d4 | ||
231 | |||
232 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
233 | tst.l remote_byte_delay | ||
234 | ble.s 1f | ||
235 | bsr.w .write_byte_delayed | ||
236 | move.l (4*4+8, %sp), %d4 | ||
237 | bsr.w .write_byte_delayed | ||
238 | bra.s 2f | ||
239 | 1: | ||
240 | #endif | ||
241 | bsr.w .write_byte | ||
242 | move.l (4*4+8, %sp), %d4 | ||
243 | bsr.w .write_byte | ||
244 | 2: | ||
245 | |||
246 | moveq.l #CS_TIMEOUT, %d0 | ||
247 | move.l %d0, remote_cs_countdown | ||
248 | |||
249 | movem.l (%sp), %d2-%d4/%d6 | ||
250 | lea.l (4*4, %sp), %sp | ||
251 | rts | ||
252 | |||
253 | |||
254 | .global lcd_remote_write_data | ||
255 | .type lcd_remote_write_data, @function | ||
256 | |||
257 | lcd_remote_write_data: | ||
258 | lea.l (-7*4, %sp), %sp | ||
259 | movem.l %d2-%d6/%a2-%a3, (%sp) | ||
260 | |||
261 | move.l (7*4+4, %sp), %a2 /* p_bytes */ | ||
262 | move.l (7*4+8, %sp), %d5 /* count */ | ||
263 | |||
264 | lea.l GPIO_OUT_ADDR, %a0 | ||
265 | lea.l GPIO1_OUT_ADDR, %a1 | ||
266 | move.l #DATA_MASK, %d6 | ||
267 | |||
268 | lea.l .write_byte, %a3 | ||
269 | move.l cpu_frequency, %d0 | ||
270 | cmp.l #60000000, %d0 | ||
271 | bhi.b 1f | ||
272 | lea.l .write_byte_fast, %a3 | ||
273 | 1: | ||
274 | |||
275 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
276 | tst.l remote_byte_delay | ||
277 | ble.s 1f | ||
278 | moveq.l #(.write_byte_delayed - .write_byte), %d0 | ||
279 | add.l %d0, %a3 | ||
280 | 1: | ||
281 | #endif | ||
282 | |||
283 | clr.l remote_cs_countdown | ||
284 | |||
285 | move.l #RS_MASK, %d0 | ||
286 | or.l %d0, (%a0) | ||
287 | moveq.l #~CS_MASK, %d0 | ||
288 | and.l %d0, (%a1) | ||
289 | |||
290 | .wd_loop: | ||
291 | clr.l %d4 | ||
292 | move.b (%a2)+, %d4 | ||
293 | jsr (%a3) | ||
294 | subq.l #1, %d5 | ||
295 | bne.s .wd_loop | ||
296 | |||
297 | moveq.l #CS_TIMEOUT, %d0 | ||
298 | move.l %d0, remote_cs_countdown | ||
299 | |||
300 | movem.l (%sp), %d2-%d6/%a2-%a3 | ||
301 | lea.l (7*4, %sp), %sp | ||
302 | rts | ||
diff --git a/firmware/target/coldfire/iriver/lcd-remote-iriver.c b/firmware/target/coldfire/iriver/lcd-remote-iriver.c index 6ff76f3dd6..85ba0fef7a 100644 --- a/firmware/target/coldfire/iriver/lcd-remote-iriver.c +++ b/firmware/target/coldfire/iriver/lcd-remote-iriver.c | |||
@@ -56,13 +56,13 @@ | |||
56 | static int xoffset; /* needed for flip */ | 56 | static int xoffset; /* needed for flip */ |
57 | 57 | ||
58 | /* timeout counter for deasserting /CS after access, <0 means not counting */ | 58 | /* timeout counter for deasserting /CS after access, <0 means not counting */ |
59 | static int cs_countdown IDATA_ATTR = 0; | 59 | int remote_cs_countdown IDATA_ATTR = 0; |
60 | #define CS_TIMEOUT (HZ/10) | 60 | #define CS_TIMEOUT (HZ/10) |
61 | 61 | ||
62 | #ifdef HAVE_REMOTE_LCD_TICKING | 62 | #ifdef HAVE_REMOTE_LCD_TICKING |
63 | /* If set to true, will prevent "ticking" to headphones. */ | 63 | /* If set to true, will prevent "ticking" to headphones. */ |
64 | static bool emireduce = false; | 64 | static bool emireduce = false; |
65 | static int byte_delay = 0; | 65 | int remote_byte_delay = 0; /* used in lcd-remote-as-iriver.S */ |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | bool remote_initialized = false; | 68 | bool remote_initialized = false; |
@@ -74,203 +74,6 @@ static bool cached_flip = false; | |||
74 | static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING; | 74 | static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING; |
75 | 75 | ||
76 | 76 | ||
77 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
78 | static inline void _byte_delay(int delay) | ||
79 | { | ||
80 | asm ( | ||
81 | "move.l %[dly], %%d0 \n" | ||
82 | "ble.s 2f \n" | ||
83 | "1: \n" | ||
84 | "subq.l #1, %%d0 \n" | ||
85 | "bne.s 1b \n" | ||
86 | "2: \n" | ||
87 | : /* outputs */ | ||
88 | : /* inputs */ | ||
89 | [dly]"d"(delay) | ||
90 | : /* clobbers */ | ||
91 | "d0" | ||
92 | ); | ||
93 | } | ||
94 | #endif /* HAVE_REMOTE_LCD_TICKING */ | ||
95 | |||
96 | /* Low-level byte writer. Instruction order is devised to maximize the delay | ||
97 | * between changing the data line and the CLK L->H transition, which makes | ||
98 | * the LCD controller sample DATA, so it's fast yet usable even when boosted. | ||
99 | * Requires CLK low on entry */ | ||
100 | static inline void _write_byte(unsigned data) | ||
101 | { | ||
102 | asm volatile ( | ||
103 | "move.w %%sr, %%d3 \n" /* Get current interrupt level */ | ||
104 | "move.w #0x2700, %%sr \n" /* Disable interrupts */ | ||
105 | |||
106 | "move.l (%[gpo1]), %%d0 \n" /* Get current state of data port */ | ||
107 | "move.l %%d0, %%d1 \n" | ||
108 | "and.l %[dbit], %%d1 \n" /* Check current state of data line */ | ||
109 | "beq.s 1f \n" /* and set it as previous-state bit */ | ||
110 | "bset #8, %[data] \n" | ||
111 | "1: \n" | ||
112 | "move.l %[data], %%d1 \n" /* Compute the 'bit derivative', i.e. a value */ | ||
113 | "lsr.l #1, %%d1 \n" /* with 1's where the data changes from the */ | ||
114 | "eor.l %%d1, %[data] \n" /* previous state, and 0's where it doesn't */ | ||
115 | "swap %[data] \n" /* Shift data to upper byte */ | ||
116 | "lsl.l #8, %[data] \n" | ||
117 | |||
118 | "move.l (%[gpo0]),%%d1 \n" /* Get current state of clock port */ | ||
119 | "move.l %%d1, %%d2 \n" /* Precalculate opposite state of clock line */ | ||
120 | "eor.l %[cbit], %%d2 \n" | ||
121 | |||
122 | "lsl.l #1, %[data] \n" /* Invert data line for bit7 ? */ | ||
123 | "bcc.s 1f \n" /* no: skip */ | ||
124 | "eor.l %[dbit], %%d0 \n" /* invert data bit */ | ||
125 | "move.l %%d0, (%[gpo1]) \n" /* output data bit7 */ | ||
126 | "1: \n" | ||
127 | |||
128 | "lsl.l #1, %[data] \n" /* Invert data line for bit6 ? */ | ||
129 | "bcc.s 1f \n" /* no: skip */ | ||
130 | "eor.l %[dbit], %%d0 \n" /* Invert data bit */ | ||
131 | "move.l %%d2, (%[gpo0]) \n" /* Bit7: set CLK = 1 */ | ||
132 | "move.l %%d1, (%[gpo0]) \n" /* set CLK = 0 */ | ||
133 | "move.l %%d0, (%[gpo1]) \n" /* Output data bit6 */ | ||
134 | ".word 0x51fb \n" /* trapf.l - skip next 2 insns */ | ||
135 | "1: \n" /* else */ | ||
136 | "move.l %%d2, (%[gpo0]) \n" /* Bit7: set CLK = 1 */ | ||
137 | "move.l %%d1, (%[gpo0]) \n" /* set CLK = 0 */ | ||
138 | |||
139 | "lsl.l #1, %[data] \n" /* Unrolled */ | ||
140 | "bcc.s 1f \n" | ||
141 | "eor.l %[dbit], %%d0 \n" | ||
142 | "move.l %%d2, (%[gpo0]) \n" | ||
143 | "move.l %%d1, (%[gpo0]) \n" | ||
144 | "move.l %%d0, (%[gpo1]) \n" | ||
145 | ".word 0x51fb \n" | ||
146 | "1: \n" | ||
147 | "move.l %%d2, (%[gpo0]) \n" | ||
148 | "move.l %%d1, (%[gpo0]) \n" | ||
149 | |||
150 | "lsl.l #1, %[data] \n" | ||
151 | "bcc.s 1f \n" | ||
152 | "eor.l %[dbit], %%d0 \n" | ||
153 | "move.l %%d2, (%[gpo0]) \n" | ||
154 | "move.l %%d1, (%[gpo0]) \n" | ||
155 | "move.l %%d0, (%[gpo1]) \n" | ||
156 | ".word 0x51fb \n" | ||
157 | "1: \n" | ||
158 | "move.l %%d2, (%[gpo0]) \n" | ||
159 | "move.l %%d1, (%[gpo0]) \n" | ||
160 | |||
161 | "lsl.l #1, %[data] \n" | ||
162 | "bcc.s 1f \n" | ||
163 | "eor.l %[dbit], %%d0 \n" | ||
164 | "move.l %%d2, (%[gpo0]) \n" | ||
165 | "move.l %%d1, (%[gpo0]) \n" | ||
166 | "move.l %%d0, (%[gpo1]) \n" | ||
167 | ".word 0x51fb \n" | ||
168 | "1: \n" | ||
169 | "move.l %%d2, (%[gpo0]) \n" | ||
170 | "move.l %%d1, (%[gpo0]) \n" | ||
171 | |||
172 | "lsl.l #1, %[data] \n" | ||
173 | "bcc.s 1f \n" | ||
174 | "eor.l %[dbit], %%d0 \n" | ||
175 | "move.l %%d2, (%[gpo0]) \n" | ||
176 | "move.l %%d1, (%[gpo0]) \n" | ||
177 | "move.l %%d0, (%[gpo1]) \n" | ||
178 | ".word 0x51fb \n" | ||
179 | "1: \n" | ||
180 | "move.l %%d2, (%[gpo0]) \n" | ||
181 | "move.l %%d1, (%[gpo0]) \n" | ||
182 | |||
183 | "lsl.l #1, %[data] \n" | ||
184 | "bcc.s 1f \n" | ||
185 | "eor.l %[dbit], %%d0 \n" | ||
186 | "move.l %%d2, (%[gpo0]) \n" | ||
187 | "move.l %%d1, (%[gpo0]) \n" | ||
188 | "move.l %%d0, (%[gpo1]) \n" | ||
189 | ".word 0x51fb \n" | ||
190 | "1: \n" | ||
191 | "move.l %%d2, (%[gpo0]) \n" | ||
192 | "move.l %%d1, (%[gpo0]) \n" | ||
193 | |||
194 | "lsl.l #1, %[data] \n" | ||
195 | "bcc.s 1f \n" | ||
196 | "eor.l %[dbit], %%d0 \n" | ||
197 | "move.l %%d2, (%[gpo0]) \n" | ||
198 | "move.l %%d1, (%[gpo0]) \n" | ||
199 | "move.l %%d0, (%[gpo1]) \n" | ||
200 | ".word 0x51fb \n" | ||
201 | "1: \n" | ||
202 | "move.l %%d2, (%[gpo0]) \n" | ||
203 | "move.l %%d1, (%[gpo0]) \n" | ||
204 | |||
205 | "nop \n" /* Let data line settle */ | ||
206 | "move.l %%d2, (%[gpo0]) \n" /* Bit0: Set CLK = 1 */ | ||
207 | "move.l %%d1, (%[gpo0]) \n" /* Set CLK = 0 */ | ||
208 | |||
209 | "move.w %%d3, %%sr \n" /* Restore interrupt level */ | ||
210 | : /* outputs */ | ||
211 | [data]"+d"(data) | ||
212 | : /* inputs */ | ||
213 | [gpo0]"a"(&GPIO_OUT), | ||
214 | [cbit]"i"(0x10000000), | ||
215 | [gpo1]"a"(&GPIO1_OUT), | ||
216 | [dbit]"d"(0x00040000) | ||
217 | : /* clobbers */ | ||
218 | "d0", "d1", "d2", "d3" | ||
219 | ); | ||
220 | } | ||
221 | |||
222 | void lcd_remote_write_command(int cmd) | ||
223 | { | ||
224 | cs_countdown = 0; | ||
225 | RS_LO; | ||
226 | CS_LO; | ||
227 | |||
228 | _write_byte(cmd); | ||
229 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
230 | _byte_delay(byte_delay); | ||
231 | #endif | ||
232 | |||
233 | cs_countdown = CS_TIMEOUT; | ||
234 | } | ||
235 | |||
236 | void lcd_remote_write_command_ex(int cmd, int data) | ||
237 | { | ||
238 | cs_countdown = 0; | ||
239 | RS_LO; | ||
240 | CS_LO; | ||
241 | |||
242 | _write_byte(cmd); | ||
243 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
244 | _byte_delay(byte_delay); | ||
245 | #endif | ||
246 | _write_byte(data); | ||
247 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
248 | _byte_delay(byte_delay); | ||
249 | #endif | ||
250 | |||
251 | cs_countdown = CS_TIMEOUT; | ||
252 | } | ||
253 | |||
254 | void lcd_remote_write_data(const unsigned char* p_bytes, int count) ICODE_ATTR; | ||
255 | void lcd_remote_write_data(const unsigned char* p_bytes, int count) | ||
256 | { | ||
257 | const unsigned char *p_end = p_bytes + count; | ||
258 | |||
259 | cs_countdown = 0; | ||
260 | RS_HI; | ||
261 | CS_LO; | ||
262 | |||
263 | while (p_bytes < p_end) | ||
264 | { | ||
265 | _write_byte(*p_bytes++); | ||
266 | #ifdef HAVE_REMOTE_LCD_TICKING | ||
267 | _byte_delay(byte_delay); | ||
268 | #endif | ||
269 | } | ||
270 | |||
271 | cs_countdown = CS_TIMEOUT; | ||
272 | } | ||
273 | |||
274 | /*** hardware configuration ***/ | 77 | /*** hardware configuration ***/ |
275 | 78 | ||
276 | int lcd_remote_default_contrast(void) | 79 | int lcd_remote_default_contrast(void) |
@@ -448,9 +251,9 @@ static void remote_tick(void) | |||
448 | } | 251 | } |
449 | 252 | ||
450 | /* handle chip select timeout */ | 253 | /* handle chip select timeout */ |
451 | if (cs_countdown >= 0) | 254 | if (remote_cs_countdown >= 0) |
452 | cs_countdown--; | 255 | remote_cs_countdown--; |
453 | if (cs_countdown == 0) | 256 | if (remote_cs_countdown == 0) |
454 | CS_HI; | 257 | CS_HI; |
455 | } | 258 | } |
456 | #endif | 259 | #endif |
@@ -496,7 +299,7 @@ void lcd_remote_update(void) | |||
496 | 299 | ||
497 | #ifdef HAVE_REMOTE_LCD_TICKING | 300 | #ifdef HAVE_REMOTE_LCD_TICKING |
498 | /* Adjust byte delay for emi reduction. */ | 301 | /* Adjust byte delay for emi reduction. */ |
499 | byte_delay = emireduce ? cpu_frequency / 192800 - 90: 0; | 302 | remote_byte_delay = emireduce ? cpu_frequency / 192800 - 100: 0; |
500 | #endif | 303 | #endif |
501 | 304 | ||
502 | /* Copy display bitmap to hardware */ | 305 | /* Copy display bitmap to hardware */ |
@@ -530,7 +333,7 @@ void lcd_remote_update_rect(int x, int y, int width, int height) | |||
530 | 333 | ||
531 | #ifdef HAVE_REMOTE_LCD_TICKING | 334 | #ifdef HAVE_REMOTE_LCD_TICKING |
532 | /* Adjust byte delay for emi reduction */ | 335 | /* Adjust byte delay for emi reduction */ |
533 | byte_delay = emireduce ? cpu_frequency / 192800 - 90: 0; | 336 | remote_byte_delay = emireduce ? cpu_frequency / 192800 - 100: 0; |
534 | #endif | 337 | #endif |
535 | 338 | ||
536 | /* Copy specified rectange bitmap to hardware */ | 339 | /* Copy specified rectange bitmap to hardware */ |