summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2011-09-06 12:38:05 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2011-09-06 12:38:05 +0000
commit9c40939d9c624322ef694d02bbf02b67473c4914 (patch)
tree9356c57238be6b075472a6765e583a1cd6b6f98e
parentfa856468ab217c6596c745eae8d872d772269d84 (diff)
downloadrockbox-9c40939d9c624322ef694d02bbf02b67473c4914.tar.gz
rockbox-9c40939d9c624322ef694d02bbf02b67473c4914.zip
rk27xx - implement dbg_hw_info() and dbg_ports()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30440 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/rk27xx/debug-rk27xx.c107
-rw-r--r--firmware/target/arm/rk27xx/debug-target.h33
2 files changed, 140 insertions, 0 deletions
diff --git a/firmware/target/arm/rk27xx/debug-rk27xx.c b/firmware/target/arm/rk27xx/debug-rk27xx.c
new file mode 100644
index 0000000000..037af7ced5
--- /dev/null
+++ b/firmware/target/arm/rk27xx/debug-rk27xx.c
@@ -0,0 +1,107 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2008 Rafaël Carré
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 <stdbool.h>
23#include "config.h"
24#include "kernel.h"
25#include "debug-target.h"
26#include "button.h"
27#include "lcd.h"
28#include "adc.h"
29#include "font.h"
30#include "storage.h"
31
32/* Skeleton for adding target specific debug info to the debug menu
33 */
34
35#define _DEBUG_PRINTF(a, varargs...) lcd_putsf(0, line++, (a), ##varargs);
36
37extern unsigned long sd_debug_time_rd;
38extern unsigned long sd_debug_time_wr;
39
40bool dbg_hw_info(void)
41{
42 int line;
43 lcd_clear_display();
44 lcd_setfont(FONT_SYSFIXED);
45
46 while(1)
47 {
48 lcd_clear_display();
49 line = 0;
50
51 /* _DEBUG_PRINTF statements can be added here to show debug info */
52 _DEBUG_PRINTF("SCU_ID: 0x%0x", SCU_ID);
53 _DEBUG_PRINTF("SCU_PLLCON1: 0x%0x", SCU_PLLCON1);
54 _DEBUG_PRINTF("SCU_PLLCON2: 0x%0x", SCU_PLLCON2);
55 _DEBUG_PRINTF("SCU_PLLCON3: 0x%0x", SCU_PLLCON3);
56 _DEBUG_PRINTF("SCU_DIVCON1: 0x%0x", SCU_DIVCON1);
57 _DEBUG_PRINTF("SCU_CLKCFG: 0x%0x", SCU_CLKCFG);
58 _DEBUG_PRINTF("SCU_CHIPCFG: 0x%0x", SCU_CHIPCFG);
59 line++;
60 _DEBUG_PRINTF("sd_debug_time_rd: %d", sd_debug_time_rd);
61 _DEBUG_PRINTF("sd_debug_time_wr: %d", sd_debug_time_wr);
62 lcd_update();
63 switch(button_get_w_tmo(HZ/20))
64 {
65 case DEBUG_CANCEL:
66 case BUTTON_REL:
67 lcd_setfont(FONT_UI);
68 return false;
69 }
70 }
71
72 lcd_setfont(FONT_UI);
73 return false;
74}
75
76bool dbg_ports(void)
77{
78 int line;
79
80 lcd_setfont(FONT_SYSFIXED);
81
82 while(1)
83 {
84 lcd_clear_display();
85 line = 0;
86
87 _DEBUG_PRINTF("GPIO_PADR: %02x",(unsigned char)GPIO_PADR);
88 _DEBUG_PRINTF("GPIO_PACON: %02x",(unsigned char)GPIO_PACON);
89 _DEBUG_PRINTF("GPIO_PBDR: %02x",(unsigned char)GPIO_PBDR);
90 _DEBUG_PRINTF("GPIO_PBCON: %02x",(unsigned char)GPIO_PBCON);
91 _DEBUG_PRINTF("GPIO_PCDR: %02x",(unsigned char)GPIO_PCDR);
92 _DEBUG_PRINTF("GPIO_PCCON: %02x",(unsigned char)GPIO_PCCON);
93 _DEBUG_PRINTF("GPIO_PDDR: %02x",(unsigned char)GPIO_PDDR);
94 _DEBUG_PRINTF("GPIO_PDCON: %02x",(unsigned char)GPIO_PDCON);
95 _DEBUG_PRINTF("ADC0: %d", adc_read(0));
96 _DEBUG_PRINTF("ADC1: %d", adc_read(1));
97 _DEBUG_PRINTF("ADC2: %d", adc_read(2));
98 _DEBUG_PRINTF("ADC3: %d", adc_read(3));
99
100 lcd_update();
101 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
102 break;
103 }
104 lcd_setfont(FONT_UI);
105 return false;
106}
107
diff --git a/firmware/target/arm/rk27xx/debug-target.h b/firmware/target/arm/rk27xx/debug-target.h
new file mode 100644
index 0000000000..a507e96fdc
--- /dev/null
+++ b/firmware/target/arm/rk27xx/debug-target.h
@@ -0,0 +1,33 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Karl Kurbjun
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#ifndef _DEBUG_TARGET_H_
23#define _DEBUG_TARGET_H_
24
25#include <stdbool.h>
26
27#define DEBUG_CANCEL BUTTON_VOL
28
29bool dbg_hw_info(void);
30bool dbg_ports(void);
31
32#endif /* _DEBUG_TARGET_H_ */
33