diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2008-10-07 21:12:03 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2008-10-07 21:12:03 +0000 |
commit | 68d9fb95de3116ec8e7e4ad222d09c407b435504 (patch) | |
tree | ccba6b2174e026c067f15181bc17bd75d7971f1d | |
parent | dd7cacdc884a1dcd79256760f1b5677e9a142490 (diff) | |
download | rockbox-68d9fb95de3116ec8e7e4ad222d09c407b435504.tar.gz rockbox-68d9fb95de3116ec8e7e4ad222d09c407b435504.zip |
lcd now shows things on the old-style Meizu M3.
It needs to be re-tested on the new-style, colours are wrong, and timing loops need to be reviewed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18740 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/meizu_m3.c | 26 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c | 119 |
2 files changed, 118 insertions, 27 deletions
diff --git a/bootloader/meizu_m3.c b/bootloader/meizu_m3.c index 1c1f45a40a..c88494448c 100644 --- a/bootloader/meizu_m3.c +++ b/bootloader/meizu_m3.c | |||
@@ -44,6 +44,8 @@ | |||
44 | #include "rbunicode.h" | 44 | #include "rbunicode.h" |
45 | #include "usb.h" | 45 | #include "usb.h" |
46 | #include "qt1106.h" | 46 | #include "qt1106.h" |
47 | #include "rockboxlogo.h" | ||
48 | |||
47 | 49 | ||
48 | #include <stdarg.h> | 50 | #include <stdarg.h> |
49 | 51 | ||
@@ -105,12 +107,14 @@ void main(void) | |||
105 | int tmpval; | 107 | int tmpval; |
106 | 108 | ||
107 | /* set clock to 200 MHz */ | 109 | /* set clock to 200 MHz */ |
110 | #if 0 | ||
108 | CLKCON = 0x00800080; | 111 | CLKCON = 0x00800080; |
109 | CLKCON2= 0x00; | 112 | CLKCON2= 0x00; |
110 | PLL0PMS = 0x1ad200; | 113 | PLL0PMS = 0x1ad200; |
111 | PLLCON = 1; | 114 | PLLCON = 1; |
112 | while (!(PLLLOCK & 1)) ; | 115 | while (!(PLLLOCK & 1)) ; |
113 | CLKCON = 0x20802080; | 116 | CLKCON = 0x20802080; |
117 | #endif | ||
114 | 118 | ||
115 | /* mask all interrupts | 119 | /* mask all interrupts |
116 | this is done, because the lcd framebuffer | 120 | this is done, because the lcd framebuffer |
@@ -136,21 +140,18 @@ void main(void) | |||
136 | 140 | ||
137 | lcd_init(); | 141 | lcd_init(); |
138 | snprintf(mystring, 64, "tmpval: %x", tmpval); | 142 | snprintf(mystring, 64, "tmpval: %x", tmpval); |
139 | lcd_putsxy(0,0,mystring); | 143 | lcd_puts(0,0,mystring); |
140 | lcd_update(); | 144 | lcd_update(); |
141 | 145 | ||
142 | init_qt1106(); | 146 | init_qt1106(); |
143 | 147 | ||
144 | // Wait for play to be pressed | ||
145 | while(!(PDAT1 & (1 << 4))); | ||
146 | // Wait for play to be released | ||
147 | while((PDAT1 & (1 << 4))); | ||
148 | PDAT0 ^= (1 << 2); //Toggle backlight | ||
149 | delay(LONG_DELAY); | ||
150 | |||
151 | /* Calibrate the lot */ | 148 | /* Calibrate the lot */ |
152 | qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI \ | 149 | qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI \ |
153 | | QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_4); | 150 | | QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_256); |
151 | |||
152 | lcd_clear_display(); | ||
153 | lcd_bitmap(rockboxlogo, 0, 30, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); | ||
154 | lcd_update(); | ||
154 | 155 | ||
155 | /* Set to maximum sensitivity */ | 156 | /* Set to maximum sensitivity */ |
156 | qt1106_io(QT1106_CT | (0x00 << 8) ); | 157 | qt1106_io(QT1106_CT | (0x00 << 8) ); |
@@ -160,9 +161,14 @@ void main(void) | |||
160 | qt1106_wait(); | 161 | qt1106_wait(); |
161 | 162 | ||
162 | int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \ | 163 | int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \ |
163 | | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_4); | 164 | | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_256); |
165 | snprintf(mystring, 64, "%x %2.2x",(slider & 0x008000)>>15, slider&0xff); | ||
166 | lcd_puts(0,1,mystring); | ||
167 | lcd_update(); | ||
168 | /* | ||
164 | if(slider & 0x008000) | 169 | if(slider & 0x008000) |
165 | bl_debug_count(((slider&0xff)) + 1); | 170 | bl_debug_count(((slider&0xff)) + 1); |
171 | */ | ||
166 | } | 172 | } |
167 | 173 | ||
168 | //power off | 174 | //power off |
diff --git a/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c b/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c index 3c2e8c646c..88147e9b16 100644 --- a/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c +++ b/firmware/target/arm/s5l8700/meizu-m3/lcd-m3.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Alan Korr | 10 | * Copyright (C) 2008 by Denes Balatoni |
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 |
@@ -66,23 +66,38 @@ void lcd_set_flip(bool yesno) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | static void lcd_sleep(uint32_t t) { | 69 | static void lcd_sleep(uint32_t t) |
70 | uint32_t i; | 70 | { |
71 | 71 | volatile uint32_t i; | |
72 | for(i=0;i<t;++i) t=t; | 72 | for(i=0;i<t;++i) t=t; |
73 | } | 73 | } |
74 | 74 | ||
75 | static uint8_t lcd_readdata() { | 75 | static uint8_t lcd_readdata() |
76 | { | ||
76 | LCD_RDATA = 0; | 77 | LCD_RDATA = 0; |
77 | lcd_sleep(64); | 78 | lcd_sleep(64); |
78 | return (LCD_DBUFF/* & 0xff*/); | 79 | return (LCD_DBUFF/* & 0xff*/); |
79 | } | 80 | } |
80 | 81 | ||
82 | static void lcd_writereg(uint32_t reg, uint32_t data) | ||
83 | { | ||
84 | LCD_WCMD = reg >> 8; | ||
85 | LCD_WCMD = reg & 0xff; | ||
86 | LCD_WDATA = data >> 8; | ||
87 | LCD_WDATA = data & 0xff; | ||
88 | } | ||
89 | |||
81 | void lcd_on() { | 90 | void lcd_on() { |
82 | if (lcd_type == 1) { | 91 | if (lcd_type == 1) { |
83 | LCD_WCMD = 0x29; | 92 | LCD_WCMD = 0x29; |
84 | } else { | 93 | } else { |
85 | 94 | lcd_writereg(0x7, 0x21); | |
95 | lcd_writereg(0x12, 0x137); | ||
96 | lcd_sleep(70000); | ||
97 | lcd_writereg(0x7, 0x21); | ||
98 | lcd_writereg(0x12, 0x1137); | ||
99 | lcd_sleep(70000); | ||
100 | lcd_writereg(0x7, 0x233); | ||
86 | } | 101 | } |
87 | } | 102 | } |
88 | 103 | ||
@@ -113,9 +128,9 @@ void lcd_init_device(void) | |||
113 | 128 | ||
114 | /* detect lcd type */ | 129 | /* detect lcd type */ |
115 | LCD_WCMD = 0x1; | 130 | LCD_WCMD = 0x1; |
116 | lcd_sleep(166670); | 131 | lcd_sleep(16667); |
117 | LCD_WCMD = 0x11; | 132 | LCD_WCMD = 0x11; |
118 | lcd_sleep(2000040); | 133 | lcd_sleep(20000); |
119 | lcd_readdata(); | 134 | lcd_readdata(); |
120 | LCD_WCMD = 0x4; | 135 | LCD_WCMD = 0x4; |
121 | lcd_sleep(100); | 136 | lcd_sleep(100); |
@@ -146,7 +161,74 @@ void lcd_init_device(void) | |||
146 | LCD_WDATA = 0; | 161 | LCD_WDATA = 0; |
147 | LCD_WCMD = 0x29; | 162 | LCD_WCMD = 0x29; |
148 | } else { | 163 | } else { |
149 | 164 | LCD_WCMD = 0x0; | |
165 | LCD_WCMD = 0x0; | ||
166 | LCD_WCMD = 0x0; | ||
167 | LCD_WCMD = 0x0; | ||
168 | lcd_sleep(7000); | ||
169 | lcd_writereg(0xa4, 0x1); | ||
170 | lcd_sleep(11000); | ||
171 | lcd_writereg(0x1, 0x100); | ||
172 | lcd_writereg(0x2, 0x300); | ||
173 | lcd_writereg(0x3, 0x9230); | ||
174 | lcd_writereg(0x8, 0x404); | ||
175 | lcd_writereg(0xe, 0x10); | ||
176 | lcd_writereg(0x70, 0x1000); | ||
177 | lcd_writereg(0x71, 0x1); | ||
178 | lcd_writereg(0x30, 0x2); | ||
179 | lcd_writereg(0x31, 0x400); | ||
180 | lcd_writereg(0x32, 0x7); | ||
181 | lcd_writereg(0x33, 0x500); | ||
182 | lcd_writereg(0x34, 0x7); | ||
183 | lcd_writereg(0x35, 0x703); | ||
184 | lcd_writereg(0x36, 0x507); | ||
185 | lcd_writereg(0x37, 0x5); | ||
186 | lcd_writereg(0x38, 0x1404); | ||
187 | lcd_writereg(0x39, 0xe); | ||
188 | lcd_writereg(0x40, 0x202); | ||
189 | lcd_writereg(0x41, 0x3); | ||
190 | lcd_writereg(0x42, 0x0); | ||
191 | lcd_writereg(0x43, 0x200); | ||
192 | lcd_writereg(0x44, 0x707); | ||
193 | lcd_writereg(0x45, 0x407); | ||
194 | lcd_writereg(0x46, 0x505); | ||
195 | lcd_writereg(0x47, 0x2); | ||
196 | lcd_writereg(0x48, 0x4); | ||
197 | lcd_writereg(0x49, 0x4); | ||
198 | lcd_writereg(0x60, 0x202); | ||
199 | lcd_writereg(0x61, 0x3); | ||
200 | lcd_writereg(0x62, 0x0); | ||
201 | lcd_writereg(0x63, 0x200); | ||
202 | lcd_writereg(0x64, 0x707); | ||
203 | lcd_writereg(0x65, 0x407); | ||
204 | lcd_writereg(0x66, 0x505); | ||
205 | lcd_writereg(0x67, 0x2); | ||
206 | lcd_writereg(0x68, 0x4); | ||
207 | lcd_writereg(0x69, 0x4); | ||
208 | lcd_writereg(0x7, 0x1); | ||
209 | lcd_writereg(0x18, 0x1); | ||
210 | lcd_writereg(0x10, 0x1690); | ||
211 | lcd_writereg(0x11, 0x100); | ||
212 | lcd_writereg(0x12, 0x117); | ||
213 | lcd_writereg(0x13, 0xf80); | ||
214 | lcd_writereg(0x12, 0x137); | ||
215 | lcd_writereg(0x20, 0x0); | ||
216 | lcd_writereg(0x21, 0x0); | ||
217 | lcd_writereg(0x50, 0x0); | ||
218 | lcd_writereg(0x51, 0xaf); | ||
219 | lcd_writereg(0x52, 0x0); | ||
220 | lcd_writereg(0x53, 0x83); | ||
221 | lcd_writereg(0x90, 0x0); | ||
222 | lcd_writereg(0x91, 0x0); | ||
223 | lcd_writereg(0x92, 0x0); | ||
224 | lcd_writereg(0x98, 0x0); | ||
225 | lcd_writereg(0x99, 0x903); | ||
226 | lcd_writereg(0x9a, 0x502); | ||
227 | lcd_writereg(0x9b, 0x300); | ||
228 | LCD_WCMD = 0x0; | ||
229 | LCD_WCMD = 0x22; | ||
230 | lcd_sleep(7000); | ||
231 | lcd_on(); | ||
150 | } | 232 | } |
151 | } | 233 | } |
152 | 234 | ||
@@ -199,15 +281,18 @@ void lcd_update(void) | |||
199 | LCD_WDATA = 0; | 281 | LCD_WDATA = 0; |
200 | LCD_WDATA = 0x83; | 282 | LCD_WDATA = 0x83; |
201 | LCD_WCMD = 0x2c; | 283 | LCD_WCMD = 0x2c; |
202 | for(p=&lcd_framebuffer[0][0], i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) { | ||
203 | LCD_WDATA = RGB_UNPACK_RED(*p)<<3; | ||
204 | LCD_WDATA = RGB_UNPACK_GREEN(*p)<<2; | ||
205 | LCD_WDATA = RGB_UNPACK_BLUE(*p)<<3; | ||
206 | lcd_sleep(1); /* if data is sent too fast to lcdif, machine freezes */ | ||
207 | } | ||
208 | } else { | 284 | } else { |
209 | 285 | lcd_writereg(0x20, 0x0); | |
210 | } | 286 | lcd_writereg(0x21, 0x0); |
287 | LCD_WCMD = 0; | ||
288 | LCD_WCMD = 0x22; | ||
289 | } | ||
290 | for(p=&lcd_framebuffer[0][0], i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) { | ||
291 | LCD_WDATA = RGB_UNPACK_RED(*p)<<3; | ||
292 | LCD_WDATA = RGB_UNPACK_GREEN(*p)<<2; | ||
293 | LCD_WDATA = RGB_UNPACK_BLUE(*p)<<3; | ||
294 | lcd_sleep(1); /* if data is sent too fast to lcdif, machine freezes */ | ||
295 | } | ||
211 | } | 296 | } |
212 | 297 | ||
213 | /* Update a fraction of the display. */ | 298 | /* Update a fraction of the display. */ |