diff options
| author | Keith Packard <keithp@keithp.com> | 2008-12-22 19:10:27 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2008-12-22 19:10:27 -0800 | 
| commit | 55eba4fa08b022197106245d36a70f575a070b0a (patch) | |
| tree | 4185f272f0acf59bd44c949f182591b4868b71d3 /lib | |
| parent | e75918f3667a5c8ad294bec4acef6fe81682edf6 (diff) | |
Make read_memory debug output use ccdbg_debug.
This makes it default to not being presented, which makes s51 much happier
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ccdbg-debug.c | 6 | ||||
| -rw-r--r-- | lib/ccdbg-io.c | 1 | ||||
| -rw-r--r-- | lib/ccdbg-memory.c | 28 | ||||
| -rw-r--r-- | lib/ccdbg.h | 4 | 
4 files changed, 33 insertions, 6 deletions
| diff --git a/lib/ccdbg-debug.c b/lib/ccdbg-debug.c index 2e67bc8d..8f6f9e11 100644 --- a/lib/ccdbg-debug.c +++ b/lib/ccdbg-debug.c @@ -45,3 +45,9 @@ ccdbg_debug(int level, char *format, ...)  		va_end(ap);  	}  } + +void +ccdbg_flush(void) +{ +	fflush(stdout); +} diff --git a/lib/ccdbg-io.c b/lib/ccdbg-io.c index 6999dbec..5ecea769 100644 --- a/lib/ccdbg-io.c +++ b/lib/ccdbg-io.c @@ -129,6 +129,7 @@ ccdbg_recv_bit(struct ccdbg *dbg, int first)  	ccdbg_send(dbg, CC_CLOCK|mask|CC_RESET_N, CC_CLOCK|CC_DATA|CC_RESET_N);  	read = ccdbg_read(dbg); +	ccdbg_print("#\t%c %c %c\n", CC_DATA, read);  	ccdbg_send(dbg, CC_CLOCK|     CC_RESET_N,                  CC_RESET_N);  	return (read & CC_DATA) ? 1 : 0;  } diff --git a/lib/ccdbg-memory.c b/lib/ccdbg-memory.c index 105295db..3406a1b1 100644 --- a/lib/ccdbg-memory.c +++ b/lib/ccdbg-memory.c @@ -54,10 +54,18 @@ ccdbg_write_memory(struct ccdbg *dbg, uint16_t addr, uint8_t *bytes, int nbytes)  	for (i = 0; i < nbytes; i++) {  		write8[DATA_BYTE] = *bytes++;  		ccdbg_execute(dbg, write8); -		if ((i & 0xf) == 0xf) { printf ("."); fflush(stdout); nl = 1; } -		if ((i & 0xff) == 0xff) { printf ("\n"); nl = 0; } +		if ((i & 0xf) == 0xf) { +			ccdbg_debug(CC_DEBUG_MEMORY, "."); +			ccdbg_flush(); +			nl = 1; +		} +		if ((i & 0xff) == 0xff) { +			ccdbg_debug(CC_DEBUG_MEMORY, "\n"); +			nl = 0; +		}  	} -	if (nl) printf ("\n"); +	if (nl) +		ccdbg_debug(CC_DEBUG_MEMORY, "\n");  	return 0;  } @@ -70,10 +78,18 @@ ccdbg_read_memory(struct ccdbg *dbg, uint16_t addr, uint8_t *bytes, int nbytes)  	(void) ccdbg_execute(dbg, memory_init);  	for (i = 0; i < nbytes; i++) {  		*bytes++ = ccdbg_execute(dbg, read8); -		if ((i & 0xf) == 0xf) { printf ("."); fflush(stdout); nl = 1; } -		if ((i & 0xff) == 0xff) { printf ("\n"); nl = 0; } +		if ((i & 0xf) == 0xf) { +			ccdbg_debug(CC_DEBUG_MEMORY, "."); +			ccdbg_flush(); +			nl = 1; +		} +		if ((i & 0xff) == 0xff) { +			ccdbg_debug(CC_DEBUG_MEMORY, "\n"); +			nl = 0; +		}  	} -	if (nl) printf ("\n"); +	if (nl) +		ccdbg_debug(CC_DEBUG_MEMORY, "\n");  	return 0;  } diff --git a/lib/ccdbg.h b/lib/ccdbg.h index 4d4a648d..e0e58104 100644 --- a/lib/ccdbg.h +++ b/lib/ccdbg.h @@ -160,6 +160,7 @@ struct hex_image {  #define CC_DEBUG_INSTRUCTIONS	0x00000004  #define CC_DEBUG_EXECUTE	0x00000008  #define CC_DEBUG_FLASH		0x00000010 +#define CC_DEBUG_MEMORY		0x00000020  /* ccdbg-command.c */  void @@ -223,6 +224,9 @@ ccdbg_add_debug(int level);  void  ccdbg_clear_debug(int level); +void +ccdbg_flush(void); +  /* ccdbg-flash.c */  uint8_t  ccdbg_flash_hex_image(struct ccdbg *dbg, struct hex_image *image); | 
