X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/9403f93922ea096bfdea4a81f1c34c5c044fcbbb..aea51b6c4c93c56715f50e64d424e1181c6d0242:/avr/cmd_boot.c diff --git a/avr/cmd_boot.c b/avr/cmd_boot.c index e26a8b1..fb533c7 100644 --- a/avr/cmd_boot.c +++ b/avr/cmd_boot.c @@ -100,15 +100,11 @@ command_ret_t do_bootcf(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int a int_fast8_t verbosity = 0; uint8_t default_stages; uint32_t val; - ERRNUM res = ESUCCESS; /* get default values */ memcpy_P(&boot_param, cfboot, sizeof boot_param); default_stages = boot_param.stages; - /* reset getopt() */ - optind = 0; - int opt; while ((opt = getopt(argc, argv, PSTR("vna:s:c:t:i:"))) != -1) { switch (opt) { @@ -256,9 +252,6 @@ command_ret_t do_go(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, uint32_t addr; bool hold = 0; - /* reset getopt() */ - optind = 0; - int opt; while ((opt = getopt(argc, argv, PSTR("h"))) != -1) { switch (opt) { @@ -282,28 +275,24 @@ command_ret_t do_go(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, } if (z80_bus_state() & ZST_RUNNING) { - printf_P(PSTR("CPU already running!\n")); - return CMD_RET_FAILURE; + cmd_error(CMD_RET_FAILURE, ERUNNING, NULL); } printf_P(PSTR("Starting application at 0x%04lx ...\n"), addr); if (addr != 0) { - uint8_t tmp[3]; +// uint8_t tmp[3]; - z80_bus_cmd(Request); - z80_read_block (tmp, 0, 3); + z80_bus_request_or_exit(); +// z80_read_block (tmp, 0, 3); z80_write(0, 0xc3); z80_write(1, addr); z80_write(2, (addr >> 8)); + z80_bus_cmd(Release); + _delay_ms(100); 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); +// z80_write_block(tmp, 0, 3); } else { if (!hold) z80_bus_cmd(Request);