summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c366
-rw-r--r--firmware/SOURCES3
-rw-r--r--firmware/target/arm/debug-pp.c154
-rw-r--r--firmware/target/arm/debug-target.h49
-rw-r--r--firmware/target/arm/imx31/debug-imx31.c2
-rw-r--r--firmware/target/arm/imx31/debug-target.h2
-rw-r--r--firmware/target/arm/pnx0101/debug-pnx0101.c5
-rw-r--r--firmware/target/arm/pnx0101/debug-target.h24
-rw-r--r--firmware/target/arm/s3c2440/debug-s3c2440.c2
-rw-r--r--firmware/target/arm/s3c2440/debug-target.h2
-rw-r--r--firmware/target/arm/s5l8700/debug-s5l8700.c2
-rw-r--r--firmware/target/arm/s5l8700/debug-target.h2
-rw-r--r--firmware/target/arm/tcc77x/debug-target.h2
-rw-r--r--firmware/target/arm/tcc77x/debug-tcc77x.c2
-rw-r--r--firmware/target/arm/tcc780x/debug-target.h2
-rw-r--r--firmware/target/arm/tcc780x/debug-tcc780x.c2
-rw-r--r--firmware/target/arm/tms320dm320/debug-dm320.c2
-rw-r--r--firmware/target/arm/tms320dm320/debug-target.h2
-rw-r--r--firmware/target/coldfire/debug-coldfire.c106
-rw-r--r--firmware/target/coldfire/debug-target.h34
-rw-r--r--firmware/target/mips/ingenic_jz47xx/debug-jz4740.c2
-rw-r--r--firmware/target/mips/ingenic_jz47xx/debug-target.h2
-rw-r--r--firmware/target/sh/debug-sh.c103
-rw-r--r--firmware/target/sh/debug-target.h27
24 files changed, 519 insertions, 380 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index bedc98ae10..631f027017 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -99,12 +99,7 @@
99#include "pcf50605.h" 99#include "pcf50605.h"
100#endif 100#endif
101#include "appevents.h" 101#include "appevents.h"
102
103#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
104 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 || CONFIG_CPU == JZ4732 \
105 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2
106#include "debug-target.h" 102#include "debug-target.h"
107#endif
108 103
109#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \ 104#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
110 || (CONFIG_CPU == AS3525 && defined(CONFIG_CHARGING)) \ 105 || (CONFIG_CPU == AS3525 && defined(CONFIG_CHARGING)) \
@@ -953,367 +948,6 @@ static bool dbg_spdif(void)
953} 948}
954#endif /* CPU_COLDFIRE */ 949#endif /* CPU_COLDFIRE */
955 950
956#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
957#ifdef HAVE_LCD_BITMAP
958 /* button definitions */
959#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
960 (CONFIG_KEYPAD == IRIVER_H300_PAD)
961# define DEBUG_CANCEL BUTTON_OFF
962
963#elif CONFIG_KEYPAD == RECORDER_PAD
964# define DEBUG_CANCEL BUTTON_OFF
965
966#elif CONFIG_KEYPAD == ONDIO_PAD
967# define DEBUG_CANCEL BUTTON_MENU
968
969#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
970 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
971 (CONFIG_KEYPAD == IPOD_4G_PAD)
972# define DEBUG_CANCEL BUTTON_MENU
973
974#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
975# define DEBUG_CANCEL BUTTON_PLAY
976
977#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
978# define DEBUG_CANCEL BUTTON_REC
979
980#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
981# define DEBUG_CANCEL BUTTON_RC_REC
982
983#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
984# define DEBUG_CANCEL BUTTON_REW
985
986#elif (CONFIG_KEYPAD == MROBE100_PAD)
987# define DEBUG_CANCEL BUTTON_MENU
988
989#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
990 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
991 (CONFIG_KEYPAD == SANSA_FUZE_PAD)
992# define DEBUG_CANCEL BUTTON_LEFT
993
994/* This is temporary until the SA9200 touchpad works */
995#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
996 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
997# define DEBUG_CANCEL BUTTON_POWER
998
999#elif (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)
1000# define DEBUG_CANCEL BUTTON_PREV
1001
1002#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
1003# define DEBUG_CANCEL BUTTON_PLAY
1004
1005#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
1006# define DEBUG_CANCEL BUTTON_CANCEL
1007
1008#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
1009# define DEBUG_CANCEL BUTTON_REC
1010
1011#endif /* key definitions */
1012
1013/* Test code!!! */
1014bool dbg_ports(void)
1015{
1016#if CONFIG_CPU == SH7034
1017 int adc_battery_voltage, adc_battery_level;
1018
1019 lcd_setfont(FONT_SYSFIXED);
1020 lcd_clear_display();
1021
1022 while(1)
1023 {
1024 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
1025 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR);
1026
1027 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
1028 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
1029 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
1030 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
1031
1032 battery_read_info(&adc_battery_voltage, &adc_battery_level);
1033 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
1034 adc_battery_voltage % 1000, adc_battery_level);
1035
1036 lcd_update();
1037 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1038 {
1039 lcd_setfont(FONT_UI);
1040 return false;
1041 }
1042 }
1043#elif defined(CPU_COLDFIRE)
1044 unsigned int gpio_out;
1045 unsigned int gpio1_out;
1046 unsigned int gpio_read;
1047 unsigned int gpio1_read;
1048 unsigned int gpio_function;
1049 unsigned int gpio1_function;
1050 unsigned int gpio_enable;
1051 unsigned int gpio1_enable;
1052 int adc_buttons, adc_remote;
1053 int adc_battery_voltage, adc_battery_level;
1054 int line;
1055
1056 lcd_clear_display();
1057 lcd_setfont(FONT_SYSFIXED);
1058
1059 while(1)
1060 {
1061 line = 0;
1062 gpio_read = GPIO_READ;
1063 gpio1_read = GPIO1_READ;
1064 gpio_out = GPIO_OUT;
1065 gpio1_out = GPIO1_OUT;
1066 gpio_function = GPIO_FUNCTION;
1067 gpio1_function = GPIO1_FUNCTION;
1068 gpio_enable = GPIO_ENABLE;
1069 gpio1_enable = GPIO1_ENABLE;
1070
1071 lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
1072 lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
1073 lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
1074 lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
1075
1076 lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
1077 lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
1078 lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
1079 lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
1080
1081 adc_buttons = adc_read(ADC_BUTTONS);
1082 adc_remote = adc_read(ADC_REMOTE);
1083 battery_read_info(&adc_battery_voltage, &adc_battery_level);
1084#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
1085 lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
1086 button_scan_enabled() ? '+' : '-', adc_buttons);
1087#else
1088 lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
1089#endif
1090#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
1091 lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
1092 remote_detect() ? '+' : '-', adc_remote);
1093#else
1094 lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
1095#endif
1096#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1097 lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
1098 adc_read(ADC_REMOTEDETECT));
1099#endif
1100
1101 lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
1102 adc_battery_voltage % 1000, adc_battery_level);
1103
1104#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
1105 lcd_putsf(0, line++, "remotetype: %d", remote_type());
1106#endif
1107
1108 lcd_update();
1109 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1110 {
1111 lcd_setfont(FONT_UI);
1112 return false;
1113 }
1114 }
1115
1116#elif defined(CPU_PP502x)
1117 int line;
1118
1119 lcd_clear_display();
1120 lcd_setfont(FONT_SYSFIXED);
1121
1122 while(1)
1123 {
1124 line = 0;
1125#if (LCD_HEIGHT >= 176) /* Only for displays with appropriate height. */
1126 lcd_puts(0, line++, "GPIO ENABLE: GPIO OUTPUT ENABLE:");
1127 lcd_putsf(0, line++, "A: %02x E: %02x I: %02x A: %02x E: %02x I: %02x",
1128 (unsigned int)GPIOA_ENABLE,
1129 (unsigned int)GPIOE_ENABLE,
1130 (unsigned int)GPIOI_ENABLE,
1131 (unsigned int)GPIOA_OUTPUT_EN,
1132 (unsigned int)GPIOE_OUTPUT_EN,
1133 (unsigned int)GPIOI_OUTPUT_EN);
1134 lcd_putsf(0, line++, "B: %02x F: %02x J: %02x B: %02x F: %02x J: %02x",
1135 (unsigned int)GPIOB_ENABLE,
1136 (unsigned int)GPIOF_ENABLE,
1137 (unsigned int)GPIOJ_ENABLE,
1138 (unsigned int)GPIOB_OUTPUT_EN,
1139 (unsigned int)GPIOF_OUTPUT_EN,
1140 (unsigned int)GPIOJ_OUTPUT_EN);
1141 lcd_putsf(0, line++, "C: %02x G: %02x K: %02x C: %02x G: %02x K: %02x",
1142 (unsigned int)GPIOC_ENABLE,
1143 (unsigned int)GPIOG_ENABLE,
1144 (unsigned int)GPIOK_ENABLE,
1145 (unsigned int)GPIOC_OUTPUT_EN,
1146 (unsigned int)GPIOG_OUTPUT_EN,
1147 (unsigned int)GPIOK_OUTPUT_EN);
1148 lcd_putsf(0, line++, "D: %02x H: %02x L: %02x D: %02x H: %02x L: %02x",
1149 (unsigned int)GPIOD_ENABLE,
1150 (unsigned int)GPIOH_ENABLE,
1151 (unsigned int)GPIOL_ENABLE,
1152 (unsigned int)GPIOD_OUTPUT_EN,
1153 (unsigned int)GPIOH_OUTPUT_EN,
1154 (unsigned int)GPIOL_OUTPUT_EN);
1155 line++;
1156#endif
1157 lcd_puts(0, line++, "GPIO INPUT VAL:");
1158 lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
1159 (unsigned int)GPIOA_INPUT_VAL,
1160 (unsigned int)GPIOE_INPUT_VAL,
1161 (unsigned int)GPIOI_INPUT_VAL);
1162 lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
1163 (unsigned int)GPIOB_INPUT_VAL,
1164 (unsigned int)GPIOF_INPUT_VAL,
1165 (unsigned int)GPIOJ_INPUT_VAL);
1166 lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
1167 (unsigned int)GPIOC_INPUT_VAL,
1168 (unsigned int)GPIOG_INPUT_VAL,
1169 (unsigned int)GPIOK_INPUT_VAL);
1170 lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
1171 (unsigned int)GPIOD_INPUT_VAL,
1172 (unsigned int)GPIOH_INPUT_VAL,
1173 (unsigned int)GPIOL_INPUT_VAL);
1174 line++;
1175 lcd_putsf(0, line++, "GPO32_VAL: %08lx", GPO32_VAL);
1176 lcd_putsf(0, line++, "GPO32_EN: %08lx", GPO32_ENABLE);
1177 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
1178 lcd_putsf(0, line++, "DEV_EN2: %08lx", DEV_EN2);
1179 lcd_putsf(0, line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
1180 lcd_putsf(0, line++, "DEV_INIT1: %08lx", DEV_INIT1);
1181 lcd_putsf(0, line++, "DEV_INIT2: %08lx", DEV_INIT2);
1182#ifdef ADC_ACCESSORY
1183 lcd_putsf(0, line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
1184#endif
1185#ifdef IPOD_VIDEO
1186 lcd_putsf(0, line++, "4066_ISTAT: %d", adc_read(ADC_4066_ISTAT));
1187#endif
1188
1189#if defined(IPOD_ACCESSORY_PROTOCOL)
1190 const unsigned char *serbuf = iap_get_serbuf();
1191 lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
1192 serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5],
1193 serbuf[6], serbuf[7]);
1194#endif
1195
1196#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
1197 line++;
1198 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
1199 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
1200 lcd_putsf(0, line++, "REM: %03x PAD: %03x",
1201 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
1202#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
1203 line++;
1204 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
1205 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
1206#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1207 lcd_putsf(0, line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
1208 lcd_putsf(0, line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
1209 lcd_putsf(0, line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
1210 lcd_putsf(0, line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
1211 lcd_putsf(0, line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
1212 lcd_putsf(0, line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
1213 lcd_putsf(0, line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
1214 lcd_putsf(0, line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
1215 lcd_putsf(0, line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
1216 lcd_putsf(0, line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
1217 lcd_putsf(0, line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
1218#if !defined(PHILIPS_SA9200)
1219 lcd_putsf(0, line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
1220 lcd_putsf(0, line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
1221#endif
1222#endif
1223 lcd_update();
1224 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1225 {
1226 lcd_setfont(FONT_UI);
1227 return false;
1228 }
1229 }
1230
1231#elif CONFIG_CPU == PP5002
1232 int line;
1233
1234 lcd_clear_display();
1235 lcd_setfont(FONT_SYSFIXED);
1236
1237 while(1)
1238 {
1239 line = 0;
1240 lcd_putsf(0, line++, "GPIO_A: %02x GPIO_B: %02x",
1241 (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL);
1242 lcd_putsf(0, line++, "GPIO_C: %02x GPIO_D: %02x",
1243 (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL);
1244
1245 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
1246 lcd_putsf(0, line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
1247 lcd_putsf(0, line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
1248 lcd_putsf(0, line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
1249 lcd_putsf(0, line++, "PLL_DIV: %08lx", PLL_DIV);
1250 lcd_putsf(0, line++, "PLL_MULT: %08lx", PLL_MULT);
1251 lcd_putsf(0, line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
1252 lcd_putsf(0, line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
1253
1254 lcd_update();
1255 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1256 {
1257 lcd_setfont(FONT_UI);
1258 return false;
1259 }
1260 }
1261 lcd_setfont(FONT_UI);
1262#else
1263 return __dbg_ports();
1264#endif /* CPU */
1265 return false;
1266}
1267#else /* !HAVE_LCD_BITMAP */
1268bool dbg_ports(void)
1269{
1270 int button;
1271 int adc_battery_voltage;
1272 int currval = 0;
1273
1274 lcd_clear_display();
1275
1276 while(1)
1277 {
1278 if (currval == 0) {
1279 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
1280 } else if (currval == 1) {
1281 lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR);
1282 } else {
1283 int idx = currval - 2; /* idx < 7 */
1284 lcd_putsf(0, 0, "AN%d: %03x", idx, adc_read(idx));
1285 }
1286
1287 battery_read_info(&adc_battery_voltage, NULL);
1288 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
1289 adc_battery_voltage % 1000);
1290 lcd_update();
1291
1292 button = get_action(CONTEXT_SETTINGS,HZ/5);
1293
1294 switch(button)
1295 {
1296 case ACTION_STD_CANCEL:
1297 return false;
1298
1299 case ACTION_SETTINGS_DEC:
1300 currval--;
1301 if(currval < 0)
1302 currval = 9;
1303 break;
1304
1305 case ACTION_SETTINGS_INC:
1306 currval++;
1307 if(currval > 9)
1308 currval = 0;
1309 break;
1310 }
1311 }
1312 return false;
1313}
1314#endif /* !HAVE_LCD_BITMAP */
1315#endif /* PLATFORM_NATIVE */
1316
1317#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE) 951#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
1318static bool dbg_pcf(void) 952static bool dbg_pcf(void)
1319{ 953{
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 5b7a582604..c2df946394 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -398,6 +398,7 @@ target/sh/memset-sh.S
398target/sh/strlen-sh.S 398target/sh/strlen-sh.S
399target/sh/system-sh.c 399target/sh/system-sh.c
400target/sh/archos/descramble.S 400target/sh/archos/descramble.S
401target/sh/debug-sh.c
401#endif /* SIMULATOR */ 402#endif /* SIMULATOR */
402 403
403#elif defined(CPU_COLDFIRE) 404#elif defined(CPU_COLDFIRE)
@@ -421,6 +422,7 @@ target/coldfire/system-coldfire.c
421target/coldfire/timer-coldfire.c 422target/coldfire/timer-coldfire.c
422#ifndef BOOTLOADER 423#ifndef BOOTLOADER
423target/coldfire/pcm-coldfire.c 424target/coldfire/pcm-coldfire.c
425target/coldfire/debug-coldfire.c
424#endif /* BOOTLOADER */ 426#endif /* BOOTLOADER */
425#if CONFIG_I2C == I2C_COLDFIRE 427#if CONFIG_I2C == I2C_COLDFIRE
426target/coldfire/i2c-coldfire.c 428target/coldfire/i2c-coldfire.c
@@ -503,6 +505,7 @@ target/arm/system-pp502x.c
503target/arm/crt0-pp-bl.S 505target/arm/crt0-pp-bl.S
504#else 506#else
505target/arm/pcm-pp.c 507target/arm/pcm-pp.c
508target/arm/debug-pp.c
506#if !defined(SANSA_E200) && !defined(SANSA_C200) 509#if !defined(SANSA_E200) && !defined(SANSA_C200)
507target/arm/audio-pp.c 510target/arm/audio-pp.c
508#endif /* SANSA_E200 */ 511#endif /* SANSA_E200 */
diff --git a/firmware/target/arm/debug-pp.c b/firmware/target/arm/debug-pp.c
new file mode 100644
index 0000000000..3b9250c0fb
--- /dev/null
+++ b/firmware/target/arm/debug-pp.c
@@ -0,0 +1,154 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Dave Chapman
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include <stdbool.h>
25#include "font.h"
26#include "lcd.h"
27#include "button.h"
28#include "powermgmt.h"
29#include "adc.h"
30#include "iap.h"
31#include "debug-target.h"
32
33bool dbg_ports(void)
34{
35 int line;
36
37 lcd_clear_display();
38 lcd_setfont(FONT_SYSFIXED);
39
40 while(1)
41 {
42 line = 0;
43#if defined(CPU_PP502x)
44#if (LCD_HEIGHT >= 176) /* Only for displays with appropriate height. */
45 lcd_puts(0, line++, "GPIO ENABLE:");
46 lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
47 (unsigned int)GPIOA_ENABLE,
48 (unsigned int)GPIOE_ENABLE,
49 (unsigned int)GPIOI_ENABLE);
50 lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
51 (unsigned int)GPIOB_ENABLE,
52 (unsigned int)GPIOF_ENABLE,
53 (unsigned int)GPIOJ_ENABLE);
54 lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
55 (unsigned int)GPIOC_ENABLE,
56 (unsigned int)GPIOG_ENABLE,
57 (unsigned int)GPIOK_ENABLE);
58 lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
59 (unsigned int)GPIOD_ENABLE,
60 (unsigned int)GPIOH_ENABLE,
61 (unsigned int)GPIOL_ENABLE);
62 line++;
63#endif
64 lcd_puts(0, line++, "GPIO INPUT VAL:");
65 lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
66 (unsigned int)GPIOA_INPUT_VAL,
67 (unsigned int)GPIOE_INPUT_VAL,
68 (unsigned int)GPIOI_INPUT_VAL);
69 lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
70 (unsigned int)GPIOB_INPUT_VAL,
71 (unsigned int)GPIOF_INPUT_VAL,
72 (unsigned int)GPIOJ_INPUT_VAL);
73 lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
74 (unsigned int)GPIOC_INPUT_VAL,
75 (unsigned int)GPIOG_INPUT_VAL,
76 (unsigned int)GPIOK_INPUT_VAL);
77 lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
78 (unsigned int)GPIOD_INPUT_VAL,
79 (unsigned int)GPIOH_INPUT_VAL,
80 (unsigned int)GPIOL_INPUT_VAL);
81 line++;
82 lcd_putsf(0, line++, "GPO32_VAL: %08lx", GPO32_VAL);
83 lcd_putsf(0, line++, "GPO32_EN: %08lx", GPO32_ENABLE);
84 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
85 lcd_putsf(0, line++, "DEV_EN2: %08lx", DEV_EN2);
86 lcd_putsf(0, line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
87 lcd_putsf(0, line++, "DEV_INIT1: %08lx", DEV_INIT1);
88 lcd_putsf(0, line++, "DEV_INIT2: %08lx", DEV_INIT2);
89#ifdef ADC_ACCESSORY
90 lcd_putsf(0, line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
91#endif
92#ifdef IPOD_VIDEO
93 lcd_putsf(0, line++, "4066_ISTAT: %d", adc_read(ADC_4066_ISTAT));
94#endif
95
96#if defined(IPOD_ACCESSORY_PROTOCOL)
97 const unsigned char *serbuf = iap_get_serbuf();
98 lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
99 serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5],
100 serbuf[6], serbuf[7]);
101#endif
102
103#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
104 line++;
105 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
106 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
107 lcd_putsf(0, line++, "REM: %03x PAD: %03x",
108 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
109#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
110 line++;
111 lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
112 adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
113#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
114 lcd_putsf(0, line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
115 lcd_putsf(0, line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
116 lcd_putsf(0, line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
117 lcd_putsf(0, line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
118 lcd_putsf(0, line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
119 lcd_putsf(0, line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
120 lcd_putsf(0, line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
121 lcd_putsf(0, line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
122 lcd_putsf(0, line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
123 lcd_putsf(0, line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
124 lcd_putsf(0, line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
125#if !defined(PHILIPS_SA9200)
126 lcd_putsf(0, line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
127 lcd_putsf(0, line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
128#endif
129#endif
130
131#elif CONFIG_CPU == PP5002
132 lcd_putsf(0, line++, "GPIO_A: %02x GPIO_B: %02x",
133 (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL);
134 lcd_putsf(0, line++, "GPIO_C: %02x GPIO_D: %02x",
135 (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL);
136
137 lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
138 lcd_putsf(0, line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
139 lcd_putsf(0, line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
140 lcd_putsf(0, line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
141 lcd_putsf(0, line++, "PLL_DIV: %08lx", PLL_DIV);
142 lcd_putsf(0, line++, "PLL_MULT: %08lx", PLL_MULT);
143 lcd_putsf(0, line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
144 lcd_putsf(0, line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
145#endif
146 lcd_update();
147 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
148 {
149 lcd_setfont(FONT_UI);
150 return false;
151 }
152 }
153 return false;
154}
diff --git a/firmware/target/arm/debug-target.h b/firmware/target/arm/debug-target.h
new file mode 100644
index 0000000000..4408acf5da
--- /dev/null
+++ b/firmware/target/arm/debug-target.h
@@ -0,0 +1,49 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Marcin Bukat
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
22 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
23 (CONFIG_KEYPAD == IPOD_4G_PAD)
24# define DEBUG_CANCEL BUTTON_MENU
25
26#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
27# define DEBUG_CANCEL BUTTON_REW
28
29#elif (CONFIG_KEYPAD == MROBE100_PAD)
30# define DEBUG_CANCEL BUTTON_MENU
31
32#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
33 (CONFIG_KEYPAD == SANSA_C200_PAD)
34# define DEBUG_CANCEL BUTTON_LEFT
35
36#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) || \
37 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
38# define DEBUG_CANCEL BUTTON_POWER
39
40#elif (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)
41# define DEBUG_CANCEL BUTTON_PREV
42
43#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
44# define DEBUG_CANCEL BUTTON_PLAY
45
46#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
47# define DEBUG_CANCEL BUTTON_CANCEL
48#endif
49bool dbg_ports(void);
diff --git a/firmware/target/arm/imx31/debug-imx31.c b/firmware/target/arm/imx31/debug-imx31.c
index 07f9453b29..1239c7cae7 100644
--- a/firmware/target/arm/imx31/debug-imx31.c
+++ b/firmware/target/arm/imx31/debug-imx31.c
@@ -141,7 +141,7 @@ bool __dbg_hw_info(void)
141 } 141 }
142} 142}
143 143
144bool __dbg_ports(void) 144bool dbg_ports(void)
145{ 145{
146 int line; 146 int line;
147 int i; 147 int i;
diff --git a/firmware/target/arm/imx31/debug-target.h b/firmware/target/arm/imx31/debug-target.h
index ed8bba3984..06baee5ea0 100644
--- a/firmware/target/arm/imx31/debug-target.h
+++ b/firmware/target/arm/imx31/debug-target.h
@@ -23,6 +23,6 @@
23 23
24#define DEBUG_CANCEL BUTTON_BACK 24#define DEBUG_CANCEL BUTTON_BACK
25bool __dbg_hw_info(void); 25bool __dbg_hw_info(void);
26bool __dbg_ports(void); 26bool dbg_ports(void);
27 27
28#endif /* DEBUG_TARGET_H */ 28#endif /* DEBUG_TARGET_H */
diff --git a/firmware/target/arm/pnx0101/debug-pnx0101.c b/firmware/target/arm/pnx0101/debug-pnx0101.c
new file mode 100644
index 0000000000..3a556e66e3
--- /dev/null
+++ b/firmware/target/arm/pnx0101/debug-pnx0101.c
@@ -0,0 +1,5 @@
1/* just empty stub */
2bool dbg_ports()
3{
4 return false;
5}
diff --git a/firmware/target/arm/pnx0101/debug-target.h b/firmware/target/arm/pnx0101/debug-target.h
new file mode 100644
index 0000000000..4ed4cede92
--- /dev/null
+++ b/firmware/target/arm/pnx0101/debug-target.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Marcin Bukat
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
22# define DEBUG_CANCEL BUTTON_PLAY
23#endif /* key definitions */
24bool dbg_ports(void);
diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c
index 196a0b4177..e552f12c2b 100644
--- a/firmware/target/arm/s3c2440/debug-s3c2440.c
+++ b/firmware/target/arm/s3c2440/debug-s3c2440.c
@@ -34,7 +34,7 @@ bool __dbg_hw_info(void)
34 return false; 34 return false;
35} 35}
36 36
37bool __dbg_ports(void) 37bool dbg_ports(void)
38{ 38{
39 int line; 39 int line;
40 40
diff --git a/firmware/target/arm/s3c2440/debug-target.h b/firmware/target/arm/s3c2440/debug-target.h
index bf1b6218e4..dc274b9f06 100644
--- a/firmware/target/arm/s3c2440/debug-target.h
+++ b/firmware/target/arm/s3c2440/debug-target.h
@@ -26,5 +26,5 @@
26#endif 26#endif
27 27
28bool __dbg_hw_info(void); 28bool __dbg_hw_info(void);
29bool __dbg_ports(void); 29bool dbg_ports(void);
30 30
diff --git a/firmware/target/arm/s5l8700/debug-s5l8700.c b/firmware/target/arm/s5l8700/debug-s5l8700.c
index 29170d4ed2..1f8dbebc68 100644
--- a/firmware/target/arm/s5l8700/debug-s5l8700.c
+++ b/firmware/target/arm/s5l8700/debug-s5l8700.c
@@ -155,7 +155,7 @@ bool __dbg_hw_info(void)
155 return false; 155 return false;
156} 156}
157 157
158bool __dbg_ports(void) 158bool dbg_ports(void)
159{ 159{
160 int line; 160 int line;
161 161
diff --git a/firmware/target/arm/s5l8700/debug-target.h b/firmware/target/arm/s5l8700/debug-target.h
index f4a0247cc4..351468fb50 100644
--- a/firmware/target/arm/s5l8700/debug-target.h
+++ b/firmware/target/arm/s5l8700/debug-target.h
@@ -27,7 +27,7 @@
27#define DEBUG_CANCEL BUTTON_MENU 27#define DEBUG_CANCEL BUTTON_MENU
28 28
29bool __dbg_hw_info(void); 29bool __dbg_hw_info(void);
30bool __dbg_ports(void); 30bool dbg_ports(void);
31 31
32#endif /* _DEBUG_TARGET_H_ */ 32#endif /* _DEBUG_TARGET_H_ */
33 33
diff --git a/firmware/target/arm/tcc77x/debug-target.h b/firmware/target/arm/tcc77x/debug-target.h
index a744c4f456..6cf93cc5a4 100644
--- a/firmware/target/arm/tcc77x/debug-target.h
+++ b/firmware/target/arm/tcc77x/debug-target.h
@@ -20,5 +20,5 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22bool __dbg_hw_info(void); 22bool __dbg_hw_info(void);
23bool __dbg_ports(void); 23bool dbg_ports(void);
24 24
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c
index 20d6954b03..88b0722a4e 100644
--- a/firmware/target/arm/tcc77x/debug-tcc77x.c
+++ b/firmware/target/arm/tcc77x/debug-tcc77x.c
@@ -31,7 +31,7 @@
31#include "debug-target.h" 31#include "debug-target.h"
32#include "adc.h" 32#include "adc.h"
33 33
34bool __dbg_ports(void) 34bool dbg_ports(void)
35{ 35{
36 return false; 36 return false;
37} 37}
diff --git a/firmware/target/arm/tcc780x/debug-target.h b/firmware/target/arm/tcc780x/debug-target.h
index a744c4f456..6cf93cc5a4 100644
--- a/firmware/target/arm/tcc780x/debug-target.h
+++ b/firmware/target/arm/tcc780x/debug-target.h
@@ -20,5 +20,5 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22bool __dbg_hw_info(void); 22bool __dbg_hw_info(void);
23bool __dbg_ports(void); 23bool dbg_ports(void);
24 24
diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c
index 9267307e05..d527e2b045 100644
--- a/firmware/target/arm/tcc780x/debug-tcc780x.c
+++ b/firmware/target/arm/tcc780x/debug-tcc780x.c
@@ -35,7 +35,7 @@
35#define STS (*(volatile unsigned long *)0xF3001008) 35#define STS (*(volatile unsigned long *)0xF3001008)
36#define SRC (*(volatile unsigned long *)0xF3001010) 36#define SRC (*(volatile unsigned long *)0xF3001010)
37 37
38bool __dbg_ports(void) 38bool dbg_ports(void)
39{ 39{
40 return false; 40 return false;
41} 41}
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c
index cc529f5d15..26f34a4f5f 100644
--- a/firmware/target/arm/tms320dm320/debug-dm320.c
+++ b/firmware/target/arm/tms320dm320/debug-dm320.c
@@ -36,7 +36,7 @@
36#include "m66591.h" 36#include "m66591.h"
37#endif 37#endif
38 38
39bool __dbg_ports(void) 39bool dbg_ports(void)
40{ 40{
41#if defined(MROBE_500) 41#if defined(MROBE_500)
42 int line = 0; 42 int line = 0;
diff --git a/firmware/target/arm/tms320dm320/debug-target.h b/firmware/target/arm/tms320dm320/debug-target.h
index 9e41fa4f9b..bcf9d688cd 100644
--- a/firmware/target/arm/tms320dm320/debug-target.h
+++ b/firmware/target/arm/tms320dm320/debug-target.h
@@ -20,4 +20,4 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22bool __dbg_hw_info(void); 22bool __dbg_hw_info(void);
23bool __dbg_ports(void); 23bool dbg_ports(void);
diff --git a/firmware/target/coldfire/debug-coldfire.c b/firmware/target/coldfire/debug-coldfire.c
new file mode 100644
index 0000000000..0676ed0b07
--- /dev/null
+++ b/firmware/target/coldfire/debug-coldfire.c
@@ -0,0 +1,106 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include <stdbool.h>
25#include "font.h"
26#include "lcd.h"
27#include "button.h"
28#include "powermgmt.h"
29#include "adc.h"
30#include "debug-target.h"
31
32bool dbg_ports(void)
33{
34 unsigned int gpio_out;
35 unsigned int gpio1_out;
36 unsigned int gpio_read;
37 unsigned int gpio1_read;
38 unsigned int gpio_function;
39 unsigned int gpio1_function;
40 unsigned int gpio_enable;
41 unsigned int gpio1_enable;
42 int adc_battery_voltage, adc_battery_level;
43 int adc_buttons, adc_remote;
44 int line;
45
46 lcd_clear_display();
47 lcd_setfont(FONT_SYSFIXED);
48
49 while(1)
50 {
51 line = 0;
52 gpio_read = GPIO_READ;
53 gpio1_read = GPIO1_READ;
54 gpio_out = GPIO_OUT;
55 gpio1_out = GPIO1_OUT;
56 gpio_function = GPIO_FUNCTION;
57 gpio1_function = GPIO1_FUNCTION;
58 gpio_enable = GPIO_ENABLE;
59 gpio1_enable = GPIO1_ENABLE;
60
61 lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
62 lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
63 lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
64 lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
65 lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
66 lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
67 lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
68 lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
69
70 adc_buttons = adc_read(ADC_BUTTONS);
71 adc_remote = adc_read(ADC_REMOTE);
72 battery_read_info(&adc_battery_voltage, &adc_battery_level);
73#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
74 lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
75 button_scan_enabled() ? '+' : '-', adc_buttons);
76#else
77 lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
78#endif
79#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
80 lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
81 remote_detect() ? '+' : '-', adc_remote);
82#else
83 lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
84#endif
85#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
86 lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
87 adc_read(ADC_REMOTEDETECT));
88#endif
89
90 battery_read_info(&adc_battery_voltage, &adc_battery_level);
91 lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
92 adc_battery_voltage % 1000, adc_battery_level);
93
94#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
95 lcd_putsf(0, line++, "remotetype: %d", remote_type());
96#endif
97
98 lcd_update();
99 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
100 {
101 lcd_setfont(FONT_UI);
102 return false;
103 }
104 }
105 return false;
106}
diff --git a/firmware/target/coldfire/debug-target.h b/firmware/target/coldfire/debug-target.h
new file mode 100644
index 0000000000..76b502e4ff
--- /dev/null
+++ b/firmware/target/coldfire/debug-target.h
@@ -0,0 +1,34 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Marcin Bukat
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
22 (CONFIG_KEYPAD == IRIVER_H300_PAD)
23# define DEBUG_CANCEL BUTTON_OFF
24
25#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
26# define DEBUG_CANCEL BUTTON_REC
27
28#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
29# define DEBUG_CANCEL BUTTON_RC_REC
30
31#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
32# define DEBUG_CANCEL BUTTON_REC
33#endif
34bool dbg_ports(void);
diff --git a/firmware/target/mips/ingenic_jz47xx/debug-jz4740.c b/firmware/target/mips/ingenic_jz47xx/debug-jz4740.c
index f2b302e4c1..5bdd4c4de9 100644
--- a/firmware/target/mips/ingenic_jz47xx/debug-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/debug-jz4740.c
@@ -129,7 +129,7 @@ static void display_enabled_clocks(void)
129 (clkgr & CPM_CLKGR_UART0) ? "stopped" : "running"); 129 (clkgr & CPM_CLKGR_UART0) ? "stopped" : "running");
130} 130}
131 131
132bool __dbg_ports(void) 132bool dbg_ports(void)
133{ 133{
134 return false; 134 return false;
135} 135}
diff --git a/firmware/target/mips/ingenic_jz47xx/debug-target.h b/firmware/target/mips/ingenic_jz47xx/debug-target.h
index f753e6ee6c..f82b43da5b 100644
--- a/firmware/target/mips/ingenic_jz47xx/debug-target.h
+++ b/firmware/target/mips/ingenic_jz47xx/debug-target.h
@@ -23,6 +23,6 @@
23#define __DEBUG_TARGET_H_ 23#define __DEBUG_TARGET_H_
24 24
25bool __dbg_hw_info(void); 25bool __dbg_hw_info(void);
26bool __dbg_ports(void); 26bool dbg_ports(void);
27 27
28#endif /* __DEBUG_TARGET_H_ */ 28#endif /* __DEBUG_TARGET_H_ */
diff --git a/firmware/target/sh/debug-sh.c b/firmware/target/sh/debug-sh.c
new file mode 100644
index 0000000000..3502cfade0
--- /dev/null
+++ b/firmware/target/sh/debug-sh.c
@@ -0,0 +1,103 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Heikki Hannikainen
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "system.h"
24#include <stdbool.h>
25#include "font.h"
26#include "lcd.h"
27#include "button.h"
28#include "powermgmt.h"
29#include "adc.h"
30#include "debug-target.h"
31
32bool dbg_ports(void)
33{
34 int adc_battery_voltage;
35#ifndef HAVE_LCD_BITMAP
36 int currval = 0;
37 int button;
38#else
39 int adc_battery_level;
40
41 lcd_setfont(FONT_SYSFIXED);
42#endif
43 lcd_clear_display();
44
45 while(1)
46 {
47#ifdef HAVE_LCD_BITMAP
48 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
49 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR);
50
51 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
52 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
53 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
54 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
55
56 battery_read_info(&adc_battery_voltage, &adc_battery_level);
57 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
58 adc_battery_voltage % 1000, adc_battery_level);
59
60 lcd_update();
61 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
62 {
63 lcd_setfont(FONT_UI);
64 return false;
65 }
66#else /* !HAVE_LCD_BITMAP */
67
68 if (currval == 0) {
69 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
70 } else if (currval == 1) {
71 lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR);
72 } else {
73 int idx = currval - 2; /* idx < 7 */
74 lcd_putsf(0, 0, "AN%d: %03x", idx, adc_read(idx));
75 }
76
77 battery_read_info(&adc_battery_voltage, NULL);
78 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
79 adc_battery_voltage % 1000);
80 lcd_update();
81
82 button = button_get_w_tmo(HZ/5);
83 switch(button)
84 {
85 case BUTTON_STOP:
86 return false;
87
88 case BUTTON_LEFT:
89 currval--;
90 if(currval < 0)
91 currval = 9;
92 break;
93
94 case BUTTON_RIGHT:
95 currval++;
96 if(currval > 9)
97 currval = 0;
98 break;
99 }
100#endif
101 }
102 return false;
103}
diff --git a/firmware/target/sh/debug-target.h b/firmware/target/sh/debug-target.h
new file mode 100644
index 0000000000..4e25b81948
--- /dev/null
+++ b/firmware/target/sh/debug-target.h
@@ -0,0 +1,27 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Marcin Bukat
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#if CONFIG_KEYPAD == RECORDER_PAD
22# define DEBUG_CANCEL BUTTON_OFF
23
24#elif CONFIG_KEYPAD == ONDIO_PAD
25# define DEBUG_CANCEL BUTTON_MENU
26#endif
27bool dbg_ports(void);