diff options
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S')
-rw-r--r-- | firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S | 99 |
1 files changed, 99 insertions, 0 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 | |||
46 | lcd_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 | |||
90 | 1: | ||
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 | ||