summaryrefslogtreecommitdiff
path: root/avr/cmd_cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/cmd_cpu.c')
-rw-r--r--avr/cmd_cpu.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/avr/cmd_cpu.c b/avr/cmd_cpu.c
index 1b1982c..1627d9f 100644
--- a/avr/cmd_cpu.c
+++ b/avr/cmd_cpu.c
@@ -97,7 +97,7 @@ static void test_delay(uint32_t count)
{
uint32_t ts = get_timer(0);
- while (get_timer(ts) < count);
+ while (get_timer(ts) <= count);
}
command_ret_t do_cpu_test(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, char * const argv[])
@@ -133,6 +133,31 @@ command_ret_t do_cpu_test(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int
return CMD_RET_SUCCESS;
}
+command_ret_t do_busack_test(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc UNUSED, char * const argv[] UNUSED)
+{
+
+ if ((z80_bus_state() & ZST_ACQUIRED) != RESET)
+ cmd_error(CMD_RET_FAILURE, ERUNNING, NULL);
+
+ z80_bus_cmd(Request);
+ uint32_t result = z80_get_busreq_cycles();
+ test_delay(20);
+ z80_bus_cmd(Release);
+
+#if 0
+ long div;
+
+ pinconf = gpio_config_get(pin);
+ if (pinconf == OUTPUT_TIMER) {
+ div = gpio_clockdiv_get(pin);
+#endif
+
+
+ printf_P(PSTR("cycles: %lu, time: %luus\n"), result, (uint32_t) (result * 1000000LL / F_CPU));
+
+ return CMD_RET_SUCCESS;
+}
+
#if 0
command_ret_t do_cpu_freq(cmd_tbl_t *cmdtp UNUSED, int flag UNUSED, int argc, char * const argv[])
{
@@ -250,6 +275,11 @@ CMD_TBL_ITEM(
"Do bus request/release cycles",
"[-t pulsewidth]"
),
+CMD_TBL_ITEM(
+ busack, 2, 1, do_busack_test,
+ "Get time from /Reset high to /BUSACK low",
+ ""
+),
#if 0
CMD_TBL_ITEM(
freq, CONFIG_SYS_MAXARGS, 1, do_cpu_freq,