1
0
Fork 0
forked from len0rd/rockbox

Samsung YH920 : greylib support based on ipod/lcd-as-gray.S

Demo plugins run fine, mpegplayer data aborts for yet unknown reasons

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22876 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2009-10-02 17:51:05 +00:00
parent 2b7bc42deb
commit c46b44f20b
3 changed files with 173 additions and 7 deletions

View file

@ -1394,6 +1394,7 @@ target/arm/samsung/button-yh82x_yh92x.c
target/arm/samsung/power-yh82x_yh92x.c
target/arm/samsung/yh920/backlight-yh920.c
target/arm/samsung/yh920/lcd-yh920.c
target/arm/samsung/yh920/lcd-as-yh920.S
target/arm/samsung/yh920/powermgmt-yh920.c
#endif /* SIMULATOR */
#endif /* SAMSUNG_YH920 */

View file

@ -0,0 +1,168 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Jens Arnold
* Modified from ipod/lcd-as-gray.S for YH920 by Rafaël Carré
*
* 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"
#include "cpu.h"
.text
.align 2
.global lcd_write_data
.type lcd_write_data,%function
lcd_write_data:
ldr r12, =LCD1_BASE
.loop:
ldrb r2, [r0], #1
1:
ldr r3, [r12]
tst r3, #LCD1_BUSY_MASK
bne 1b
str r2, [r12, #0x10]
ldrb r2, [r0], #1
1:
ldr r3, [r12]
tst r3, #LCD1_BUSY_MASK
bne 1b
str r2, [r12, #0x10]
subs r1, r1, #1
bne .loop
bx lr
.size lcd_write_data,.-lcd_write_data
.global lcd_mono_data
.type lcd_mono_data,%function
lcd_mono_data:
stmfd sp!, {r4, lr}
ldr lr, =LCD1_BASE
ldr r12, =lcd_dibits
.mloop:
ldrb r2, [r0], #1
mov r3, r2, lsr #4
ldrb r4, [r12, r3]
1:
ldr r3, [lr]
tst r3, #LCD1_BUSY_MASK
bne 1b
str r4, [lr, #0x10]
and r3, r2, #0x0f
ldrb r4, [r12, r3]
1:
ldr r3, [lr]
tst r3, #LCD1_BUSY_MASK
bne 1b
str r4, [lr, #0x10]
subs r1, r1, #1
bne .mloop
ldmfd sp!, {r4, pc}
.size lcd_mono_data,.-lcd_mono_data
.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
* lr - lcd bridge address
*/
lcd_grey_data:
stmfd sp!, {r4-r7, lr}
mov r12, #0x80
orr r12, r12, r12, lsl #8
orr r12, r12, r12, lsl #16
ldr lr, =LCD1_BASE
.greyloop:
ldmia r1, {r3-r4} /* Fetch 8 pixel phases */
ldmia r0!, {r5-r6} /* Fetch 8 pixel values */
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, r12
add r3, r3, r5
1:
ldr r5, [lr]
tst r5, #LCD1_BUSY_MASK
bne 1b
str r7, [lr, #0x10]
mov r7, #0
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, r12
add r4, r4, r6
stmia r1!, {r3-r4}
1:
ldr r5, [lr]
tst r5, #LCD1_BUSY_MASK
bne 1b
str r7, [lr, #0x10]
subs r2, r2, #1
bne .greyloop
ldmfd sp!, {r4-r7, pc}
.size lcd_grey_data,.-lcd_grey_data

View file

@ -52,6 +52,9 @@
#define LCD_CNTL_COLUMN 0x13
#define LCD_CNTL_DATA_WRITE 0x1d
/*** shared semi-private declarations ***/
extern const unsigned char lcd_dibits[16] ICONST_ATTR;
/* lcd commands */
static void lcd_send_data(unsigned byte)
{
@ -182,8 +185,6 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
(void)bheight;
(void)stride;
#if 0
/* This is from the h100 lcd code, perhaps we can adapt */
const unsigned char *src, *src_end;
unsigned char *dst_u, *dst_l;
static unsigned char upper[LCD_WIDTH] IBSS_ATTR;
@ -219,11 +220,10 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
data += stride;
}
#endif
}
/* Helper function for lcd_grey_phase_blit(). */
/* void lcd_grey_data(unsigned char *values, unsigned char *phases, int count); */
void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
/* Performance function that works with an external buffer
note that by and bheight are in 4-pixel units! */
@ -238,8 +238,6 @@ void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
(void)bheight;
(void)stride;
#if 0
/* This is from the h100 lcd code, perhaps we can adapt */
stride <<= 2; /* 4 pixels per block */
while (bheight--)
{
@ -250,7 +248,6 @@ void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
values += stride;
phases += stride;
}
#endif
}
/* Update a fraction of the display. */