+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
#include "common.h"
#include <stdlib.h>
#include <string.h>
#include "command.h"
#include "print-utils.h"
#include "debug.h"
+
/*
* Debugging
*/
#ifdef DEBUG
-void eeprom_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
-{
- eeprom_read_block((void *) buf, (const void *) (size_t) addr, count);
-}
-
-void ram_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
-{
- while (count--)
- *buf++ = *(uint8_t *) (size_t) addr++;
-}
-
-
-void dump_eep(uint32_t addr, unsigned int len, char *title)
-{
- dump_mem(addr, len, eeprom_read_buf, title);
-}
-
-void dump_ram(uint32_t addr, unsigned int len, char *title)
-{
- dump_mem(addr, len, ram_read_buf, title);
-}
-
-
#if 0
void dump_heap(void)
{
uint32_t addr;
uint32_t length = 128;
- if (strchr(argv[0],'r') != NULL)
+ switch (argv[0][3]) {
+ case 'r':
readhow = ram_read_buf;
- else if (strchr(argv[0],'e') != NULL)
+ break;
+ case 'e':
readhow = eeprom_read_buf;
- else
+ break;
+ case 'f':
+ readhow = flash_read_buf;
+ break;
+ default:
return CMD_RET_USAGE;
+ }
/* Address is specified since argc > 1 */
addr = strtoul(argv[1], NULL, 16);
length = (uint16_t) strtoul(argv[2], NULL, 16);
/* Print the lines. */
- dump_mem(addr, length, readhow, NULL);
+ dump_mem(addr, addr, length, readhow, NULL);
return CMD_RET_SUCCESS;
}
return CMD_RET_SUCCESS;
}
-/*------------------------------------------------------------------------------*/
+/*------------------------------------------------------------------------------*/
#if 1