diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-08-30 22:51:49 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-08-31 03:07:17 +0000 |
commit | 63e6aec260f97f0f7c91c7abebecb3d4b2759f4c (patch) | |
tree | 04c88c46e574959e6ddbdb6cf24a3b9b220c31fa | |
parent | 748133cf9d7d6cf1f79f0f9ce13a9f327dd7a09f (diff) | |
download | rockbox-63e6aec260f97f0f7c91c7abebecb3d4b2759f4c.tar.gz rockbox-63e6aec260f97f0f7c91c7abebecb3d4b2759f4c.zip |
xduooX3 debug menu add GPIO IO Ports
Change-Id: I6ca9f005e412240235354b9369bcc3f4a4ad256f
-rw-r--r-- | apps/debug_menu.c | 2 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/debug-jz4760.c | 83 |
2 files changed, 84 insertions, 1 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index e75fce6d32..3df7e97bce 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -2493,7 +2493,7 @@ static const struct { | |||
2493 | #if defined(CPU_COLDFIRE) || defined(CPU_PP) \ | 2493 | #if defined(CPU_COLDFIRE) || defined(CPU_PP) \ |
2494 | || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \ | 2494 | || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 \ |
2495 | || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2 \ | 2495 | || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2 \ |
2496 | || CONFIG_CPU == RK27XX | 2496 | || CONFIG_CPU == RK27XX || CONFIG_CPU == JZ4760B |
2497 | { "View I/O ports", dbg_ports }, | 2497 | { "View I/O ports", dbg_ports }, |
2498 | #endif | 2498 | #endif |
2499 | #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE) | 2499 | #if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE) |
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 | |||
54 | static 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 | |||
42 | static void display_clocks(void) | 79 | static 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 | ||
138 | bool dbg_ports(void) | 175 | bool 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 | ||