From d86956fba5101a0dc0aca30d8f7522e0ff204e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Tue, 4 Oct 2016 20:44:59 +0000 Subject: [PATCH] remove separate debug printout macros --- BaS_gcc/BaS_gcc.files | 1 + BaS_gcc/include/debug.h | 12 ++++++++++++ BaS_gcc/kbd/ikbd.c | 2 ++ BaS_gcc/pci/ehci-hcd.c | 14 +++----------- BaS_gcc/pci/ohci-hcd.c | 9 +-------- BaS_gcc/pci/pci.c | 8 +------- BaS_gcc/pci/pci_errata.c | 2 ++ BaS_gcc/x86emu/x86biosemu.c | 9 ++------- 8 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 BaS_gcc/include/debug.h diff --git a/BaS_gcc/BaS_gcc.files b/BaS_gcc/BaS_gcc.files index 746e6c8..27f7931 100644 --- a/BaS_gcc/BaS_gcc.files +++ b/BaS_gcc/BaS_gcc.files @@ -732,3 +732,4 @@ tos/vmem_test/sources/fpga_test.c tos/vmem_test/Makefile tos/Makefile tos/fpga_test/sources/fpga_test.c +include/debug.h diff --git a/BaS_gcc/include/debug.h b/BaS_gcc/include/debug.h new file mode 100644 index 0000000..fb07b94 --- /dev/null +++ b/BaS_gcc/include/debug.h @@ -0,0 +1,12 @@ +#ifndef DEBUG_H +#define DEBUG_H + +#ifdef DEBUG +#define dbg(format, arg...) do { xprintf("DEBUG (%s()): " format, __FUNCTION__, ##arg);} while(0) +#else +#define dbg(format, arg...) do {;} while (0) +#endif /* DEBUG */ +#define err(format, arg...) do { xprintf("ERROR (%s()): " format, __FUNCTION__, ##arg); } while(0) + +#endif // DEBUG_H + diff --git a/BaS_gcc/kbd/ikbd.c b/BaS_gcc/kbd/ikbd.c index 9d7cc7c..66bbc31 100644 --- a/BaS_gcc/kbd/ikbd.c +++ b/BaS_gcc/kbd/ikbd.c @@ -26,6 +26,8 @@ //#include "hardware.h" #include "ikbd.h" +#include "debug.h" + // atari ikbd stuff #define IKBD_STATE_JOYSTICK_EVENT_REPORTING 0x01 #define IKBD_STATE_MOUSE_Y_BOTTOM 0x02 diff --git a/BaS_gcc/pci/ehci-hcd.c b/BaS_gcc/pci/ehci-hcd.c index fd2e2b3..09ff5ba 100644 --- a/BaS_gcc/pci/ehci-hcd.c +++ b/BaS_gcc/pci/ehci-hcd.c @@ -30,15 +30,7 @@ #include "ehci.h" #include "pci.h" -#define DBG_EHCI -#ifdef DBG_EHCI -#define dbg(format, arg...) xprintf("DEBUG %s(): " format, __FUNCTION__, ## arg) -#else -#define dbg(format, arg...) do {} while (0) -#endif /* DBG_EHCI */ -#define err(format, arg...) xprintf("ERROR %s(): " format, __FUNCTION__, ## arg) -#define info(format, arg...) xprintf("INFO %s(): " format, __FUNCTION__, ## arg) - +#include "debug.h" static char ehci_inited; static int rootdev; @@ -1068,7 +1060,7 @@ int ehci_usb_lowlevel_init(long handle, const struct pci_device_id *ent, void ** ehci_writel(&gehci.hcor->or_asynclistaddr, (uint32_t) gehci.qh_list - gehci.dma_offset); reg = ehci_readl(&gehci.hccr->cr_hcsparams); gehci.descriptor->hub.bNbrPorts = HCS_N_PORTS(reg); - info("Register %x NbrPorts %d\r\n", reg, gehci.descriptor->hub.bNbrPorts); + xprintf("Register %x NbrPorts %d\r\n", reg, gehci.descriptor->hub.bNbrPorts); /* Port Indicators */ if (HCS_INDICATOR(reg)) @@ -1101,7 +1093,7 @@ int ehci_usb_lowlevel_init(long handle, const struct pci_device_id *ent, void ** wait(5 * 1000); reg = HC_VERSION(ehci_readl(&gehci.hccr->cr_capbase)); - info("USB EHCI host controller version %x.%02x\r\n", reg >> 8, reg & 0xff); + xprintf("USB EHCI host controller version %x.%02x\r\n", reg >> 8, reg & 0xff); /* turn on interrupts */ pci_hook_interrupt(handle, handle_usb_interrupt, &gehci); diff --git a/BaS_gcc/pci/ohci-hcd.c b/BaS_gcc/pci/ohci-hcd.c index 603e815..f63a2bb 100644 --- a/BaS_gcc/pci/ohci-hcd.c +++ b/BaS_gcc/pci/ohci-hcd.c @@ -48,20 +48,13 @@ #include "bas_string.h" /* for memset() */ #include "pci.h" #include "interrupts.h" +#include "debug.h" #undef OHCI_USE_NPS /* force NoPowerSwitching mode */ #undef OHCI_VERBOSE_DEBUG /* not always helpful */ #undef OHCI_FILL_TRACE -#define DEBUG_OHCI -#ifdef DEBUG_OHCI -#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0) -#else -#define dbg(format, arg...) do { ; } while (0) -#endif /* DEBUG_OHCI */ -#define err(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0) - #include "usb.h" #include "ohci.h" #include "util.h" /* for endian conversions */ diff --git a/BaS_gcc/pci/pci.c b/BaS_gcc/pci/pci.c index 82d52f2..f07fd30 100644 --- a/BaS_gcc/pci/pci.c +++ b/BaS_gcc/pci/pci.c @@ -34,13 +34,7 @@ #include "interrupts.h" #include "wait.h" -// #define DEBUG_PCI -#ifdef DEBUG_PCI -#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0) -#else -#define dbg(format, arg...) do { ; } while (0) -#endif /* DEBUG_PCI */ -#define err(format, arg...) do { xprintf("ERROR: %s(): " format, __FUNCTION__, ##arg); } while (0) +#include "debug.h" #define pci_config_wait() do { __asm__ __volatile("tpf" ::: "memory"); } while (0) diff --git a/BaS_gcc/pci/pci_errata.c b/BaS_gcc/pci/pci_errata.c index 7f21311..52ca707 100755 --- a/BaS_gcc/pci/pci_errata.c +++ b/BaS_gcc/pci/pci_errata.c @@ -2,6 +2,8 @@ #include "pci.h" #include +#include "debug.h" + __attribute__((aligned(16))) void chip_errata_135(void) { /* diff --git a/BaS_gcc/x86emu/x86biosemu.c b/BaS_gcc/x86emu/x86biosemu.c index 588ac4a..a0a06db 100644 --- a/BaS_gcc/x86emu/x86biosemu.c +++ b/BaS_gcc/x86emu/x86biosemu.c @@ -10,6 +10,8 @@ #include "pci_ids.h" #include "x86pcibios.h" +#include "debug.h" + #define USE_SDRAM #define DIRECT_ACCESS @@ -26,13 +28,6 @@ #define SYS_BIOS 0xF0000 #define SIZE_EMU 0x100000 -#define DBG_BIOSEMU -#ifdef DBG_BIOSEMU -#define dbg(format, arg...) do { xprintf("DEBUG (%s()): " format, __FUNCTION__, ##arg);} while(0) -#else -#define dbg(format, arg...) do {;} while (0) -#endif /* DBG_BIOSEMU */ -#define err(format, arg...) do { xprintf("ERROR (%s()): " format, __FUNCTION__, ##arg); } while(0) typedef struct {