1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 by Szymon Dziok
12 * Philips Gogear HDD6330 LCD assembly routine
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.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
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,
33 .section .icode, "ax", %progbits
35 .global lcd_yuv_write_inner_loop
36 .type lcd_yuv_write_inner_loop, %function
37 lcd_yuv_write_inner_loop:
42 stmfd sp!, { r4-r11, lr } @ save regs
43 mov r4, #0x70000000 @ r4 = LCD2_BLOCK_CTRL - 0x20
45 add r5, r4, #0x100 @ r5 = LCD2_BLOCK_DATA
48 ldrb r7, [r1], #1 @ *usrc++
49 ldrb r8, [r2], #1 @ *vsrc++
51 add r10, r8, r8, asl #2 @ 101* vsrc
52 add r10, r10, r8, asl #5
53 add r10, r10, r8, asl #6
55 sub r10, r10, #0x0020 @ -13856 (ROUNDOFFSR)
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
62 add r12, r12, #0x60 @ +8544 (ROUNDOFFSG) - r11
65 mov r12, r7, asl #7 @ 128 * usrc
67 sub r12, r12, #0x00a0 @ -17312 (ROUNDOFFSB)
70 ldrb r8, [r0], #1 @ *ysrc++
72 add r7, r7, r8, asl #3
73 add r7, r7, r8, asl #6 @ ysrc * 74
76 mov r9, r9, asr #9 @ R
79 mov r8, r8, asr #8 @ G
82 mov r7, r7, asr #9 @ B
96 orr r6, r7, r8, lsl #5 @ pack pixel
97 orr r6, r6, r9, lsl #11
99 mov r7, r6, lsl #8 @ swap bytes
101 add r6, r7, r6, lsr #8
104 ldrb r8, [r0], #1 @ *ysrc++
106 add r7, r7, r8, asl #3
107 add r7, r7, r8, asl #6 @ ysrc * 74
110 mov r9, r9, asr #9 @ R
113 mov r8, r8, asr #8 @ G
116 mov r7, r7, asr #9 @ B
118 cmp r9, #31 @ clamp R
119 mvnhi r9, r9, asr #31
122 cmp r8, #63 @ clamp G
123 mvnhi r8, r8, asr #31
126 cmp r7, #31 @ clamp B
127 mvnhi r7, r7, asr #31
130 orr r7, r7, r8, lsl #5 @ pack pixel
131 orr r7, r7, r9, lsl #11
133 orr r6, r6, r7, lsl #24 @ swap bytes and add pixels simultaneously
135 orr r6, r6, r7, lsl #16
137 11: @ while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_TXOK));
138 ldr r11, [r4, #0x20] @
139 tst r11, #0x1000000 @
142 str r6, [r5] @ send two pixels
144 subs r3, r3, #2 @ decrease width
147 ldmpc regs=r4-r11 @ restore regs
148 .ltorg @ dump constant pool
149 .size lcd_yuv_write_inner_loop, .-lcd_yuv_write_inner_loop