568aa092405f740c9907c934422243f44e47e4ec
Stefan Schuermans header fix

Stefan Schuermans authored 12 years ago

1) /* flaneth - flash and ethernet
2)    Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info>
3)    Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
4)    a BlinkenArea project - http://www.blinkenarea.org/ */
Stefan Schuermans initial commit after making...

Stefan Schuermans authored 12 years ago

5) 
6) #ifndef INC_debug
7) #define INC_debug
8) 
9) #include <stdio.h>
10) #include <avr/pgmspace.h>
11) 
12) // debug configuration (what to debug)
13) #define DEBUG_INIT 1
14) #define DEBUG_EEPROM 1
15) #define DEBUG_CF 1
16) #define DEBUG_RTL8019 1
17) #define DEBUG_ETHER 1
18) #define DEBUG_ARP 1
19) #define DEBUG_IP 1
20) #define DEBUG_ICMP 1
21) #define DEBUG_UDP 1
22) #define DEBUG_DHCP 1
23) #define DEBUG_TCP 1
24) #define DEBUG_HTTP 1
Stefan Schuermans put filesystem stuff into o...

Stefan Schuermans authored 12 years ago

25) #define DEBUG_APPS 1
Stefan Schuermans support for reading MAC/IP...

Stefan Schuermans authored 12 years ago

26) #define DEBUG_APP_CFG 1
Stefan Schuermans initial commit after making...

Stefan Schuermans authored 12 years ago

27) 
28) // debug version of printf
29) #ifdef DEBUG
Stefan Schuermans support for reading MAC/IP...

Stefan Schuermans authored 12 years ago

30) #define debug_printf(fmt, arg...) \
Stefan Schuermans added dosfs code to read FA...

Stefan Schuermans authored 12 years ago

31)   do { \
Stefan Schuermans put filesystem stuff into o...

Stefan Schuermans authored 12 years ago

32)     static const PROGMEM char fmt_pgm[] = fmt"\r\n"; \
Stefan Schuermans support for reading MAC/IP...

Stefan Schuermans authored 12 years ago

33)     char fmt_buf[sizeof(fmt_pgm)]; \
Stefan Schuermans make more warnings visible...

Stefan Schuermans authored 12 years ago

34)     for(unsigned int i = 0; i < sizeof( fmt_pgm ); i++) \
Stefan Schuermans support for reading MAC/IP...

Stefan Schuermans authored 12 years ago

35)       fmt_buf[i] = (char)pgm_read_byte_near((uint16_t)fmt_pgm + i); \
36)     printf(fmt_buf, ##arg); \
Stefan Schuermans added dosfs code to read FA...

Stefan Schuermans authored 12 years ago

37)   } while (0)
Stefan Schuermans initial commit after making...

Stefan Schuermans authored 12 years ago

38) #else
39) #define debug_printf( fmt, arg... ) { }
40) #endif
41) 
42) // specialized debug versions of printf
Stefan Schuermans put filesystem stuff into o...

Stefan Schuermans authored 12 years ago

43) #define debug_specialized_printf(enabled, fmt, arg...) do { if(enabled) debug_printf(fmt, ##arg); } while (0)
44) #define debug_init_printf(fmt, arg...) debug_specialized_printf(DEBUG_INIT, "init: "fmt, ##arg)
45) #define debug_eeprom_printf(fmt, arg...) debug_specialized_printf(DEBUG_EEPROM, "eeprom: "fmt, ##arg)
46) #define debug_cf_printf(fmt, arg...) debug_specialized_printf(DEBUG_CF, "cf: "fmt, ##arg)
47) #define debug_rtl8019_printf(fmt, arg...) debug_specialized_printf(DEBUG_RTL8019, "rtl8019: "fmt, ##arg)
48) #define debug_ether_printf(fmt, arg...) debug_specialized_printf(DEBUG_ETHER, "ether: "fmt, ##arg)
49) #define debug_arp_printf(fmt, arg...) debug_specialized_printf(DEBUG_ARP, "arp: "fmt, ##arg)
50) #define debug_ip_printf(fmt, arg...) debug_specialized_printf(DEBUG_IP, "ip: "fmt, ##arg)
51) #define debug_icmp_printf(fmt, arg...) debug_specialized_printf(DEBUG_ICMP, "icmp: "fmt, ##arg)
52) #define debug_udp_printf(fmt, arg...) debug_specialized_printf(DEBUG_UDP, "udp: "fmt, ##arg)
53) #define debug_dhcp_printf(fmt, arg...) debug_specialized_printf(DEBUG_DHCP, "dhcp: "fmt, ##arg)
54) #define debug_tcp_printf(fmt, arg...) debug_specialized_printf(DEBUG_TCP, "tcp: "fmt, ##arg)
55) #define debug_http_printf(fmt, arg...) debug_specialized_printf(DEBUG_HTTP, "http: "fmt, ##arg)
56) #define debug_apps_printf(fmt, arg...) debug_specialized_printf(DEBUG_APPS, "apps: "fmt, ##arg)
Stefan Schuermans support for reading MAC/IP...

Stefan Schuermans authored 12 years ago

57) #define debug_app_cfg_printf(fmt, arg...) debug_specialized_printf(DEBUG_APP_CFG, "app_cfg: "fmt, ##arg)