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"
32 #include "pmu-target.h"
33 #include "nand-target.h"
36 /* Skeleton for adding target specific debug info to the debug menu
39 #define _DEBUG_PRINTF(a, varargs...) lcd_putsf(0, line++, (a), ##varargs);
42 extern uint32_t nand_type
[4];
44 bool __dbg_hw_info(void)
49 unsigned int state
= 0;
50 const unsigned int max_states
=2;
52 struct storage_info info
;
53 const struct nand_device_info_type
*nand_devicetype
[4];
58 nand_devicetype
[i
] = nand_get_device_type(i
);
59 if(nand_devicetype
[i
] != NULL
) nand_bank_count
++;
64 lcd_setfont(FONT_SYSFIXED
);
72 /* _DEBUG_PRINTF statements can be added here to show debug info */
77 _DEBUG_PRINTF("CPU:");
78 _DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick
);
81 _DEBUG_PRINTF("LCD:");
82 _DEBUG_PRINTF("type: %d, %s", lcd_type
, lcd_type
? "(7) LDS176" : "(2) ILI9320");
85 _DEBUG_PRINTF("NAND:");
86 _DEBUG_PRINTF("banks: %d",nand_bank_count
);
90 if(nand_devicetype
[i
] != NULL
)
92 _DEBUG_PRINTF("bank: %d, id: %08X", i
, (unsigned int)(*nand_devicetype
[i
]).id
);
96 _DEBUG_PRINTF("sectors: %d", info
.num_sectors
);
97 _DEBUG_PRINTF("sector size: %d", info
.sector_size
);
98 _DEBUG_PRINTF("last disk activity: %d", (unsigned int)nand_last_disk_activity());
102 _DEBUG_PRINTF("PMU:");
107 _DEBUG_PRINTF("ldo %d: %dmV (CLICKWHEEL)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
111 _DEBUG_PRINTF("ldo %d: %dmV (AUDIO)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
115 _DEBUG_PRINTF("ldo %d: %dmV (NAND)",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
119 _DEBUG_PRINTF("ldo %d: %dmV",i
,900 + pmu_read(0x2d + (i
<< 1))*100);
122 _DEBUG_PRINTF("cpu voltage: %dmV",625 + pmu_read(0x1e)*25);
123 _DEBUG_PRINTF("memory voltage: %dmV",625 + pmu_read(0x22)*25);
125 _DEBUG_PRINTF("charging: %s", charging_state() ? "true" : "false");
126 _DEBUG_PRINTF("backlight: %s", pmu_read(0x29) ? "on" : "off");
127 _DEBUG_PRINTF("brightness value: %d", pmu_read(0x28));
135 _DEBUG_PRINTF("__dbg_hw_info");
139 switch(button_get_w_tmo(HZ
/20))
141 case BUTTON_SCROLL_BACK
:
142 if(state
!=0) state
--;
145 case BUTTON_SCROLL_FWD
:
146 if(state
!=max_states
-1)
154 lcd_setfont(FONT_UI
);
159 lcd_setfont(FONT_UI
);
163 bool __dbg_ports(void)
167 lcd_setfont(FONT_SYSFIXED
);
174 _DEBUG_PRINTF("GPIO 0: %08x",(unsigned int)PDAT0
);
175 _DEBUG_PRINTF("GPIO 1: %08x",(unsigned int)PDAT1
);
176 _DEBUG_PRINTF("GPIO 2: %08x",(unsigned int)PDAT2
);
177 _DEBUG_PRINTF("GPIO 3: %08x",(unsigned int)PDAT3
);
178 _DEBUG_PRINTF("GPIO 4: %08x",(unsigned int)PDAT4
);
179 _DEBUG_PRINTF("GPIO 5: %08x",(unsigned int)PDAT5
);
180 _DEBUG_PRINTF("GPIO 6: %08x",(unsigned int)PDAT6
);
181 _DEBUG_PRINTF("GPIO 7: %08x",(unsigned int)PDAT7
);
182 _DEBUG_PRINTF("GPIO 10: %08x",(unsigned int)PDAT10
);
183 _DEBUG_PRINTF("GPIO 11: %08x",(unsigned int)PDAT11
);
184 _DEBUG_PRINTF("GPIO 13: %08x",(unsigned int)PDAT13
);
185 _DEBUG_PRINTF("GPIO 14: %08x",(unsigned int)PDAT14
);
186 _DEBUG_PRINTF("5USEC : %08x",(unsigned int)FIVE_USEC_TIMER
);
187 _DEBUG_PRINTF("USEC : %08x",(unsigned int)USEC_TIMER
);
188 _DEBUG_PRINTF("USECREG: %08x",(unsigned int)(*(REG32_PTR_T
)(0x3C700084)));
191 if (button_get_w_tmo(HZ
/10) == (DEBUG_CANCEL
|BUTTON_REL
))
194 lcd_setfont(FONT_UI
);