summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/ipod/video/lcd-as-video.S
blob: 1b982c75cebde0e23e22816db483afa9d739f5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2007 by Andree Buschmann
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#include "config.h"

    .section .icode, "ax", %progbits

/****************************************************************************
 * void lcd_write_data(const fb_data *addr, 
 *                     int pixelcount);
 * 
 * Writes pixelcount pixels from src-pointer (lcd_framebuffer) to BCM dataport.
 * Use the sequence 2:2:2:2 (2 = read/write 2 regs) for best performance.
 */
    .align  2
    .global lcd_write_data
    .type   lcd_write_data, %function
                                      /* r0 = addr, must be aligned */
lcd_write_data:                       /* r1 = pixel count, must be even */
    stmfd   sp!, {r4, lr}
    mov     lr, #0x30000000           /* LCD data port */

    subs    r1, r1, #16
.loop16:
    ldmgeia r0!, {r2-r3}
    stmgeia lr,  {r2-r3}
    ldmgeia r0!, {r2-r3}
    stmgeia lr,  {r2-r3}
    ldmgeia r0!, {r2-r3}
    stmgeia lr,  {r2-r3}
    ldmgeia r0!, {r2-r3}
    stmgeia lr,  {r2-r3}
    subges  r1, r1, #16
    bge     .loop16

    /* no need to correct the count, we're just checking bits from now */
    tst     r1, #8
    ldmneia r0!, {r2-r4, r12}
    stmneia lr,  {r2-r4, r12}
    tst     r1, #4
    ldmneia r0!, {r2-r3}
    stmneia lr,  {r2-r3}
    tst     r1, #2
    ldrne   r3, [r0], #4
    strne   r3, [lr]

    ldmpc   regs=r4