summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/hdd6330
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/hdd6330')
-rw-r--r--firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S140
-rw-r--r--firmware/target/arm/philips/hdd6330/lcd-hdd6330.c98
2 files changed, 0 insertions, 238 deletions
diff --git a/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S b/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S
deleted file mode 100644
index c3a7992a2e..0000000000
--- a/firmware/target/arm/philips/hdd6330/lcd-as-hdd6330.S
+++ /dev/null
@@ -1,140 +0,0 @@
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
37lcd_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
4610: @ loop
47
48 ldrb r7, [r1], #1 @ *usrc++
49 ldrb r8, [r2], #1 @ *vsrc++
50
51 sub r7, r7, #128 @ Cb -= 128
52 sub r8, r8, #128 @ Cr -= 128
53
54 add r10, r8, r8, asl #2 @ Cr*101
55 add r10, r10, r8, asl #5
56 add r10, r10, r8, asl #6
57
58 add r11, r8, r8, asl #1 @ Cr*51 + Cb*24
59 add r11, r11, r11, asl #4
60 add r11, r11, r7, asl #3
61 add r11, r11, r7, asl #4
62
63 add r12, r7, #2 @ r12 = bu = (Cb*128 + 256) >> 9
64 mov r12, r12, asr #2
65 add r10, r10, #256 @ r10 = rv = (Cr*101 + 256) >> 9
66 mov r10, r10, asr #9
67 rsb r11, r11, #128 @ r11 = guv = (-r11 + 128) >> 8
68 mov r11, r11, asr #8
69
70@ pixel_1
71 ldrb r7, [r0], #1 @ *ysrc++
72 sub r7, r7, #16 @ Y = (Y' - 16) * 37
73 add r8, r7, r7, asl #2
74 add r7, r8, r7, asl #5
75
76 add r9, r10, r7, asr #8 @ R = (Y >> 8) + rv
77 add r8, r11, r7, asr #7 @ G = (Y >> 7) + guv
78 add r7, r12, r7, asr #8 @ B = (Y >> 8) + bu
79
80 cmp r9, #31 @ clamp R
81 mvnhi r9, r9, asr #31
82 andhi r9, r9, #31
83
84 cmp r8, #63 @ clamp G
85 mvnhi r8, r8, asr #31
86 andhi r8, r8, #63
87
88 cmp r7, #31 @ clamp B
89 mvnhi r7, r7, asr #31
90 andhi r7, r7, #31
91
92 orr r6, r7, r8, lsl #5 @ pack pixel
93 orr r6, r6, r9, lsl #11
94
95 mov r7, r6, lsl #8 @ swap bytes
96 and r7, r7, #0xff00
97 add r6, r7, r6, lsr #8
98
99@ pixel_2
100 ldrb r7, [r0], #1 @ *ysrc++
101 sub r7, r7, #16 @ Y = (Y' - 16) * 37
102 add r8, r7, r7, asl #2
103 add r7, r8, r7, asl #5
104
105 add r9, r10, r7, asr #8 @ R = (Y >> 8) + rv
106 add r8, r11, r7, asr #7 @ G = (Y >> 7) + guv
107 add r7, r12, r7, asr #8 @ B = (Y >> 8) + bu
108
109 cmp r9, #31 @ clamp R
110 mvnhi r9, r9, asr #31
111 andhi r9, r9, #31
112
113 cmp r8, #63 @ clamp G
114 mvnhi r8, r8, asr #31
115 andhi r8, r8, #63
116
117 cmp r7, #31 @ clamp B
118 mvnhi r7, r7, asr #31
119 andhi r7, r7, #31
120
121 orr r7, r7, r8, lsl #5 @ pack pixel
122 orr r7, r7, r9, lsl #11
123
124 orr r6, r6, r7, lsl #24 @ swap bytes and add pixels simultaneously
125 mov r7, r7, lsr #8
126 orr r6, r6, r7, lsl #16
127
12811: @ while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_TXOK));
129 ldr r11, [r4, #0x20] @
130 tst r11, #0x1000000 @
131 beq 11b @
132
133 str r6, [r5] @ send two pixels
134
135 subs r3, r3, #2 @ decrease width
136 bgt 10b @ loop
137
138 ldmpc regs=r4-r11 @ restore regs
139 .ltorg @ dump constant pool
140 .size lcd_yuv_write_inner_loop, .-lcd_yuv_write_inner_loop
diff --git a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
index cdd3064bba..9d2fdc8519 100644
--- a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
+++ b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c
@@ -37,9 +37,6 @@
37/* whether the lcd is currently enabled or not */ 37/* whether the lcd is currently enabled or not */
38static bool lcd_enabled; 38static bool lcd_enabled;
39 39
40/* Display status */
41static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
42
43/* Value used for flipping. Must be remembered when display is turned off. */ 40/* Value used for flipping. Must be remembered when display is turned off. */
44static unsigned short flip; 41static unsigned short flip;
45 42
@@ -147,101 +144,6 @@ void lcd_set_flip(bool yesno)
147 lcd_send_data(0x08 | flip); 144 lcd_send_data(0x08 | flip);
148} 145}
149 146
150void lcd_yuv_set_options(unsigned options)
151{
152 lcd_yuv_options = options;
153}
154
155#define CSUB_X 2
156#define CSUB_Y 2
157
158/* YUV- > RGB565 conversion
159 * |R| |1.000000 -0.000001 1.402000| |Y'|
160 * |G| = |1.000000 -0.334136 -0.714136| |Pb|
161 * |B| |1.000000 1.772000 0.000000| |Pr|
162 * Scaled, normalized, rounded and tweaked to yield RGB 565:
163 * |R| |74 0 101| |Y' - 16| >> 9
164 * |G| = |74 -24 -51| |Cb - 128| >> 8
165 * |B| |74 128 0| |Cr - 128| >> 9
166*/
167
168extern void lcd_yuv_write_inner_loop(unsigned char const * const ysrc,
169 unsigned char const * const usrc,
170 unsigned char const * const vsrc,
171 int width);
172
173/* Performance function to blit a YUV bitmap directly to the LCD */
174void lcd_blit_yuv(unsigned char * const src[3],
175 int src_x, int src_y, int stride,
176 int x, int y, int width, int height)
177{
178 int h;
179
180 width = (width + 1) & ~1;
181
182 lcd_send_reg(LCD_REG_HORIZ_ADDR_START);
183 lcd_send_data(y);
184
185 lcd_send_reg(LCD_REG_HORIZ_ADDR_END);
186 lcd_send_data(y + height - 1);
187
188 lcd_send_reg(LCD_REG_VERT_ADDR_START);
189 lcd_send_data(x + x_offset);
190
191 lcd_send_reg(LCD_REG_VERT_ADDR_END);
192 lcd_send_data(x + width - 1 + x_offset);
193
194 lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM);
195
196 const int stride_div_csub_x = stride/CSUB_X;
197
198 h=0;
199 while (1)
200 {
201 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
202 const unsigned char *ysrc = src[0] + stride * src_y + src_x;
203
204 const int uvoffset = stride_div_csub_x * (src_y/CSUB_Y) +
205 (src_x/CSUB_X);
206
207 const unsigned char *usrc = src[1] + uvoffset;
208 const unsigned char *vsrc = src[2] + uvoffset;
209
210 int pixels_to_write;
211
212 if (h==0)
213 {
214 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_READY));
215 LCD2_BLOCK_CONFIG = 0;
216
217 if (height == 0) break;
218
219 pixels_to_write = (width * height) * 2;
220 h = height;
221
222 /* calculate how much we can do in one go */
223 if (pixels_to_write > 0x10000)
224 {
225 h = (0x10000/2) / width;
226 pixels_to_write = (width * h) * 2;
227 }
228
229 height -= h;
230 LCD2_BLOCK_CTRL = 0x10000080;
231 LCD2_BLOCK_CONFIG = 0xc0010000 | (pixels_to_write - 1);
232 LCD2_BLOCK_CTRL = 0x34000000;
233 }
234
235 lcd_yuv_write_inner_loop(ysrc,usrc,vsrc,width);
236
237 src_y++;
238 h--;
239 }
240
241 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_READY));
242 LCD2_BLOCK_CONFIG = 0;
243}
244
245/* Update the display. 147/* Update the display.
246 This must be called after all other LCD functions that change the display. */ 148 This must be called after all other LCD functions that change the display. */
247void lcd_update(void) 149void lcd_update(void)