From 02f5a001fecf83d2ae16aa3231b28378442ebfd0 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Thu, 16 Jul 2009 00:00:16 +0000 Subject: Working LCD driver for half the Nano2Gs. It now appears that there are two types of LCD though. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21895 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 74 ++++++++++++++++------ 1 file changed, 54 insertions(+), 20 deletions(-) (limited to 'firmware') diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index daf8869c9c..74f2fca383 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2009 by ???? + * Copyright (C) 2009 by Dave Chapman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +26,21 @@ #include "system.h" #include "cpu.h" +/** hardware access functions */ + +static void s5l_lcd_write_cmd(unsigned short cmd) +{ + while (LCD_STATUS&0x10); + LCD_WCMD = cmd; +} + +static void s5l_lcd_write_data(int data) +{ + LCD_WDATA = data; + while (LCD_STATUS&0x10); +} + + /** globals **/ static int xoffset; /* needed for flip */ @@ -105,38 +120,57 @@ void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases, (void)stride; } + /* Update the display. This must be called after all other LCD functions that change the display. */ void lcd_update(void) ICODE_ATTR; void lcd_update(void) { - int y; + int x,y; + fb_data* p; + fb_data pixel; + + s5l_lcd_write_cmd(0x3a); + s5l_lcd_write_data(0x65); + + s5l_lcd_write_cmd(0x2a); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(LCD_WIDTH-1); + + s5l_lcd_write_cmd(0x2b); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(0); + s5l_lcd_write_data(LCD_HEIGHT-1); + + s5l_lcd_write_cmd(0x2c); /* Copy display bitmap to hardware */ - for (y = 0; y < LCD_FBHEIGHT; y++) - { + + p = &lcd_framebuffer[0][0]; + for (y = 0; y < LCD_HEIGHT; y++) { + for (x = 0; x < LCD_WIDTH; x++) { + pixel = *(p++); + + while (LCD_STATUS&0x10); + LCD_WDATA = (pixel & 0xff00) >> 8; + LCD_WDATA = pixel & 0xff; + } } + + s5l_lcd_write_cmd(0x29); } /* Update a fraction of the display. */ void lcd_update_rect(int, int, int, int) ICODE_ATTR; void lcd_update_rect(int x, int y, int width, int height) { - int ymax; - - /* The Y coordinates have to work on even 8 pixel rows */ - ymax = (y + height-1) >> 3; - y >>= 3; - - if(x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (width <= 0) - return; /* nothing left to do, 0 is harmful to lcd_write_data() */ - if(ymax >= LCD_FBHEIGHT) - ymax = LCD_FBHEIGHT-1; + (void)x; + (void)y; + (void)width; + (void)height; - /* Copy specified rectange bitmap to hardware */ - for (; y <= ymax; y++) - { - } + lcd_update(); } -- cgit