summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-clip
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clip')
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S99
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c30
2 files changed, 117 insertions, 12 deletions
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S b/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S
new file mode 100644
index 0000000000..aab46861ba
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S
@@ -0,0 +1,99 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Jens Arnold
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "as3525.h"
23
24 .text
25 .align 2
26
27 .global lcd_grey_data
28 .type lcd_grey_data,%function
29
30/* A high performance function to write grey phase data to the display,
31 * one or multiple pixels.
32 *
33 * Arguments:
34 * r0 - pixel value data address
35 * r1 - pixel phase data address
36 * r2 - pixel block count
37 *
38 * Register usage:
39 * r3/r4 - current block of phases
40 * r5/r6 - current block of values
41 * r7 - lcd data accumulator
42 * r8 - phase signs mask
43 * lr - lcd bridge address
44 */
45
46lcd_grey_data:
47 stmfd sp!, {r4-r8, lr}
48 mov r8, #0x80
49 orr r8, r8, r8, lsl #8
50 orr r8, r8, r8, lsl #16
51
52 ldr lr, =GPIOA_BASE
53 mov r3, #(1<<5)
54 str r3, [lr, #(4*(1<<5))] @ set pin D/C# of LCD controller (data)
55
56 ldr lr, =DBOP_BASE
57
58.greyloop:
59 ldmia r1, {r3-r4} /* Fetch 8 pixel phases */
60 ldmia r0!, {r5-r6} /* Fetch 8 pixel values */
61
62 mov r7, #0xff
63 tst r3, #0x80
64 biceq r7, r7, #0x80
65 tst r3, #0x8000
66 biceq r7, r7, #0x40
67 tst r3, #0x800000
68 biceq r7, r7, #0x20
69 tst r3, #0x80000000
70 biceq r7, r7, #0x10
71 bic r3, r3, r8
72 add r3, r3, r5
73
74 tst r4, #0x80
75 biceq r7, r7, #0x08
76 tst r4, #0x8000
77 biceq r7, r7, #0x04
78 tst r4, #0x800000
79 biceq r7, r7, #0x02
80 tst r4, #0x80000000
81 biceq r7, r7, #0x01
82 bic r4, r4, r8
83 add r4, r4, r6
84
85 stmia r1!, {r3-r4}
86
87 orr r7, r7, r7, lsl #8 @ we set 15:13 to the MSb and 3:0 to the LSb
88 strh r7, [lr, #0x10] @ DBOP_DOUT
89
901:
91 ldr r5, [lr, #0xC] @ DBOP_STAT
92 ands r5, r5, #(1<<10) @ wait until push fifo empties
93 beq 1b
94
95 subs r2, r2, #1
96 bne .greyloop
97
98 ldmfd sp!, {r4-r8, pc}
99 .size lcd_grey_data,.-lcd_grey_data
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
index f1e1c24b85..703b7e1307 100644
--- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
@@ -88,6 +88,7 @@ void lcd_write_command(int byte)
88 GPIOA_PIN(5) = 0; 88 GPIOA_PIN(5) = 0;
89 89
90 /* Write command */ 90 /* Write command */
91 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
91 DBOP_DOUT = (byte << 8) | byte; 92 DBOP_DOUT = (byte << 8) | byte;
92 93
93 /* While push fifo is not empty */ 94 /* While push fifo is not empty */
@@ -103,6 +104,7 @@ void lcd_write_data(const fb_data* p_bytes, int count)
103 while (count--) 104 while (count--)
104 { 105 {
105 /* Write pixels */ 106 /* Write pixels */
107 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
106 DBOP_DOUT = (*p_bytes << 8) | *p_bytes; 108 DBOP_DOUT = (*p_bytes << 8) | *p_bytes;
107 109
108 p_bytes++; /* next packed pixels */ 110 p_bytes++; /* next packed pixels */
@@ -266,26 +268,30 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
266 } 268 }
267} 269}
268 270
271/* Helper function for lcd_grey_phase_blit(). */
272void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
269 273
270/* Performance function that works with an external buffer 274/* Performance function that works with an external buffer
271 note that by and bheight are in 8-pixel units! */ 275 note that by and bheight are in 8-pixel units! */
272void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, 276void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
273 int x, int by, int width, int bheight, int stride) 277 int x, int by, int width, int bheight, int stride)
274{ 278{
275 /* TODO */
276
277#if 0
278 if(!display_on) 279 if(!display_on)
279 return; 280 return;
280#endif 281
281 282 stride <<= 3; /* 8 pixels per block */
282 (void)values; 283 /* Copy display bitmap to hardware */
283 (void)phases; 284 while (bheight--)
284 (void)x; 285 {
285 (void)by; 286 lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
286 (void)width; 287 lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2+xoffset)>>4) & 0xf));
287 (void)bheight; 288 lcd_write_command (LCD_CNTL_LOWCOL | ((x+2+xoffset) & 0xf));
288 (void)stride; 289
290 lcd_grey_data(values, phases, width);
291
292 values += stride;
293 phases += stride;
294 }
289} 295}
290 296
291/* Update the display. 297/* Update the display.