summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2009-07-16 00:00:16 +0000
committerDave Chapman <dave@dchapman.com>2009-07-16 00:00:16 +0000
commit02f5a001fecf83d2ae16aa3231b28378442ebfd0 (patch)
tree5993afebaf0a723b25486d39e9c14a184c5df543 /firmware
parent989021ed3cca4a76a14062bb2b64109cf77027b6 (diff)
downloadrockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.tar.gz
rockbox-02f5a001fecf83d2ae16aa3231b28378442ebfd0.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c74
1 files changed, 54 insertions, 20 deletions
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 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2009 by ???? 10 * Copyright (C) 2009 by Dave Chapman
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -26,6 +26,21 @@
26#include "system.h" 26#include "system.h"
27#include "cpu.h" 27#include "cpu.h"
28 28
29/** hardware access functions */
30
31static void s5l_lcd_write_cmd(unsigned short cmd)
32{
33 while (LCD_STATUS&0x10);
34 LCD_WCMD = cmd;
35}
36
37static void s5l_lcd_write_data(int data)
38{
39 LCD_WDATA = data;
40 while (LCD_STATUS&0x10);
41}
42
43
29/** globals **/ 44/** globals **/
30 45
31static int xoffset; /* needed for flip */ 46static int xoffset; /* needed for flip */
@@ -105,38 +120,57 @@ void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases,
105 (void)stride; 120 (void)stride;
106} 121}
107 122
123
108/* Update the display. 124/* Update the display.
109 This must be called after all other LCD functions that change the display. */ 125 This must be called after all other LCD functions that change the display. */
110void lcd_update(void) ICODE_ATTR; 126void lcd_update(void) ICODE_ATTR;
111void lcd_update(void) 127void lcd_update(void)
112{ 128{
113 int y; 129 int x,y;
130 fb_data* p;
131 fb_data pixel;
132
133 s5l_lcd_write_cmd(0x3a);
134 s5l_lcd_write_data(0x65);
135
136 s5l_lcd_write_cmd(0x2a);
137 s5l_lcd_write_data(0);
138 s5l_lcd_write_data(0);
139 s5l_lcd_write_data(0);
140 s5l_lcd_write_data(LCD_WIDTH-1);
141
142 s5l_lcd_write_cmd(0x2b);
143 s5l_lcd_write_data(0);
144 s5l_lcd_write_data(0);
145 s5l_lcd_write_data(0);
146 s5l_lcd_write_data(LCD_HEIGHT-1);
147
148 s5l_lcd_write_cmd(0x2c);
114 149
115 /* Copy display bitmap to hardware */ 150 /* Copy display bitmap to hardware */
116 for (y = 0; y < LCD_FBHEIGHT; y++) 151
117 { 152 p = &lcd_framebuffer[0][0];
153 for (y = 0; y < LCD_HEIGHT; y++) {
154 for (x = 0; x < LCD_WIDTH; x++) {
155 pixel = *(p++);
156
157 while (LCD_STATUS&0x10);
158 LCD_WDATA = (pixel & 0xff00) >> 8;
159 LCD_WDATA = pixel & 0xff;
160 }
118 } 161 }
162
163 s5l_lcd_write_cmd(0x29);
119} 164}
120 165
121/* Update a fraction of the display. */ 166/* Update a fraction of the display. */
122void lcd_update_rect(int, int, int, int) ICODE_ATTR; 167void lcd_update_rect(int, int, int, int) ICODE_ATTR;
123void lcd_update_rect(int x, int y, int width, int height) 168void lcd_update_rect(int x, int y, int width, int height)
124{ 169{
125 int ymax; 170 (void)x;
126 171 (void)y;
127 /* The Y coordinates have to work on even 8 pixel rows */ 172 (void)width;
128 ymax = (y + height-1) >> 3; 173 (void)height;
129 y >>= 3;
130
131 if(x + width > LCD_WIDTH)
132 width = LCD_WIDTH - x;
133 if (width <= 0)
134 return; /* nothing left to do, 0 is harmful to lcd_write_data() */
135 if(ymax >= LCD_FBHEIGHT)
136 ymax = LCD_FBHEIGHT-1;
137 174
138 /* Copy specified rectange bitmap to hardware */ 175 lcd_update();
139 for (; y <= ymax; y++)
140 {
141 }
142} 176}