diff options
Diffstat (limited to 'firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S')
-rw-r--r-- | firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S b/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S new file mode 100644 index 0000000000..364eb5b08f --- /dev/null +++ b/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S | |||
@@ -0,0 +1,149 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Szymon Dziok | ||
11 | * | ||
12 | * Philips Gogear HDD6330 LCD assembly routine | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "cpu.h" | ||
26 | |||
27 | /**************************************************************************** | ||
28 | void lcd_yuv_write_inner_loop(unsigned char const * const ysrc, | ||
29 | unsigned char const * const usrc, | ||
30 | unsigned char const * const vsrc, | ||
31 | int width); | ||
32 | */ | ||
33 | .section .icode, "ax", %progbits | ||
34 | .align 2 | ||
35 | .global lcd_yuv_write_inner_loop | ||
36 | .type lcd_yuv_write_inner_loop, %function | ||
37 | lcd_yuv_write_inner_loop: | ||
38 | @ r0 = ysrc | ||
39 | @ r1 = usrc | ||
40 | @ r2 = vsrc | ||
41 | @ r3 = width | ||
42 | stmfd sp!, { r4-r11, lr } @ save regs | ||
43 | mov r4, #0x70000000 @ r4 = LCD2_BLOCK_CTRL - 0x20 | ||
44 | add r4, r4, #0x8a00 @ | ||
45 | add r5, r4, #0x100 @ r5 = LCD2_BLOCK_DATA | ||
46 | 10: @ loop | ||
47 | |||
48 | ldrb r7, [r1], #1 @ *usrc++ | ||
49 | ldrb r8, [r2], #1 @ *vsrc++ | ||
50 | |||
51 | add r10, r8, r8, asl #2 @ 101* vsrc | ||
52 | add r10, r10, r8, asl #5 | ||
53 | add r10, r10, r8, asl #6 | ||
54 | sub r10, r10, #0x3600 | ||
55 | sub r10, r10, #0x0020 @ -13856 (ROUNDOFFSR) | ||
56 | |||
57 | add r11, r8, r8, asl #1 @ 51*vsrc + 24*usrc | ||
58 | add r11, r11, r11, asl #4 | ||
59 | add r11, r11, r7, asl #3 | ||
60 | add r11, r11, r7, asl #4 | ||
61 | mov r12, #0x2100 | ||
62 | add r12, r12, #0x60 @ +8544 (ROUNDOFFSG) - r11 | ||
63 | rsb r11, r11, r12 | ||
64 | |||
65 | mov r12, r7, asl #7 @ 128 * usrc | ||
66 | sub r12, r12, #0x4300 | ||
67 | sub r12, r12, #0x00a0 @ -17312 (ROUNDOFFSB) | ||
68 | |||
69 | @ pixel_1 | ||
70 | ldrb r8, [r0], #1 @ *ysrc++ | ||
71 | mov r7, r8, asl #1 | ||
72 | add r7, r7, r8, asl #3 | ||
73 | add r7, r7, r8, asl #6 @ ysrc * 74 | ||
74 | |||
75 | add r9, r10, r7 | ||
76 | mov r9, r9, asr #9 @ R | ||
77 | |||
78 | add r8, r11, r7 | ||
79 | mov r8, r8, asr #8 @ G | ||
80 | |||
81 | add r7, r12, r7 | ||
82 | mov r7, r7, asr #9 @ B | ||
83 | |||
84 | cmp r9, #31 @ clamp R | ||
85 | mvnhi r9, r9, asr #31 | ||
86 | andhi r9, r9, #31 | ||
87 | |||
88 | cmp r8, #63 @ clamp G | ||
89 | mvnhi r8, r8, asr #31 | ||
90 | andhi r8, r8, #63 | ||
91 | |||
92 | cmp r7, #31 @ clamp B | ||
93 | mvnhi r7, r7, asr #31 | ||
94 | andhi r7, r7, #31 | ||
95 | |||
96 | orr r6, r7, r8, lsl #5 @ pack pixel | ||
97 | orr r6, r6, r9, lsl #11 | ||
98 | |||
99 | mov r7, r6, lsl #8 @ swap bytes | ||
100 | and r7, r7, #0xff00 | ||
101 | add r6, r7, r6, lsr #8 | ||
102 | |||
103 | @ pixel_2 | ||
104 | ldrb r8, [r0], #1 @ *ysrc++ | ||
105 | mov r7, r8, asl #1 | ||
106 | add r7, r7, r8, asl #3 | ||
107 | add r7, r7, r8, asl #6 @ ysrc * 74 | ||
108 | |||
109 | add r9, r10, r7 | ||
110 | mov r9, r9, asr #9 @ R | ||
111 | |||
112 | add r8, r11, r7 | ||
113 | mov r8, r8, asr #8 @ G | ||
114 | |||
115 | add r7, r12, r7 | ||
116 | mov r7, r7, asr #9 @ B | ||
117 | |||
118 | cmp r9, #31 @ clamp R | ||
119 | mvnhi r9, r9, asr #31 | ||
120 | andhi r9, r9, #31 | ||
121 | |||
122 | cmp r8, #63 @ clamp G | ||
123 | mvnhi r8, r8, asr #31 | ||
124 | andhi r8, r8, #63 | ||
125 | |||
126 | cmp r7, #31 @ clamp B | ||
127 | mvnhi r7, r7, asr #31 | ||
128 | andhi r7, r7, #31 | ||
129 | |||
130 | orr r7, r7, r8, lsl #5 @ pack pixel | ||
131 | orr r7, r7, r9, lsl #11 | ||
132 | |||
133 | orr r6, r6, r7, lsl #24 @ swap bytes and add pixels simultaneously | ||
134 | mov r7, r7, lsr #8 | ||
135 | orr r6, r6, r7, lsl #16 | ||
136 | |||
137 | 11: @ while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_TXOK)); | ||
138 | ldr r11, [r4, #0x20] @ | ||
139 | tst r11, #0x1000000 @ | ||
140 | beq 11b @ | ||
141 | |||
142 | str r6, [r5] @ send two pixels | ||
143 | |||
144 | subs r3, r3, #2 @ decrease width | ||
145 | bgt 10b @ loop | ||
146 | |||
147 | ldmpc regs=r4-r11 @ restore regs | ||
148 | .ltorg @ dump constant pool | ||
149 | .size lcd_yuv_write_inner_loop, .-lcd_yuv_write_inner_loop | ||