summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_jz47xx/debug-jz4760.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-08-30 22:51:49 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2020-08-31 03:07:17 +0000
commit63e6aec260f97f0f7c91c7abebecb3d4b2759f4c (patch)
tree04c88c46e574959e6ddbdb6cf24a3b9b220c31fa /firmware/target/mips/ingenic_jz47xx/debug-jz4760.c
parent748133cf9d7d6cf1f79f0f9ce13a9f327dd7a09f (diff)
downloadrockbox-63e6aec260f97f0f7c91c7abebecb3d4b2759f4c.tar.gz
rockbox-63e6aec260f97f0f7c91c7abebecb3d4b2759f4c.zip
xduooX3 debug menu add GPIO IO Ports
Change-Id: I6ca9f005e412240235354b9369bcc3f4a4ad256f
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/debug-jz4760.c')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/debug-jz4760.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/debug-jz4760.c b/firmware/target/mips/ingenic_jz47xx/debug-jz4760.c
index be921efa13..0d3fec99aa 100644
--- a/firmware/target/mips/ingenic_jz47xx/debug-jz4760.c
+++ b/firmware/target/mips/ingenic_jz47xx/debug-jz4760.c
@@ -28,6 +28,7 @@
28#include "font.h" 28#include "font.h"
29#include "button.h" 29#include "button.h"
30#include "timefuncs.h" 30#include "timefuncs.h"
31#include "action.h"
31 32
32#ifndef BOOTLOADER 33#ifndef BOOTLOADER
33 34
@@ -39,6 +40,42 @@ static int line = 0;
39#define TO_MHZ(x) ((x)/1000000), ((x)%1000000)/10000 40#define TO_MHZ(x) ((x)/1000000), ((x)%1000000)/10000
40#define TO_KHZ(x) ((x)/1000), ((x)%1000)/10 41#define TO_KHZ(x) ((x)/1000), ((x)%1000)/10
41 42
43#define DEBUG_CANCEL ACTION_STD_CANCEL
44#define DEBUG_NEXT ACTION_STD_NEXT
45#define DEBUG_LEFT_JUSTIFY ACTION_STD_OK
46#define DEBUG_LEFT_SCROLL ACTION_STD_MENU
47
48/* if the possiblity exists to divide by zero protect with this macro */
49#define DIV_FINITE(dividend, divisor) ((divisor == 0)? divisor : dividend/divisor)
50
51#define ON "Enabled"
52#define OFF "Disabled"
53
54static bool dbg_btn(bool *done, int *x)
55{
56 bool cont = !*done;
57 if (cont)
58 {
59 lcd_update();
60 int button = get_action(CONTEXT_STD,HZ/10);
61 switch(button)
62 {
63 case DEBUG_CANCEL:
64 *done = true;
65 case DEBUG_NEXT:
66 cont = false;
67 case DEBUG_LEFT_JUSTIFY:
68 (*x) = 0;
69 sleep(HZ/5);
70 break;
71 case DEBUG_LEFT_SCROLL:
72 (*x)--;
73 }
74 }
75 lcd_clear_display();
76 return cont;
77}
78
42static void display_clocks(void) 79static void display_clocks(void)
43{ 80{
44 unsigned int cppcr0 = REG_CPM_CPPCR0; /* PLL Control Register */ 81 unsigned int cppcr0 = REG_CPM_CPPCR0; /* PLL Control Register */
@@ -137,6 +174,52 @@ static void display_enabled_clocks(void)
137 174
138bool dbg_ports(void) 175bool dbg_ports(void)
139{ 176{
177#if CONFIG_CPU == JZ4760B
178 int line, i, j, cur;
179 int x = 0;
180 const int last_port = 5;
181 bool done = false;
182
183 long data, dir;
184 long fun, intr;
185 long lvl;
186
187
188 lcd_clear_display();
189 lcd_setfont(FONT_SYSFIXED);
190
191 while(!done)
192 {
193 i = 0;
194 while(dbg_btn(&done, &x))
195 {
196 i %= last_port; /*PORT: A B C D E F */
197 while(dbg_btn(&done, &x))
198 {
199 line = 0;
200 lcd_puts(x, line++, "[GPIO Vals and Dirs]");
201 for (j = i; j < i + 2; j++)
202 {
203 cur = j % last_port;
204 dir = REG_GPIO_PXDIR(cur);
205 data = REG_GPIO_PXDAT(cur);
206 fun = REG_GPIO_PXFUN(cur);
207 intr = REG_GPIO_PXIM(cur);
208 lvl = REG_GPIO_PXPIN(cur);
209
210 lcd_putsf(x, line++, "[%s%c]: %8x", "GPIO", 'A' + cur, lvl);
211 lcd_putsf(x, line++, "DIR: %8x FUN: %8x", dir, fun);
212 lcd_putsf(x, line++, "DAT: %8x INT: %8x", data, intr);
213 line++;
214 }
215 }
216 i++;
217 }
218
219 }
220 lcd_setfont(FONT_UI);
221#endif
222
140 return false; 223 return false;
141} 224}
142 225