2b483ef778eb9400ad487c7e71f2fbb11a980ad6
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 initial commit after making...

Stefan Schuermans authored 12 years ago

26) 
27) // debug version of printf
28) #ifdef DEBUG
Stefan Schuermans put filesystem stuff into o...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

31)     static const PROGMEM char fmt_pgm[] = fmt"\r\n"; \
Stefan Schuermans initial commit after making...

Stefan Schuermans authored 12 years ago

32)     char fmt_buf[sizeof( fmt_pgm )]; \
33)     for( int i = 0; i < sizeof( fmt_pgm ); i++ ) \
34)       fmt_buf[i] = (char)pgm_read_byte_near( (uint16_t)fmt_pgm + i ); \
35)     printf( fmt_buf, ##arg ); \
Stefan Schuermans added dosfs code to read FA...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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