From 26a09567723c56e509dc9dacc53ce816239619b0 Mon Sep 17 00:00:00 2001 From: Huge_Dream <534463586@qq.com> Date: Sat, 8 Jul 2023 01:28:14 +0000 Subject: [PATCH] change LOWPOWER_DEBUG to LWIP_DEBUGF Signed-off-by: Huge_Dream <534463586@qq.com> Change-Id: I86c89d28272120b9d28ac26aba4d8e4ecf626082 --- src/core/dns.c | 4 ++-- src/core/ipv4/autoip.c | 2 +- src/core/ipv4/etharp.c | 4 ++-- src/core/ipv4/igmp.c | 2 +- src/core/ipv4/ip4_frag.c | 2 +- src/core/ipv6/dhcp6.c | 2 +- src/core/ipv6/ip6_frag.c | 2 +- src/core/ipv6/mld6.c | 2 +- src/core/ipv6/nd6.c | 4 ++-- src/core/lowpower.c | 16 ++++++++-------- src/core/tcp.c | 6 +++--- src/include/lwip/opt.h | 13 +++++-------- src/netif/lowpan6.c | 2 +- 13 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/core/dns.c b/src/core/dns.c index 2a8472d..ea5af43 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -419,7 +419,7 @@ dns_tmr_tick(void) for (i = 0; i < DNS_TABLE_SIZE; i++) { if ((dns_table[i].state == DNS_STATE_NEW) || (dns_table[i].state == DNS_STATE_ASKING)) { - LOWPOWER_DEBUG(("%s tmr tick: 1\n", "dns_tmr_tick")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: 1\n", "dns_tmr_tick")); return 1; } if (dns_table[i].state == DNS_STATE_DONE) { @@ -427,7 +427,7 @@ dns_tmr_tick(void) SET_TMR_TICK(tick, val); } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "dns_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "dns_tmr_tick", tick)); return tick; } #endif diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 7fae60e..7ff59b1 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -377,7 +377,7 @@ autoip_tmr_tick(void) } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "autoip_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "autoip_tmr_tick", tick)); return tick; } diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index 19fb24c..3fc85ef 100644 --- a/src/core/ipv4/etharp.c +++ b/src/core/ipv4/etharp.c @@ -204,14 +204,14 @@ etharp_tmr_tick(void) #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ ) { if (arp_table[i].state != ETHARP_STATE_STABLE) { - LOWPOWER_DEBUG(("%s tmr tick: 1\n", "etharp_tmr_tick")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: 1\n", "etharp_tmr_tick")); return 1; } time = (u32_t)ARP_MAXAGE - arp_table[i].ctime; SET_TMR_TICK(tick, time); } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "etharp_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "etharp_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index 5b4efce..4ab8832 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -689,7 +689,7 @@ igmp_tmr_tick(void) group = group->next; } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "igmp_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "igmp_tmr_tick", tick)); return tick; } #endif diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c index 2e34d8f..50068ff 100644 --- a/src/core/ipv4/ip4_frag.c +++ b/src/core/ipv4/ip4_frag.c @@ -228,7 +228,7 @@ ip_reass_tmr_tick(void) SET_TMR_TICK(tick, val); r = r->next; } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "ip_reass_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "ip_reass_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ diff --git a/src/core/ipv6/dhcp6.c b/src/core/ipv6/dhcp6.c index 2905791..36fbc16 100644 --- a/src/core/ipv6/dhcp6.c +++ b/src/core/ipv6/dhcp6.c @@ -842,7 +842,7 @@ dhcp6_tmr_tick() SET_TMR_TICK(tick, dhcp6->request_timeout); } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "dhcp6_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "dhcp6_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c index e8581dd..2bfaa37 100644 --- a/src/core/ipv6/ip6_frag.c +++ b/src/core/ipv6/ip6_frag.c @@ -152,7 +152,7 @@ ip6_reass_tmr_tick(void) SET_TMR_TICK(tick, val); r = r->next; } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "ip6_reass_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "ip6_reass_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ diff --git a/src/core/ipv6/mld6.c b/src/core/ipv6/mld6.c index decaf92..c8ec789 100644 --- a/src/core/ipv6/mld6.c +++ b/src/core/ipv6/mld6.c @@ -553,7 +553,7 @@ mld6_tmr_tick(void) } } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "mld6_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "mld6_tmr_tick", tick)); return tick; } #endif diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 1e40906..47ab8ad 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -1247,7 +1247,7 @@ nd6_tmr_tick(void) /* Step 2: update DAD state. */ addr_state = netif_ip6_addr_state(netif, i); if (ip6_addr_istentative(addr_state)) { - LOWPOWER_DEBUG(("%s tmr tick: 1\n", "nd6_tmr_tick")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: 1\n", "nd6_tmr_tick")); return 1; } } @@ -1262,7 +1262,7 @@ nd6_tmr_tick(void) } #endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */ - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "nd6_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "nd6_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ diff --git a/src/core/lowpower.c b/src/core/lowpower.c index 4881e80..63abefe 100644 --- a/src/core/lowpower.c +++ b/src/core/lowpower.c @@ -174,7 +174,7 @@ sys_timeout_reg( timeout = (struct timer_entry *)memp_malloc(MEMP_SYS_TIMEOUT); if (timeout == NULL) { - LOWPOWER_DEBUG(("sys_timeout_reg: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("sys_timeout_reg: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty")); return -1; } @@ -210,7 +210,7 @@ timeout_handler(struct timer_entry *t, u32_t now) { #if LOWPOWER_TIMER_DEBUG if (t->name != NULL) { - LOWPOWER_DEBUG(("%s timeout: now:%u\n", t->name, now)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s timeout: now:%u\n", t->name, now)); } #endif @@ -233,7 +233,7 @@ get_timer_tick(struct timer_entry *t) tick = t->next_tick(); } else { tick = 1; - LOWPOWER_DEBUG(("next->tick is NULL\n")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("next->tick is NULL\n")); } tick *= t->clock_max; return tick; @@ -274,7 +274,7 @@ get_sleep_time(u32_t now) u32_t tick; u32_t temp; - LOWPOWER_DEBUG(("\n*******get_sleep_time*****************\n")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("\n*******get_sleep_time*****************\n")); for (t = g_timer_header, p = NULL; t != NULL; t = n) { n = t->next; @@ -307,7 +307,7 @@ again: p = t; } - LOWPOWER_DEBUG(("msec = %u now = %u\n", msec, now)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("msec = %u now = %u\n", msec, now)); return msec; } @@ -321,8 +321,8 @@ check_timeout(u32_t now) u32_t ticks; u32_t i; - LOWPOWER_DEBUG(("\n**********timeout**************\n")); - LOWPOWER_DEBUG(("now = %u\n", now)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("\n**********timeout**************\n")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("now = %u\n", now)); for (t = g_timer_header, p = NULL; t != NULL; t = n) { n = t->next; @@ -420,7 +420,7 @@ sys_timeouts_init(void) for (i = 0; i < LWIP_ARRAYSIZE(lowpower_timer_handler); i++) { if (set_timer_interval(i, lowpower_timer_handler[i].interval) != 0) { - LOWPOWER_DEBUG(("ERROR:regist timer faild! i = %u\n", i)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("ERROR:regist timer faild! i = %u\n", i)); } } } diff --git a/src/core/tcp.c b/src/core/tcp.c index 413605f..2055f61 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -375,7 +375,7 @@ tcp_slow_tmr_tick(void) pcb = pcb->next; } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "tcp_slow_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "tcp_slow_tmr_tick", tick)); return tick; } @@ -391,12 +391,12 @@ tcp_fast_tmr_tick(void) (pcb->flags & TF_CLOSEPEND) || (pcb->refused_data != NULL) ) { - LOWPOWER_DEBUG(("%s tmr tick: 1\n", "tcp_fast_tmr_tick")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: 1\n", "tcp_fast_tmr_tick")); return 1; } pcb = pcb->next; } - LOWPOWER_DEBUG(("%s tmr tick: 0\n", "tcp_fast_tmr_tick")); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: 0\n", "tcp_fast_tmr_tick")); return 0; } #endif /* LWIP_LOWPOWER */ diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 5f72796..53a20b7 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -3539,14 +3539,11 @@ #if LWIP_LOWPOWER -#ifndef LOWPOWER_DBG -#define LOWPOWER_DBG 0 -#endif - -#if LOWPOWER_DBG -#define LOWPOWER_DEBUG(msg) printf msg -#else -#define LOWPOWER_DEBUG(msg) +/** + * LOWPOWER_DEBUG: Enable debugging in lowpower.c. + */ +#if !defined LOWPOWER_DEBUG || defined __DOXYGEN__ +#define LOWPOWER_DEBUG LWIP_DBG_OFF #endif #ifndef MEMP_NUM_TCPIP_MSG_LOWPOWER diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c index 5e84ba8..428aac2 100644 --- a/src/netif/lowpan6.c +++ b/src/netif/lowpan6.c @@ -138,7 +138,7 @@ lowpan6_tmr_tick() lrh = lrh_temp; } - LOWPOWER_DEBUG(("%s tmr tick: %u\n", "lowpan6_tmr_tick", tick)); + LWIP_DEBUGF(LOWPOWER_DEBUG, ("%s tmr tick: %u\n", "lowpan6_tmr_tick", tick)); return tick; } #endif /* LWIP_LOWPOWER */ -- GitLab