3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * \email daniel.otte@rub.de
24 * \license GPLv3 or later
33 #include "string-extras.h"
38 void dump_chars(uint8_t* buffer, uint8_t len){
42 if(isprint(buffer[i])){
48 for(;len<DUMP_WIDTH; ++len){
55 void print_aligned(unsigned long value, uint8_t align){
58 ultoa(value, str, 16);
59 for(i=strlen(str);i<align;++i)
69 uint8_t buffer[DUMP_WIDTH];
79 addr = strtoul(s, &eptr, 0);
81 size = strtoul(eptr, NULL, 0);
85 cli_putstr("\r\ndumping ");
86 ultoa(size, tstr, 10);
88 cli_putstr(" bytes, beginning at 0x");
89 ultoa(addr, tstr, 16);
94 readlen = (size>DUMP_WIDTH)?DUMP_WIDTH:size;
95 memcpy(buffer, (void*)addr, readlen);
96 print_aligned(addr, 6);
98 cli_hexdump2(buffer, readlen);
99 t=(DUMP_WIDTH-readlen)*3;
104 dump_chars(buffer,readlen);