From 026b1ccdfcc182bd0a1265a5422334a3df6b4d65 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 9 Jul 2010 02:37:33 +0200 Subject: [PATCH] additional define to disable all usbgecko support --- Makefile | 2 ++ boot2.c | 2 +- gecko.c | 3 +++ gecko.h | 10 ++++++++++ utils.c | 4 ++-- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8027876..e901984 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ include starlet.mk +# enabled usbgecko support +CFLAGS += -DCAN_HAZ_USBGECKO # disables debug spew over usbgecko #CFLAGS += -DNDEBUG # enables LFCR linefeeds for usbgecko output, useful for some terminal apps diff --git a/boot2.c b/boot2.c index f711a29..9e579e5 100644 --- a/boot2.c +++ b/boot2.c @@ -217,7 +217,7 @@ int boot2_load(int copy) memset(boot2_iv, 0, 16); memcpy(boot2_iv, &tmd.contents.index, 2); //just zero anyway... -#ifndef NDEBUG +#if defined(CAN_HAZ_USBGECKO) && !defined(NDEBUG) u32 *kp = (u32*)boot2_key; gecko_printf("boot2 title key: %08x%08x%08x%08x\n", kp[0], kp[1], kp[2], kp[3]); #endif diff --git a/gecko.c b/gecko.c index aba08ae..a0a0918 100644 --- a/gecko.c +++ b/gecko.c @@ -10,6 +10,7 @@ Copyright (C) 2009 Andre Heider "dhewg" # This code is licensed to you under the terms of the GNU GPL, version 2; # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt */ +#ifdef CAN_HAZ_USBGECKO #include "types.h" #include "irq.h" @@ -386,3 +387,5 @@ cleanup: _gecko_state = GECKO_STATE_NONE; } +#endif + diff --git a/gecko.h b/gecko.h index 9f027c6..17aa234 100644 --- a/gecko.h +++ b/gecko.h @@ -14,6 +14,8 @@ Copyright (C) 2009 Andre Heider "dhewg" #ifndef __GECKO_H__ #define __GECKO_H__ +#ifdef CAN_HAZ_USBGECKO + #include "types.h" void gecko_init(void); @@ -28,5 +30,13 @@ int gecko_printf(const char *fmt, ...) __attribute__((format (printf, 1, 2))); void gecko_timer_initialize(void); void gecko_timer(void); +#else +#define gecko_init(...) do { } while(0) +#define gecko_enable_console(...) do { } while(0) +#define gecko_printf(...) do { } while(0) +#define gecko_timer_initialize(...) do { } while(0) +#define gecko_timer(...) do { } while(0) +#endif + #endif diff --git a/utils.c b/utils.c index 2cd2181..1bf3541 100644 --- a/utils.c +++ b/utils.c @@ -18,7 +18,7 @@ Copyright (C) 2008, 2009 Hector Martin "marcan" #include -#if !defined(LOADER) && !defined(NDEBUG) +#if defined(CAN_HAZ_USBGECKO) && !defined(LOADER) && !defined(NDEBUG) static char ascii(char s) { if(s < 0x20) return '.'; if(s > 0x7E) return '.'; @@ -42,6 +42,7 @@ void hexdump(const void *d, int len) { gecko_printf("\n"); } } +#endif int sprintf(char *buffer, const char *fmt, ...) { @@ -53,7 +54,6 @@ int sprintf(char *buffer, const char *fmt, ...) va_end(args); return i; } -#endif void udelay(u32 d) {