From 9df377d69948d95c3bff9a255f546b95a933247c Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 22 Nov 2019 01:30:03 +0100 Subject: [PATCH] cpu/sam*: pm: make use of DEBUG_PUTS() `pm_set()` gets called by the idle thread whose stack is too small for normal DEBUG()/printf(). Use DEBUG_PUTS() instead to print the static debug strings. --- cpu/samd5x/periph/pm.c | 15 +++++---------- cpu/saml1x/periph/pm.c | 4 ++-- cpu/saml21/periph/pm.c | 6 +++--- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/cpu/samd5x/periph/pm.c b/cpu/samd5x/periph/pm.c index f0ef4ea23e..8229881749 100644 --- a/cpu/samd5x/periph/pm.c +++ b/cpu/samd5x/periph/pm.c @@ -22,12 +22,7 @@ #include "periph/pm.h" #define ENABLE_DEBUG (0) - -#if ENABLE_DEBUG -#define DEBUG(s) puts(s) -#else -#define DEBUG(s) -#endif +#include "debug.h" void pm_set(unsigned mode) { @@ -36,23 +31,23 @@ void pm_set(unsigned mode) switch (mode) { case 0: - DEBUG("pm_set(): setting BACKUP mode."); + DEBUG_PUTS("pm_set(): setting BACKUP mode."); _mode = PM_SLEEPCFG_SLEEPMODE_BACKUP; deep = 1; break; case 1: - DEBUG("pm_set(): setting HIBERNATE mode."); + DEBUG_PUTS("pm_set(): setting HIBERNATE mode."); _mode = PM_SLEEPCFG_SLEEPMODE_HIBERNATE; deep = 1; break; case 2: - DEBUG("pm_set(): setting STANDBY mode."); + DEBUG_PUTS("pm_set(): setting STANDBY mode."); _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; deep = 1; break; default: /* Falls through */ case 3: - DEBUG("pm_set(): setting IDLE2 mode."); + DEBUG_PUTS("pm_set(): setting IDLE2 mode."); _mode = PM_SLEEPCFG_SLEEPMODE_IDLE2; break; } diff --git a/cpu/saml1x/periph/pm.c b/cpu/saml1x/periph/pm.c index e6525e888c..79a8aa8841 100644 --- a/cpu/saml1x/periph/pm.c +++ b/cpu/saml1x/periph/pm.c @@ -31,12 +31,12 @@ void pm_set(unsigned mode) switch (mode) { case 0: - DEBUG("pm_set(): setting STANDBY mode.\n"); + DEBUG_PUTS("pm_set(): setting STANDBY mode."); _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; break; default: /* Falls through */ case 1: - DEBUG("pm_set(): setting IDLE mode.\n"); + DEBUG_PUTS("pm_set(): setting IDLE mode."); _mode = PM_SLEEPCFG_SLEEPMODE_IDLE; break; } diff --git a/cpu/saml21/periph/pm.c b/cpu/saml21/periph/pm.c index 671318eeae..7ad31c4289 100644 --- a/cpu/saml21/periph/pm.c +++ b/cpu/saml21/periph/pm.c @@ -31,16 +31,16 @@ void pm_set(unsigned mode) switch (mode) { case 0: - DEBUG("pm_set(): setting BACKUP mode.\n"); + DEBUG_PUTS("pm_set(): setting BACKUP mode."); _mode = PM_SLEEPCFG_SLEEPMODE_BACKUP; break; case 1: - DEBUG("pm_set(): setting STANDBY mode.\n"); + DEBUG_PUTS("pm_set(): setting STANDBY mode."); _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; break; default: /* Falls through */ case 2: - DEBUG("pm_set(): setting IDLE mode.\n"); + DEBUG_PUTS("pm_set(): setting IDLE mode."); #if defined(CPU_MODEL_SAMR30G18A) || defined(CPU_MODEL_SAMR34J18B) _mode = PM_SLEEPCFG_SLEEPMODE_IDLE; #else