@@ -28,15 +28,20 @@
#include "net/net.h"
#include "net/checksum.h"
-#ifdef CADENCE_GEM_ERR_DEBUG
-#define DB_PRINT(...) do { \
- fprintf(stderr, ": %s: ", __func__); \
- fprintf(stderr, ## __VA_ARGS__); \
- } while (0);
-#else
- #define DB_PRINT(...)
+//#define CADENCE_GEM_ERR_DEBUG 1
+
+#ifndef CADENCE_GEM_ERR_DEBUG
+#define CADENCE_GEM_ERR_DEBUG 0
#endif
+#define DB_PRINT(...) \
+ do { \
+ if(CADENCE_GEM_ERR_DEBUG) { \
+ fprintf(stderr, ": %s: ", __func__); \
+ fprintf(stderr, ## __VA_ARGS__); \
+ } \
+ } while (0);
+
#define GEM_NWCTRL (0x00000000/4) /* Network Control reg */
#define GEM_NWCFG (0x00000004/4) /* Network Config reg */
#define GEM_NWSTATUS (0x00000008/4) /* Network Status reg */
@@ -62,15 +62,20 @@
/* Debug EEPRO100 card. */
#if 0
-# define DEBUG_EEPRO100
+#define DEBUG_EEPRO100 1
#endif
-#ifdef DEBUG_EEPRO100
-#define logout(fmt, ...) fprintf(stderr, "EE100\t%-24s" fmt, __func__, ## __VA_ARGS__)
-#else
-#define logout(fmt, ...) ((void)0)
+#ifndef DEBUG_EEPRO100
+#define DEBUG_EEPRO100 0
#endif
+#define logout(fmt, ...) \
+ do { \
+ if(DEBUG_EEPRO100) { \
+ fprintf(stderr, "EE100\t%-24s" fmt, __func__, ## __VA_ARGS__); \
+ } \
+ } while(0)
+
/* Set flags to 0 to disable debug output. */
#define INT 1 /* interrupt related actions */
#define MDI 1 /* mdi related actions */
@@ -18,18 +18,27 @@
/* For crc32 */
#include <zlib.h>
-//#define DEBUG_LAN9118
+//#define DEBUG_LAN9118 1
+
+#ifndef DEBUG_LAN9118
+#define DEBUG_LAN9118 0
+#endif
-#ifdef DEBUG_LAN9118
#define DPRINTF(fmt, ...) \
-do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
+ do { \
+ if(DEBUG_LAN9118) { \
+ printf("lan9118: " fmt , ## __VA_ARGS__); \
+ } \
+ } while (0)
+
#define BADF(fmt, ...) \
-do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+ do { \
+ if(DEBUG_LAN9118) { \
+ hw_error("lan9118: error: " fmt , ## __VA_ARGS__); \
+ }else{ \
+ fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__); \
+ } \
+ } while (0)
#define CSR_ID_REV 0x50
#define CSR_IRQ_CFG 0x54
@@ -36,14 +36,19 @@
#define ETH_ALEN 6
#define MAX_PACKET_SIZE 65536
-/*#define DEBUG*/
+/*#define DEBUG 1*/
-#ifdef DEBUG
-#define DPRINTF(fmt...) do { fprintf(stderr, fmt); } while (0)
-#else
-#define DPRINTF(fmt...)
+#ifndef DEBUG
+#define DEBUG 0
#endif
+#define DPRINTF(fmt...) \
+ do { \
+ if(DEBUG) { \
+ fprintf(stderr, fmt); \
+ } \
+ } while (0)
+
/*
* Virtual LAN device
*/
@@ -12,16 +12,24 @@
//#define DEBUG_STELLARIS_ENET 1
-#ifdef DEBUG_STELLARIS_ENET
+#ifndef DEBUG_STELLARIS_ENET
+#define DEBUG_STELLARIS_ENET 0
+#endif
+
#define DPRINTF(fmt, ...) \
-do { printf("stellaris_enet: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__); exit(1);} while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
+ do { \
+ if(DEBUG_STELLARIS_ENET) { \
+ printf("stellaris_enet: " fmt , ## __VA_ARGS__); \
+ } \
+ } while (0)
+
#define BADF(fmt, ...) \
-do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+ do { \
+ fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__); \
+ if(DEBUG_STELLARIS_ENET) { \
+ exit(1); \
+ } \
+ } while (0)
#define SE_INT_RX 0x01
#define SE_INT_TXER 0x02
@@ -30,14 +30,19 @@
#include "net/net.h"
#include "net/checksum.h"
-#ifdef DEBUG_XGMAC
-#define DEBUGF_BRK(message, args...) do { \
- fprintf(stderr, (message), ## args); \
- } while (0)
-#else
-#define DEBUGF_BRK(message, args...) do { } while (0)
+//#define DEBUG_XGMAC 1
+
+#ifndef DEBUG_XGMAC
+#define DEBUG_XGMAC 0
#endif
+#define DEBUGF_BRK(message, args...) \
+ do { \
+ if(DEBUG_XGMAC) { \
+ fprintf(stderr, (message), ## args); \
+ } \
+ } while (0)
+
#define XGMAC_CONTROL 0x00000000 /* MAC Configuration */
#define XGMAC_FRAME_FILTER 0x00000001 /* MAC Frame Filter */
#define XGMAC_FLOW_CTRL 0x00000006 /* MAC Flow Control */