From 57c185afe5c562350bb1ff370af2cb588522de52 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 1 May 2009 16:29:43 +0200 Subject: [PATCH] Optional mini debug spew with gecko safe functions. --- boot2.c | 2 +- gecko.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/boot2.c b/boot2.c index bdfe5b2..39786b5 100644 --- a/boot2.c +++ b/boot2.c @@ -193,7 +193,7 @@ int boot2_load(int copy) nand_wait(); // boot1 doesn't actually do this, but it's probably a good idea to try to correct 1-bit errors anyway if(nand_correct(page, sector_buf, ecc_buf) < 0) { - gecko_printf("boot2 map candidate page %d is uncorrectable, trying anyway\n", page); + gecko_printf("boot2 map candidate page 0x%x is uncorrectable, trying anyway\n", page); } mapno = find_valid_map(maps); if(mapno >= 0) { diff --git a/gecko.c b/gecko.c index d38225a..884d948 100644 --- a/gecko.c +++ b/gecko.c @@ -34,6 +34,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "powerpc_elf.h" #include "gecko.h" +//#define GECKO_SAFE + static u8 gecko_console_enabled = 0; static u32 _gecko_command(u32 command) @@ -86,7 +88,7 @@ static u32 _gecko_recvbyte(u8 *recvbyte) return 0; } -#if 0 +#ifdef GECKO_SAFE static u32 _gecko_checksend(void) { u32 i = 0; @@ -143,6 +145,7 @@ static int gecko_recvbuffer(void *buffer, u32 size) } #endif +#ifndef GECKO_SAFE static int gecko_sendbuffer(const void *buffer, u32 size) { u32 left = size; @@ -156,6 +159,7 @@ static int gecko_sendbuffer(const void *buffer, u32 size) } return (size - left); } +#endif #if 0 static int gecko_recvbuffer_safe(void *buffer, u32 size) @@ -173,7 +177,9 @@ static int gecko_recvbuffer_safe(void *buffer, u32 size) } return (size - left); } +#endif +#ifdef GECKO_SAFE static int gecko_sendbuffer_safe(const void *buffer, u32 size) { u32 left = size; @@ -235,7 +241,11 @@ int gecko_printf(const char *fmt, ...) i = vsprintf(buffer, fmt, args); va_end(args); +#ifdef GECKO_SAFE + return gecko_sendbuffer_safe(buffer, i); +#else return gecko_sendbuffer(buffer, i); +#endif } #endif