1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright © 2008 Rafaël Carré
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 ****************************************************************************/
25 #include "debug-target.h"
34 #include "pmu-target.h"
35 #include "nand-target.h"
38 /* Skeleton for adding target specific debug info to the debug menu
41 #define _DEBUG_PRINTF(a,varargs...) do { \
42 snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \
46 extern uint32_t nand_type
[4];
48 bool __dbg_hw_info(void)
55 const unsigned int max_states
=2;
57 struct storage_info info
;
58 const struct nand_device_info_type
*nand_devicetype
[4];
63 nand_devicetype
[i
] = nand_get_device_type(i
);
64 if(nand_devicetype
[i
] != NULL
) nand_bank_count
++;
70 lcd_setfont(FONT_SYSFIXED
);
79 /* _DEBUG_PRINTF statements can be added here to show debug info */
84 _DEBUG_PRINTF("CPU:");
85 _DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick
);
88 _DEBUG_PRINTF("LCD:");
89 _DEBUG_PRINTF("type: %d, %s", lcd_type
, lcd_type
? "(7) LDS176" : "(2) ILI9320");
92 _DEBUG_PRINTF("NAND:");
93 _DEBUG_PRINTF("banks: %d",nand_bank_count
);
97 if(nand_devicetype
[i
] != NULL
)
99 _DEBUG_PRINTF("bank: %d, id: %08X", i
, (unsigned int)(*nand_devicetype
[i
]).id
);
103 _DEBUG_PRINTF("sectors: %d", info
.num_sectors
);
104 _DEBUG_PRINTF("sector size: %d", info
.sector_size
);
105 _DEBUG_PRINTF("last disk activity: %d", (unsigned int)nand_last_disk_activity());
109 _DEBUG_PRINTF("PMU:");
114 _DEBUG_PRINTF("ldo %d: %dmV (CLICKWHEEL)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
118 _DEBUG_PRINTF("ldo %d: %dmV (AUDIO)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
122 _DEBUG_PRINTF("ldo %d: %dmV (NAND)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
126 _DEBUG_PRINTF("ldo %d: %dmV",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
129 _DEBUG_PRINTF("cpu voltage: %dmV",625 + pmu_read(0x1e)*25);
130 _DEBUG_PRINTF("memory voltage: %dmV",625 + pmu_read(0x22)*25);
132 _DEBUG_PRINTF("charging: %s", charging_state() ? "true" : "false");
133 _DEBUG_PRINTF("backlight: %s", pmu_read(0x29) ? "on" : "off");
134 _DEBUG_PRINTF("brightness value: %d", pmu_read(0x28));
142 _DEBUG_PRINTF("__dbg_hw_info");
146 switch(get_action(CONTEXT_STD
,HZ
/20))
148 case ACTION_STD_PREV
:
149 if(state
!=0) state
--;
152 case ACTION_STD_NEXT
:
153 if(state
!=max_states
-1)
159 case ACTION_STD_CANCEL
:
160 lcd_setfont(FONT_UI
);
165 lcd_setfont(FONT_UI
);
169 bool __dbg_ports(void)
174 lcd_setfont(FONT_SYSFIXED
);
181 _DEBUG_PRINTF("GPIO 0: %08x",(unsigned int)PDAT0
);
182 _DEBUG_PRINTF("GPIO 1: %08x",(unsigned int)PDAT1
);
183 _DEBUG_PRINTF("GPIO 2: %08x",(unsigned int)PDAT2
);
184 _DEBUG_PRINTF("GPIO 3: %08x",(unsigned int)PDAT3
);
185 _DEBUG_PRINTF("GPIO 4: %08x",(unsigned int)PDAT4
);
186 _DEBUG_PRINTF("GPIO 5: %08x",(unsigned int)PDAT5
);
187 _DEBUG_PRINTF("GPIO 6: %08x",(unsigned int)PDAT6
);
188 _DEBUG_PRINTF("GPIO 7: %08x",(unsigned int)PDAT7
);
189 _DEBUG_PRINTF("GPIO 10: %08x",(unsigned int)PDAT10
);
190 _DEBUG_PRINTF("GPIO 11: %08x",(unsigned int)PDAT11
);
191 _DEBUG_PRINTF("GPIO 13: %08x",(unsigned int)PDAT13
);
192 _DEBUG_PRINTF("GPIO 14: %08x",(unsigned int)PDAT14
);
193 _DEBUG_PRINTF("5USEC : %08x",(unsigned int)FIVE_USEC_TIMER
);
194 _DEBUG_PRINTF("USEC : %08x",(unsigned int)USEC_TIMER
);
195 _DEBUG_PRINTF("USECREG: %08x",(unsigned int)(*(REG32_PTR_T
)(0x3C700084)));
198 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
201 lcd_setfont(FONT_UI
);