1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Maurus Cuelenaere
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 #include "backlight.h"
31 #include "timefuncs.h"
36 static void audiotest(void)
38 __i2s_internal_codec();
42 __aic_enable_loopback();
45 /* CP0 hazard avoidance. */
46 #define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
47 "nop; nop; nop; nop; nop; nop;\n\t" \
49 static void show_tlb(void)
51 #define ASID_MASK 0xFF
55 unsigned int entrylo0
, entrylo1
, entryhi
;
56 unsigned int pagemask
;
60 /* Save old context */
61 old_ctx
= (read_c0_entryhi() & 0xff);
63 printf("TLB content:");
64 for(entry
= 0; entry
< 32; entry
++)
66 write_c0_index(entry
);
70 entryhi
= read_c0_entryhi();
71 entrylo0
= read_c0_entrylo0();
72 entrylo1
= read_c0_entrylo1();
73 pagemask
= read_c0_pagemask();
74 printf("%02d: ASID=%02d%s VA=0x%08x", entry
, entryhi
& ASID_MASK
, (entrylo0
& entrylo1
& 1) ? "(G)" : " ", entryhi
& ~ASID_MASK
);
75 printf("PA0=0x%08x C0=%x %s%s%s", (entrylo0
>>6)<<12, (entrylo0
>>3) & 7, (entrylo0
& 4) ? "Dirty " : "", (entrylo0
& 2) ? "Valid " : "Invalid ", (entrylo0
& 1) ? "Global" : "");
76 printf("PA1=0x%08x C1=%x %s%s%s", (entrylo1
>>6)<<12, (entrylo1
>>3) & 7, (entrylo1
& 4) ? "Dirty " : "", (entrylo1
& 2) ? "Valid " : "Invalid ", (entrylo1
& 1) ? "Global" : "");
78 printf("pagemask=0x%08x entryhi=0x%08x", pagemask
, entryhi
);
79 printf("entrylo0=0x%08x entrylo1=0x%08x", entrylo0
, entrylo1
);
82 write_c0_entryhi(old_ctx
);
92 lcd_setfont(FONT_SYSFIXED
);
104 printf("Rockbox bootloader v0.000001");
105 printf("REG_EMC_SACR0: 0x%x", REG_EMC_SACR0
);
106 printf("REG_EMC_SACR1: 0x%x", REG_EMC_SACR1
);
107 printf("REG_EMC_SACR2: 0x%x", REG_EMC_SACR2
);
108 printf("REG_EMC_SACR3: 0x%x", REG_EMC_SACR3
);
109 printf("REG_EMC_SACR4: 0x%x", REG_EMC_SACR4
);
110 printf("REG_EMC_DMAR0: 0x%x", REG_EMC_DMAR0
);
111 unsigned int cpu_id
= read_c0_prid();
112 printf("CPU_ID: 0x%x", cpu_id
);
113 printf(" * Company ID: 0x%x", (cpu_id
>> 16) & 7);
114 printf(" * Processor ID: 0x%x", (cpu_id
>> 8) & 7);
115 printf(" * Revision ID: 0x%x", cpu_id
& 7);
116 unsigned int config_data
= read_c0_config();
117 printf("C0_CONFIG: 0x%x", config_data
);
118 printf(" * Architecture type: 0x%x", (config_data
>> 13) & 3);
119 printf(" * Architecture revision: 0x%x", (config_data
>> 10) & 7);
120 printf(" * MMU type: 0x%x", (config_data
>> 7) & 7);
121 printf("C0_CONFIG1: 0x%x", read_c0_config1());
122 if(read_c0_config1() & (1 << 0)) printf(" * FP available");
123 if(read_c0_config1() & (1 << 1)) printf(" * EJTAG available");
124 if(read_c0_config1() & (1 << 2)) printf(" * MIPS-16 available");
125 if(read_c0_config1() & (1 << 4)) printf(" * Performace counters available");
126 if(read_c0_config1() & (1 << 5)) printf(" * MDMX available");
127 if(read_c0_config1() & (1 << 6)) printf(" * CP2 available");
128 printf("C0_STATUS: 0x%x", read_c0_status());
131 unsigned char testdata
[4096];
136 memset(testdata
, 0, 4096);
138 jz_nand_read(2, j
, &testdata
);
139 printf("Page %d", j
);
141 for(i
=0; i
<256; i
+=8)
143 snprintf(msg
, 30, "%02c%02c%02c%02c%02c%02c%02c%02c", testdata
[i
], testdata
[i
+1], testdata
[i
+2], testdata
[i
+3], testdata
[i
+4], testdata
[i
+5], testdata
[i
+6], testdata
[i
+7]);
146 while(!((btn
= button_read_device(&touch
)) & (BUTTON_VOL_UP
|BUTTON_VOL_DOWN
)));
147 if(btn
& BUTTON_VOL_UP
)
149 if(btn
& BUTTON_VOL_DOWN
)
158 btn
= button_get(false);
159 touch
= button_get_data();
161 btn
= button_read_device();
163 #define KNOP(x,y) lcd_set_foreground(LCD_BLACK); \
165 lcd_set_foreground(LCD_WHITE); \
166 lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(#x), SYSFONT_HEIGHT*y, #x);
167 KNOP(BUTTON_VOL_UP
, 0);
168 KNOP(BUTTON_VOL_DOWN
, 1);
169 KNOP(BUTTON_MENU
, 2);
170 KNOP(BUTTON_POWER
, 3);
171 lcd_set_foreground(LCD_WHITE
);
174 printf("BUTTON_HOLD");
177 if(btn
& BUTTON_VOL_DOWN
)
182 if(btn
& BUTTON_POWER
)
187 if(btn
& BUTTON_TOUCH
)
189 lcd_set_foreground(LCD_RGBPACK(touch
& 0xFF, (touch
>> 8)&0xFF, (touch
>> 16)&0xFF));
190 lcd_fillrect((touch
>>16)-10, (touch
&0xFFFF)-5, 10, 10);
192 lcd_set_foreground(LCD_WHITE
);
195 snprintf(datetime
, 30, "%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday
, get_time()->tm_mon
, get_time()->tm_year
,
196 get_time()->tm_hour
, get_time()->tm_min
, get_time()->tm_sec
);
197 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
, datetime
);
198 snprintf(datetime
, 30, "%d", current_tick
);
199 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*2, datetime
);
200 snprintf(datetime
, 30, "X: %03d Y: %03d", touch
>>16, touch
& 0xFFFF);
201 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*3, datetime
);
202 snprintf(datetime
, 30, "PIN3: 0x%08x", REG_GPIO_PXPIN(3));
203 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*4, datetime
);
204 snprintf(datetime
, 30, "PIN2: 0x%08x", REG_GPIO_PXPIN(2));
205 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*5, datetime
);
206 snprintf(datetime
, 30, "PIN1: 0x%08x", REG_GPIO_PXPIN(1));
207 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*6, datetime
);
208 snprintf(datetime
, 30, "PIN0: 0x%08x", REG_GPIO_PXPIN(0));
209 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*7, datetime
);
210 snprintf(datetime
, 30, "BadVAddr: 0x%08x", read_c0_badvaddr());
211 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*8, datetime
);
212 snprintf(datetime
, 30, "ICSR: 0x%08x", REG_INTC_ISR
);
213 lcd_putsxy(LCD_WIDTH
-SYSFONT_WIDTH
*strlen(datetime
), LCD_HEIGHT
-SYSFONT_HEIGHT
*9, datetime
);