Update of /cvsroot/blob/blob/src/blob
In directory usw-pr-cvs1:/tmp/cvs-serv20679
Modified Files:
debug.c
Log Message:
- peek: byte, word and long access methods
Index: debug.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/debug.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- debug.c 2001/10/29 11:49:20 1.4
+++ debug.c 2001/11/13 13:24:28 1.5
@@ -54,14 +54,14 @@
* program globals
*/
-char memcpyhelp[] = "memcpy [source] [dest] [len]\n"
+static char memcpyhelp[] = "memcpy [source] [dest] [len]\n"
"copy memory blocks\n";
-char pokehelp[] = "poke address value\n";
+static char pokehelp[] = "poke address value\n";
-char peekhelp[] = "peek address\n";
+static char peekhelp[] = "peek address\n";
-char bitchghelp[] = "bitchg address value {and|or|xor|set|clear}\n";
+static char bitchghelp[] = "bitchg address value {and|or|xor|set|clear}\n";
/**********************************************************************
@@ -220,20 +220,48 @@
int ret = 0;
u32 address;
u32 value;
+ char type = 'l';
if ( argc < 2 ) ERR( -EINVAL );
ret = strtou32(argv[1], &address);
if ( ret < 0 ) ERR( -EINVAL );
+ if ( argc >= 2 ) {
+ type = argv[2][0];
+ SerialOutputString("type=");
+ SerialOutputByte(type);
+ SerialOutputString("\n");
+ }
+
#if CHKMEM_DEBUG
SerialOutputString("adr=0x");
SerialOutputHex(address);
SerialOutputString("\n");
#endif
- value = MEM( address );
+ value = 0;
+ switch( type | 0x20 ) {
+ case 'b':
+ value = (*((u8 *)address)) & 0xff;
+ barrier();
+ break;
+ case 'w':
+ value = (*((u16 *)address))& 0xffff;
+ barrier();
+ break;
+ case 'l':
+ value = (*((u32 *)address));
+ barrier();
+ break;
+ default:
+ ret = -EINVAL;
+ goto DONE;
+ break;
+ }
+ SerialOutputByte(type);
+ SerialOutputByte(' ');
SerialOutputHex(value);
SerialOutputString("\n");
|