X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/7a1ed62033184b79388b541258a14bc579389bdb..5e8ac5e02a09140e97d56a9d5313504dfa31282d:/avr/cmd_sd.c diff --git a/avr/cmd_sd.c b/avr/cmd_sd.c index 06c9338..7484855 100644 --- a/avr/cmd_sd.c +++ b/avr/cmd_sd.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2014 Leo C. + * (C) Copyright 2014, 2018 Leo C. * * SPDX-License-Identifier: GPL-2.0 */ @@ -52,10 +52,8 @@ command_ret_t do_init(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * cons dev = (BYTE) eval_arg(argv[1], NULL); - if (disk_status(dev) & STA_NODISK) { - printf_P(PSTR("No Disk\n")); - return CMD_RET_FAILURE; - } + if (disk_status(dev) & STA_NODISK) + cmd_error(CMD_RET_FAILURE, 0, PSTR("No disk")); res = disk_initialize(dev); printf_P(PSTR("rc=%.2x\n"), res); @@ -154,10 +152,8 @@ command_ret_t do_dump(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * cons for ( ; count; count--, sec++) { res = disk_read(dev, buffer, sec, 1); - if (res) { - printf_P(PSTR("rc=%.2x\n"), res); - return CMD_RET_FAILURE; - } + if (res) + cmd_error(CMD_RET_FAILURE, 0, PSTR("rc=%.2x"), res); sprintf_P(header, PSTR("Sector: %lu"), sec); dump_ram(buffer, 0, FF_MAX_SS, header); @@ -208,10 +204,9 @@ command_ret_t do_read(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * cons for (nr = 0; nr < count;) { nr++; if ((res = disk_read(dev, buffer, sec, 1)) == RES_OK) { - if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) { - my_puts_P(PSTR("Bus timeout\n")); - return CMD_RET_FAILURE; - } + if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) + cmd_error(CMD_RET_FAILURE, EBUSTO, NULL); + z80_write_block(buffer, addr /*+ base*/, FF_MAX_SS); z80_bus_cmd(Release); sec++; addr += FF_MAX_SS; @@ -269,10 +264,9 @@ command_ret_t do_write(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * con for (nr = 0; nr < count;) { nr++; - if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) { - my_puts_P(PSTR("Bus timeout\n")); - return CMD_RET_FAILURE; - } + if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) + cmd_error(CMD_RET_FAILURE, EBUSTO, NULL); + z80_read_block(buffer, addr /*+ base*/, FF_MAX_SS); z80_bus_cmd(Release); @@ -317,7 +311,7 @@ command_ret_t do_ioctl_sync(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char cmd_tbl_t cmd_tbl_sd[] = { CMD_TBL_ITEM( status, 2, CTBL_RPT, do_status, - "Socket staus", + "Socket status", "drive" ), CMD_TBL_ITEM( @@ -362,7 +356,7 @@ CMD_TBL_ITEM( /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */ {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help, - FSTR("Alias for 'help'"), + NULL, #ifdef CONFIG_SYS_LONGHELP FSTR(""), #endif /* CONFIG_SYS_LONGHELP */ @@ -376,7 +370,7 @@ CMD_TBL_END(cmd_tbl_sd) }; -command_ret_t do_sd(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]) +command_ret_t do_sd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc UNUSED, char * const argv[] UNUSED) { puts_P(PSTR("Huch?")); return CMD_RET_USAGE;