1 /****************************************************************************
3 * Copyright (c) 2006 Dave Hylands <dhylands@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
14 ****************************************************************************/
19 * @brief Memmory dump routine
21 ****************************************************************************/
23 // ---- Include Files -------------------------------------------------------
29 // ---- Public Variables ----------------------------------------------------
30 // ---- Private Constants and Types -----------------------------------------
31 // ---- Private Variables ---------------------------------------------------
32 // ---- Private Function Prototypes -----------------------------------------
33 // ---- Functions -----------------------------------------------------------
35 /**************************************************************************/
37 * Dumps a page of output for debugging purposes.
40 void DumpMem( const char *prefix
, unsigned address
, const void *inData
, unsigned numBytes
)
42 const uint8_t *data
= (const uint8_t *)inData
;
47 Log( "%s: No data\n", prefix
);
53 for ( byteOffset
= 0; byteOffset
< numBytes
; byteOffset
+= LINE_WIDTH
)
57 Log( "%s: %04x: ", prefix
, address
+ byteOffset
);
59 for ( i
= 0; i
< LINE_WIDTH
; i
++ )
61 if (( byteOffset
+ i
) < numBytes
)
63 Log( "%02.2X ", data
[ byteOffset
+ i
] );
70 for ( i
= 0; i
< LINE_WIDTH
; i
++ )
72 if (( byteOffset
+ i
) < numBytes
)
74 unsigned char ch
= data
[ byteOffset
+ i
];
75 if (( ch
< ' ' ) || ( ch
> '~' ))