2008-01-12 00:59:18 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 by Jens Arnold
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
|
|
|
|
#if CONFIG_CPU == PP5002
|
|
|
|
.section .icode,"ax",%progbits
|
|
|
|
#else
|
|
|
|
.text
|
|
|
|
#endif
|
|
|
|
.align 2
|
|
|
|
|
|
|
|
|
|
|
|
.global lcd_write_data
|
|
|
|
.type lcd_write_data,%function
|
|
|
|
|
|
|
|
lcd_write_data:
|
2008-03-28 18:56:50 +00:00
|
|
|
str lr, [sp, #-4]!
|
|
|
|
ldr lr, =LCD1_BASE
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.loop:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r2, [r0], #1
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
#ifdef IPOD_MINI2G
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r3, [r0], #1
|
|
|
|
orr r2, r3, r2, lsl #8
|
|
|
|
orr r2, r2, #0x760000
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r2, [lr, #0x08]
|
2008-01-12 00:59:18 +00:00
|
|
|
#else
|
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r2, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r2, [r0], #1
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r2, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
subs r1, r1, #1
|
|
|
|
bne .loop
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr pc, [sp], #4
|
2008-01-13 13:58:18 +00:00
|
|
|
.size lcd_write_data,.-lcd_write_data
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef IPOD_MINI2G
|
|
|
|
|
|
|
|
.global lcd_write_data_shifted
|
|
|
|
.type lcd_write_data_shifted,%function
|
|
|
|
|
|
|
|
lcd_write_data_shifted:
|
2008-03-28 18:56:50 +00:00
|
|
|
stmfd sp!, {r4, r5, lr}
|
|
|
|
ldr lr, =LCD1_BASE
|
|
|
|
mov r5, #0x760000
|
|
|
|
ldrb r2, [r0], #1
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.sloop:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r3, [r0], #1
|
|
|
|
orr r2, r3, r2, lsl #8
|
|
|
|
ldrb r3, [r0], #1
|
|
|
|
orr r2, r3, r2, lsl #8
|
|
|
|
mov r4, r2, lsl #12
|
|
|
|
orr r4, r5, r4, lsr #16
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x08]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
subs r1, r1, #1
|
|
|
|
bne .sloop
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldmfd sp!, {r4, r5, pc}
|
2008-01-13 13:58:18 +00:00
|
|
|
.size lcd_write_data_shifted,.-lcd_write_data_shifted
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
#elif defined IPOD_MINI
|
|
|
|
|
|
|
|
.global lcd_write_data_shifted
|
|
|
|
.type lcd_write_data_shifted,%function
|
|
|
|
|
|
|
|
lcd_write_data_shifted:
|
2008-03-28 18:56:50 +00:00
|
|
|
stmfd sp!, {r4, lr}
|
|
|
|
ldr lr, =LCD1_BASE
|
|
|
|
ldrb r2, [r0], #1
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.sloop:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r3, [r0], #1
|
|
|
|
orr r2, r3, r2, lsl #8
|
|
|
|
mov r4, r2, lsr #4
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r3, [r0], #1
|
|
|
|
orr r2, r3, r2, lsl #8
|
|
|
|
mov r4, r2, lsr #4
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
subs r1, r1, #1
|
|
|
|
bne .sloop
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldmfd sp!, {r4, pc}
|
2008-01-13 13:58:18 +00:00
|
|
|
.size lcd_write_data_shifted,.-lcd_write_data_shifted
|
|
|
|
|
2008-01-12 00:59:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
.global lcd_mono_data
|
|
|
|
.type lcd_mono_data,%function
|
|
|
|
|
|
|
|
lcd_mono_data:
|
2008-03-28 18:56:50 +00:00
|
|
|
stmfd sp!, {r4, r5, lr}
|
|
|
|
ldr lr, =LCD1_BASE
|
|
|
|
adr r5, .dibits
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.mloop:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldrb r2, [r0], #1
|
|
|
|
mov r3, r2, lsr #4
|
|
|
|
ldrb r4, [r5, r3]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
#ifdef IPOD_MINI2G
|
2008-03-28 18:56:50 +00:00
|
|
|
and r3, r2, #0x0f
|
|
|
|
ldrb r3, [r5, r3]
|
|
|
|
orr r4, r3, r4, lsl #8
|
|
|
|
orr r4, r4, #0x760000
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x08]
|
2008-01-12 00:59:18 +00:00
|
|
|
#else
|
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
and r3, r2, #0x0f
|
|
|
|
ldrb r4, [r5, r3]
|
2008-01-12 00:59:18 +00:00
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r3, [lr]
|
|
|
|
tst r3, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
2008-03-28 18:56:50 +00:00
|
|
|
str r4, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
subs r1, r1, #1
|
|
|
|
bne .mloop
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldmfd sp!, {r4, r5, pc}
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.dibits:
|
|
|
|
.byte 0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F
|
|
|
|
.byte 0xC0, 0xC3, 0xCC, 0xCF, 0xF0, 0xF3, 0xFC, 0xFF
|
|
|
|
|
2008-01-13 13:58:18 +00:00
|
|
|
.size lcd_mono_data,.-lcd_mono_data
|
|
|
|
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.global lcd_grey_data
|
|
|
|
.type lcd_grey_data,%function
|
|
|
|
|
|
|
|
/* A high performance function to write grey phase data to the display,
|
|
|
|
* one or multiple pixels.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* r0 - pixel value data address
|
|
|
|
* r1 - pixel phase data address
|
|
|
|
* r2 - pixel block count
|
|
|
|
*
|
|
|
|
* Register usage:
|
|
|
|
* r3/r4 - current block of phases
|
|
|
|
* r5/r6 - current block of values
|
|
|
|
* r7 - lcd data accumulator
|
|
|
|
* r8 - phase signs mask
|
2008-03-28 18:56:50 +00:00
|
|
|
* lr - lcd bridge address
|
2008-01-12 00:59:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
lcd_grey_data:
|
2008-03-28 18:56:50 +00:00
|
|
|
stmfd sp!, {r4-r8, lr}
|
2008-01-12 00:59:18 +00:00
|
|
|
mov r8, #0x80
|
|
|
|
orr r8, r8, r8, lsl #8
|
|
|
|
orr r8, r8, r8, lsl #16
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr lr, =LCD1_BASE
|
2008-01-12 00:59:18 +00:00
|
|
|
|
|
|
|
.greyloop:
|
|
|
|
ldmia r1, {r3-r4} /* Fetch 8 pixel phases */
|
|
|
|
ldmia r0!, {r5-r6} /* Fetch 8 pixel values */
|
|
|
|
|
|
|
|
#ifdef IPOD_MINI2G /* Serial bridge mode */
|
|
|
|
mov r7, #0x760000
|
|
|
|
tst r3, #0x80
|
|
|
|
orreq r7, r7, #0xc000
|
|
|
|
tst r3, #0x8000
|
|
|
|
orreq r7, r7, #0x3000
|
|
|
|
tst r3, #0x800000
|
|
|
|
orreq r7, r7, #0x0c00
|
|
|
|
tst r3, #0x80000000
|
|
|
|
orreq r7, r7, #0x0300
|
|
|
|
bic r3, r3, r8
|
|
|
|
add r3, r3, r5
|
|
|
|
#else /* Parallel bridge mode */
|
|
|
|
mov r7, #0
|
|
|
|
tst r3, #0x80
|
|
|
|
orreq r7, r7, #0xc0
|
|
|
|
tst r3, #0x8000
|
|
|
|
orreq r7, r7, #0x30
|
|
|
|
tst r3, #0x800000
|
|
|
|
orreq r7, r7, #0x0c
|
|
|
|
tst r3, #0x80000000
|
|
|
|
orreq r7, r7, #0x03
|
|
|
|
bic r3, r3, r8
|
|
|
|
add r3, r3, r5
|
|
|
|
|
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r5, [lr]
|
2008-01-13 13:58:18 +00:00
|
|
|
tst r5, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
str r7, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
mov r7, #0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
tst r4, #0x80
|
|
|
|
orreq r7, r7, #0xc0
|
|
|
|
tst r4, #0x8000
|
|
|
|
orreq r7, r7, #0x30
|
|
|
|
tst r4, #0x800000
|
|
|
|
orreq r7, r7, #0x0c
|
|
|
|
tst r4, #0x80000000
|
|
|
|
orreq r7, r7, #0x03
|
|
|
|
bic r4, r4, r8
|
|
|
|
add r4, r4, r6
|
|
|
|
|
|
|
|
stmia r1!, {r3-r4}
|
|
|
|
|
|
|
|
1:
|
2008-03-28 18:56:50 +00:00
|
|
|
ldr r5, [lr]
|
2008-01-13 13:58:18 +00:00
|
|
|
tst r5, #LCD1_BUSY_MASK
|
2008-01-12 00:59:18 +00:00
|
|
|
bne 1b
|
|
|
|
#ifdef IPOD_MINI2G
|
2008-03-28 18:56:50 +00:00
|
|
|
str r7, [lr, #0x08]
|
2008-01-12 00:59:18 +00:00
|
|
|
#else
|
2008-03-28 18:56:50 +00:00
|
|
|
str r7, [lr, #0x10]
|
2008-01-12 00:59:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
subs r2, r2, #1
|
|
|
|
bne .greyloop
|
|
|
|
|
2008-03-28 18:56:50 +00:00
|
|
|
ldmfd sp!, {r4-r8, pc}
|
2008-01-13 13:58:18 +00:00
|
|
|
.size lcd_grey_data,.-lcd_grey_data
|
2008-01-12 00:59:18 +00:00
|
|
|
|