summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/asm/SOURCES3
-rw-r--r--firmware/target/hosted/ypr0/lcd-target.h26
-rw-r--r--firmware/target/hosted/ypr0/lcd-ypr0.c53
4 files changed, 30 insertions, 53 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index d765bb8720..5a6a554fa6 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -73,6 +73,7 @@ target/hosted/sdl/app/button-application.c
73 73
74#ifdef SAMSUNG_YPR0 74#ifdef SAMSUNG_YPR0
75drivers/adc-as3514.c 75drivers/adc-as3514.c
76drivers/lcd-memframe.c
76#if (CONFIG_RTC == RTC_AS3514) 77#if (CONFIG_RTC == RTC_AS3514)
77drivers/rtc/rtc_as3514.c 78drivers/rtc/rtc_as3514.c
78#else 79#else
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES
index 216089f003..f56d99a7de 100644
--- a/firmware/asm/SOURCES
+++ b/firmware/asm/SOURCES
@@ -8,7 +8,8 @@ strlen.c
8 8
9#if (defined(SANSA_E200) || defined(GIGABEAT_F) || defined(GIGABEAT_S) || \ 9#if (defined(SANSA_E200) || defined(GIGABEAT_F) || defined(GIGABEAT_S) || \
10 defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ 10 defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \
11 defined(COWON_D2) || defined(MINI2440) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ 11 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \
12 (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \
12 !defined(SIMULATOR) 13 !defined(SIMULATOR)
13lcd-as-memframe.c 14lcd-as-memframe.c
14#endif 15#endif
diff --git a/firmware/target/hosted/ypr0/lcd-target.h b/firmware/target/hosted/ypr0/lcd-target.h
new file mode 100644
index 0000000000..c8a6de74f9
--- /dev/null
+++ b/firmware/target/hosted/ypr0/lcd-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __LCD_TARGET_H__
21#define __LCD_TARGET_H__
22
23extern fb_data *dev_fb;
24#define LCD_FRAMEBUF_ADDR(col, row) (dev_fb + row*LCD_WIDTH + col)
25
26#endif
diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/ypr0/lcd-ypr0.c
index f0565ae2d4..083a9fbe28 100644
--- a/firmware/target/hosted/ypr0/lcd-ypr0.c
+++ b/firmware/target/hosted/ypr0/lcd-ypr0.c
@@ -33,59 +33,8 @@
33#include "screendump.h" 33#include "screendump.h"
34#include "lcd.h" 34#include "lcd.h"
35 35
36/* eqivalent to fb + y*width + x */
37#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
38
39static int dev_fd = 0; 36static int dev_fd = 0;
40static fb_data *dev_fb = 0; 37fb_data *dev_fb = 0;
41
42void lcd_update(void)
43{
44 /* update the entire display */
45 memcpy(dev_fb, lcd_framebuffer, sizeof(lcd_framebuffer));
46}
47
48/* Copy Rockbox frame buffer to the mmapped lcd device */
49void lcd_update_rect(int x, int y, int width, int height)
50{
51 /* nothing to draw? */
52 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) ||
53 (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0))
54 return;
55
56 /* do the necessary clipping */
57 if (x < 0)
58 { /* clip left */
59 width += x;
60 x = 0;
61 }
62 if (y < 0)
63 { /* clip top */
64 height += y;
65 y = 0;
66 }
67 if (x + width > LCD_WIDTH)
68 width = LCD_WIDTH - x; /* clip right */
69 if (y + height > LCD_HEIGHT)
70 height = LCD_HEIGHT - y; /* clip bottom */
71
72 fb_data* src = LCDADDR(x, y);
73 fb_data* dst = dev_fb + y*LCD_WIDTH + x;
74
75 if (LCD_WIDTH == width)
76 { /* optimized full-width update */
77 memcpy(dst, src, width * height * sizeof(fb_data));
78 }
79 else
80 { /* row by row */
81 do
82 {
83 memcpy(dst, src, width * sizeof(fb_data));
84 src += LCD_WIDTH;
85 dst += LCD_WIDTH;
86 } while(--height > 0);
87 }
88}
89 38
90void lcd_shutdown(void) 39void lcd_shutdown(void)
91{ 40{