BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
568aa09
Branches
Tags
master
flaneth
firmware
debug.h
make more warnings visible and make them errors, remove warnings
Stefan Schuermans
commited
568aa09
at 2012-05-06 12:00:47
debug.h
Blame
History
Raw
/* flaneth - flash and ethernet Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info> Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html a BlinkenArea project - http://www.blinkenarea.org/ */ #ifndef INC_debug #define INC_debug #include <stdio.h> #include <avr/pgmspace.h> // debug configuration (what to debug) #define DEBUG_INIT 1 #define DEBUG_EEPROM 1 #define DEBUG_CF 1 #define DEBUG_RTL8019 1 #define DEBUG_ETHER 1 #define DEBUG_ARP 1 #define DEBUG_IP 1 #define DEBUG_ICMP 1 #define DEBUG_UDP 1 #define DEBUG_DHCP 1 #define DEBUG_TCP 1 #define DEBUG_HTTP 1 #define DEBUG_APPS 1 #define DEBUG_APP_CFG 1 // debug version of printf #ifdef DEBUG #define debug_printf(fmt, arg...) \ do { \ static const PROGMEM char fmt_pgm[] = fmt"\r\n"; \ char fmt_buf[sizeof(fmt_pgm)]; \ for(unsigned int i = 0; i < sizeof( fmt_pgm ); i++) \ fmt_buf[i] = (char)pgm_read_byte_near((uint16_t)fmt_pgm + i); \ printf(fmt_buf, ##arg); \ } while (0) #else #define debug_printf( fmt, arg... ) { } #endif // specialized debug versions of printf #define debug_specialized_printf(enabled, fmt, arg...) do { if(enabled) debug_printf(fmt, ##arg); } while (0) #define debug_init_printf(fmt, arg...) debug_specialized_printf(DEBUG_INIT, "init: "fmt, ##arg) #define debug_eeprom_printf(fmt, arg...) debug_specialized_printf(DEBUG_EEPROM, "eeprom: "fmt, ##arg) #define debug_cf_printf(fmt, arg...) debug_specialized_printf(DEBUG_CF, "cf: "fmt, ##arg) #define debug_rtl8019_printf(fmt, arg...) debug_specialized_printf(DEBUG_RTL8019, "rtl8019: "fmt, ##arg) #define debug_ether_printf(fmt, arg...) debug_specialized_printf(DEBUG_ETHER, "ether: "fmt, ##arg) #define debug_arp_printf(fmt, arg...) debug_specialized_printf(DEBUG_ARP, "arp: "fmt, ##arg) #define debug_ip_printf(fmt, arg...) debug_specialized_printf(DEBUG_IP, "ip: "fmt, ##arg) #define debug_icmp_printf(fmt, arg...) debug_specialized_printf(DEBUG_ICMP, "icmp: "fmt, ##arg) #define debug_udp_printf(fmt, arg...) debug_specialized_printf(DEBUG_UDP, "udp: "fmt, ##arg) #define debug_dhcp_printf(fmt, arg...) debug_specialized_printf(DEBUG_DHCP, "dhcp: "fmt, ##arg) #define debug_tcp_printf(fmt, arg...) debug_specialized_printf(DEBUG_TCP, "tcp: "fmt, ##arg) #define debug_http_printf(fmt, arg...) debug_specialized_printf(DEBUG_HTTP, "http: "fmt, ##arg) #define debug_apps_printf(fmt, arg...) debug_specialized_printf(DEBUG_APPS, "apps: "fmt, ##arg) #define debug_app_cfg_printf(fmt, arg...) debug_specialized_printf(DEBUG_APP_CFG, "app_cfg: "fmt, ##arg) #endif // #ifndef INC_debug