/*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014, 2018 Leo C. <erbl259-lmu@yahoo.de>
*
* SPDX-License-Identifier: GPL-2.0
*/
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);
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);
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;
- }
+ z80_bus_request_or_exit();
z80_write_block(buffer, addr /*+ base*/, FF_MAX_SS);
z80_bus_cmd(Release);
sec++; addr += FF_MAX_SS;
for (nr = 0; nr < count;) {
nr++;
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
z80_read_block(buffer, addr /*+ base*/, FF_MAX_SS);
z80_bus_cmd(Release);
cmd_tbl_t cmd_tbl_sd[] = {
CMD_TBL_ITEM(
status, 2, CTBL_RPT, do_status,
- "Socket staus",
+ "Socket status",
"drive"
),
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 */
};
-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;