ypr0: Use generic lcd memframe driver.

This commit is contained in:
Thomas Martitz 2012-01-07 23:30:53 +01:00
parent 094cbd586f
commit 5e9b62cd8a
4 changed files with 30 additions and 53 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)
{