From 5e9b62cd8ad4d38c7ca43c916b5bc831454bc267 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 7 Jan 2012 23:30:53 +0100 Subject: ypr0: Use generic lcd memframe driver. --- firmware/SOURCES | 1 + firmware/asm/SOURCES | 3 +- firmware/target/hosted/ypr0/lcd-target.h | 26 ++++++++++++++++ firmware/target/hosted/ypr0/lcd-ypr0.c | 53 +------------------------------- 4 files changed, 30 insertions(+), 53 deletions(-) create mode 100644 firmware/target/hosted/ypr0/lcd-target.h 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 #ifdef SAMSUNG_YPR0 drivers/adc-as3514.c +drivers/lcd-memframe.c #if (CONFIG_RTC == RTC_AS3514) drivers/rtc/rtc_as3514.c #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 #if (defined(SANSA_E200) || defined(GIGABEAT_F) || defined(GIGABEAT_S) || \ defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ - defined(COWON_D2) || defined(MINI2440) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ + defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ + (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ !defined(SIMULATOR) lcd-as-memframe.c #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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * 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. + * + ****************************************************************************/ + +#ifndef __LCD_TARGET_H__ +#define __LCD_TARGET_H__ + +extern fb_data *dev_fb; +#define LCD_FRAMEBUF_ADDR(col, row) (dev_fb + row*LCD_WIDTH + col) + +#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 @@ #include "screendump.h" #include "lcd.h" -/* eqivalent to fb + y*width + x */ -#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) - static int dev_fd = 0; -static fb_data *dev_fb = 0; - -void lcd_update(void) -{ - /* update the entire display */ - memcpy(dev_fb, lcd_framebuffer, sizeof(lcd_framebuffer)); -} - -/* Copy Rockbox frame buffer to the mmapped lcd device */ -void lcd_update_rect(int x, int y, int width, int height) -{ - /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || - (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) - return; - - /* do the necessary clipping */ - if (x < 0) - { /* clip left */ - width += x; - x = 0; - } - if (y < 0) - { /* clip top */ - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; /* clip right */ - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; /* clip bottom */ - - fb_data* src = LCDADDR(x, y); - fb_data* dst = dev_fb + y*LCD_WIDTH + x; - - if (LCD_WIDTH == width) - { /* optimized full-width update */ - memcpy(dst, src, width * height * sizeof(fb_data)); - } - else - { /* row by row */ - do - { - memcpy(dst, src, width * sizeof(fb_data)); - src += LCD_WIDTH; - dst += LCD_WIDTH; - } while(--height > 0); - } -} +fb_data *dev_fb = 0; void lcd_shutdown(void) { -- cgit v1.2.3