summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2009-07-05 19:14:46 +0000
committerBertrik Sikken <bertrik@sikken.nl>2009-07-05 19:14:46 +0000
commit80fbb4ec9995bca3c0bba5eb6ab4d9b110cf4fa9 (patch)
tree19d2c344311d728a771eadf8304b863bfb95f67f
parent9926c933c799f93abc1d4650f2db349d74dce238 (diff)
downloadrockbox-80fbb4ec9995bca3c0bba5eb6ab4d9b110cf4fa9.tar.gz
rockbox-80fbb4ec9995bca3c0bba5eb6ab4d9b110cf4fa9.zip
Update initialisation and display of debug info in meizu M3 bootloader
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21673 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/meizu_m3.c65
1 files changed, 57 insertions, 8 deletions
diff --git a/bootloader/meizu_m3.c b/bootloader/meizu_m3.c
index 84961228b7..61aa3cecbe 100644
--- a/bootloader/meizu_m3.c
+++ b/bootloader/meizu_m3.c
@@ -18,12 +18,15 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "config.h"
22 21
23#include <stdlib.h> 22#include <stdlib.h>
24#include <stdio.h> 23#include <stdio.h>
24#include <stdarg.h>
25#include <string.h>
26
27#include "config.h"
28
25#include "inttypes.h" 29#include "inttypes.h"
26#include "string.h"
27#include "cpu.h" 30#include "cpu.h"
28#include "system.h" 31#include "system.h"
29#include "lcd.h" 32#include "lcd.h"
@@ -45,8 +48,11 @@
45#include "qt1106.h" 48#include "qt1106.h"
46#include "bitmaps/rockboxlogo.h" 49#include "bitmaps/rockboxlogo.h"
47 50
48 51#include "i2c-s5l8700.h"
49#include <stdarg.h> 52#include "dma-target.h"
53#include "pcm.h"
54#include "audiohw.h"
55#include "rtc.h"
50 56
51char version[] = APPSVERSION; 57char version[] = APPSVERSION;
52#define LONG_DELAY 200000 58#define LONG_DELAY 200000
@@ -103,12 +109,19 @@ void bl_debug_int(unsigned int input,unsigned int count)
103void main(void) 109void main(void)
104{ 110{
105 char mystring[64]; 111 char mystring[64];
106 112 int i;
113 unsigned short data = 0;
114 char write_data[2], read_data[16];
115
107 //Set backlight pin to output and enable 116 //Set backlight pin to output and enable
108 int oldval = PCON0; 117 int oldval = PCON0;
109 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4)); 118 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
110 PDAT0 |= (1 << 2); 119 PDAT0 |= (1 << 2);
111 120
121 // Set codec reset pin inactive
122 PCON5 = (PCON5 & ~0xF) | 1;
123 PDAT5 &= ~(1 << 0);
124
112 //power on 125 //power on
113// oldval = PCON1; 126// oldval = PCON1;
114// PCON1 = ((oldval & ~(0xf << 12)) | (1 << 12)); 127// PCON1 = ((oldval & ~(0xf << 12)) | (1 << 12));
@@ -128,10 +141,15 @@ void main(void)
128 EINTMSK = 0x11; 141 EINTMSK = 0x11;
129 asm volatile("msr cpsr_c, #0x13\n\t"); // enable interrupts 142 asm volatile("msr cpsr_c, #0x13\n\t"); // enable interrupts
130 143
144 system_init();
145 kernel_init();
146
131 backlight_init(); 147 backlight_init();
132 lcd_init(); 148 lcd_init();
133 lcd_update(); 149 lcd_update();
134 150
151 i2c_init();
152
135 init_qt1106(); 153 init_qt1106();
136 154
137 /* Calibrate the lot */ 155 /* Calibrate the lot */
@@ -147,19 +165,50 @@ void main(void)
147 165
148 while(true) 166 while(true)
149 { 167 {
168#if 1 /* enable this to see info about the slider touchpad */
150 qt1106_wait(); 169 qt1106_wait();
151 170
152 int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \ 171 int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \
153 | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_256); 172 | QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_256);
154 snprintf(mystring, 64, "%x %2.2x",(slider & 0x008000)>>15, slider&0xff); 173 snprintf(mystring, 64, "%x %2.2x",(slider & 0x008000)>>15, slider&0xff);
155 lcd_puts(0,1,mystring); 174 lcd_puts(0,1,mystring);
156 lcd_update(); 175 _backlight_set_brightness((slider & 0xFF) >> 4);
176
157 /* 177 /*
158 if(slider & 0x008000) 178 if(slider & 0x008000)
159 bl_debug_count(((slider&0xff)) + 1); 179 bl_debug_count(((slider&0xff)) + 1);
160 */ 180 */
161 181#endif
162 _backlight_set_brightness(slider & 0xFF); 182
183#if 1 /* enable this to see info about the RTC */
184 rtc_read_datetime(read_data);
185 for (i = 0; i < 7; i++) {
186 snprintf(mystring + 2 * i, 64, "%02X", read_data[i]);
187 }
188 lcd_puts(0, 10, mystring);
189#endif
190
191#if 1 /* enable this so see info about the UDA1380 codec */
192 memset(read_data, 0, sizeof(read_data));
193 for (i = 0; i < 7; i++) {
194 write_data[0] = i;
195 i2c_read(0x30, i, 2, read_data);
196 data = read_data[0] << 8 | read_data[1];
197 snprintf(mystring + 4 * i, 64, "%04X", data);
198 }
199 lcd_puts(0, 11, mystring);
200#endif
201
202#if 1 /* enable this to see info about IODMA channel 0 (PCM) */
203 snprintf(mystring, 64, "DMA: %08X %08X", DMACADDR0, DMACTCNT0);
204 lcd_puts(0, 12, mystring);
205#endif
206#if 1 /* enable this to see info about IIS */
207 snprintf(mystring, 64, "IIS: %08X", I2SSTATUS);
208 lcd_puts(0, 13, mystring);
209#endif
210
211 lcd_update();
163 } 212 }
164 213
165 //power off 214 //power off