summaryrefslogtreecommitdiff
path: root/avr
diff options
context:
space:
mode:
authorLeo C2018-09-10 20:55:21 +0200
committerLeo C2018-09-10 20:55:21 +0200
commit9403f93922ea096bfdea4a81f1c34c5c044fcbbb (patch)
treef976a30629b21683a93d8e31c64beeaca6281895 /avr
parentd66348b4fb147eb01c30aa9b3a8904ce6c59a4c1 (diff)
downloadz180-stamp-9403f93922ea096bfdea4a81f1c34c5c044fcbbb.zip
command go: new option -h
Diffstat (limited to 'avr')
-rw-r--r--avr/cmd_boot.c32
-rw-r--r--avr/command_tbl.c6
2 files changed, 29 insertions, 9 deletions
diff --git a/avr/cmd_boot.c b/avr/cmd_boot.c
index f4a6183..e26a8b1 100644
--- a/avr/cmd_boot.c
+++ b/avr/cmd_boot.c
@@ -254,10 +254,26 @@ command_ret_t do_busreq_pulse(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED,
command_ret_t do_go(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, char * const argv[])
{
uint32_t addr;
+ bool hold = 0;
- if (argc < 2)
+ /* reset getopt() */
+ optind = 0;
+
+ int opt;
+ while ((opt = getopt(argc, argv, PSTR("h"))) != -1) {
+ switch (opt) {
+ case 'h':
+ hold = 1;
+ break;
+ default: /* '?' */
+ return CMD_RET_USAGE;
+ }
+ }
+ argc -= optind; /* remaining arguments */
+
+ if (argc != 1)
return CMD_RET_USAGE;
- addr = eval_arg(argv[1], NULL);
+ addr = eval_arg(argv[optind], NULL);
if (addr >= (1UL<<16)) {
printf_P(PSTR("Invalid startaddress: 0x%05lx\n"
" (Out of logical address space (0x00000-0x0ffff))\n"),
@@ -282,13 +298,19 @@ command_ret_t do_go(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc,
z80_write(2, (addr >> 8));
z80_bus_cmd(Run);
+ _delay_us(10);
z80_bus_cmd(M_Cycle);
+ _delay_us(10);
z80_bus_cmd(M_Cycle);
+ _delay_us(10);
z80_write_block(tmp, 0, 3);
- } else
+ } else {
+ if (!hold)
+ z80_bus_cmd(Request);
z80_bus_cmd(Run);
-
- z80_bus_cmd(Release);
+ }
+ if (!hold)
+ z80_bus_cmd(Release);
return CMD_RET_SUCCESS;
}
diff --git a/avr/command_tbl.c b/avr/command_tbl.c
index 4ed37b7..c526199 100644
--- a/avr/command_tbl.c
+++ b/avr/command_tbl.c
@@ -201,12 +201,10 @@ CMD_TBL_ITEM(
#endif /* CONFIG_CMD_LOADB */
CMD_TBL_ITEM(
- go, 2, 0, do_go,
+ go, CONFIG_SYS_MAXARGS, 0, do_go,
"start application at address 'addr'",
- "addr\n"
+ "[-h] addr\n"
" - start application at address 'addr'"
-// "\n"
-// " passing 'arg' as arguments"
),
CMD_TBL_ITEM(
reset, 1, 0, do_reset,