BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
2342395
Branches
Tags
master
flaneth
firmware
debug.h
change email address in header to blinkenarea address
Stefan Schuermans
commited
2342395
at 2012-05-22 19:18:57
debug.h
Blame
History
Raw
/* flaneth - flash and ethernet Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org> 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_APPS_TOOLS 1 #define DEBUG_APP_BBM 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_apps_tools_printf(fmt, arg...) debug_specialized_printf(DEBUG_APPS_TOOLS, "apps_tools: "fmt, ##arg) #define debug_app_bbm_printf(fmt, arg...) debug_specialized_printf(DEBUG_APP_BBM, "app_bbm: "fmt, ##arg) #define debug_app_cfg_printf(fmt, arg...) debug_specialized_printf(DEBUG_APP_CFG, "app_cfg: "fmt, ##arg) #endif // #ifndef INC_debug