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.
This commit is contained in:
Benjamin Valentin 2019-11-22 01:30:03 +01:00
parent 3eae474e74
commit 9df377d699
3 changed files with 10 additions and 15 deletions

View File

@ -22,12 +22,7 @@
#include "periph/pm.h" #include "periph/pm.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h"
#if ENABLE_DEBUG
#define DEBUG(s) puts(s)
#else
#define DEBUG(s)
#endif
void pm_set(unsigned mode) void pm_set(unsigned mode)
{ {
@ -36,23 +31,23 @@ void pm_set(unsigned mode)
switch (mode) { switch (mode) {
case 0: case 0:
DEBUG("pm_set(): setting BACKUP mode."); DEBUG_PUTS("pm_set(): setting BACKUP mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_BACKUP; _mode = PM_SLEEPCFG_SLEEPMODE_BACKUP;
deep = 1; deep = 1;
break; break;
case 1: case 1:
DEBUG("pm_set(): setting HIBERNATE mode."); DEBUG_PUTS("pm_set(): setting HIBERNATE mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_HIBERNATE; _mode = PM_SLEEPCFG_SLEEPMODE_HIBERNATE;
deep = 1; deep = 1;
break; break;
case 2: case 2:
DEBUG("pm_set(): setting STANDBY mode."); DEBUG_PUTS("pm_set(): setting STANDBY mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
deep = 1; deep = 1;
break; break;
default: /* Falls through */ default: /* Falls through */
case 3: case 3:
DEBUG("pm_set(): setting IDLE2 mode."); DEBUG_PUTS("pm_set(): setting IDLE2 mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE2; _mode = PM_SLEEPCFG_SLEEPMODE_IDLE2;
break; break;
} }

View File

@ -31,12 +31,12 @@ void pm_set(unsigned mode)
switch (mode) { switch (mode) {
case 0: case 0:
DEBUG("pm_set(): setting STANDBY mode.\n"); DEBUG_PUTS("pm_set(): setting STANDBY mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
break; break;
default: /* Falls through */ default: /* Falls through */
case 1: case 1:
DEBUG("pm_set(): setting IDLE mode.\n"); DEBUG_PUTS("pm_set(): setting IDLE mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE; _mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
break; break;
} }

View File

@ -31,16 +31,16 @@ void pm_set(unsigned mode)
switch (mode) { switch (mode) {
case 0: case 0:
DEBUG("pm_set(): setting BACKUP mode.\n"); DEBUG_PUTS("pm_set(): setting BACKUP mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_BACKUP; _mode = PM_SLEEPCFG_SLEEPMODE_BACKUP;
break; break;
case 1: case 1:
DEBUG("pm_set(): setting STANDBY mode.\n"); DEBUG_PUTS("pm_set(): setting STANDBY mode.");
_mode = PM_SLEEPCFG_SLEEPMODE_STANDBY; _mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
break; break;
default: /* Falls through */ default: /* Falls through */
case 2: 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) #if defined(CPU_MODEL_SAMR30G18A) || defined(CPU_MODEL_SAMR34J18B)
_mode = PM_SLEEPCFG_SLEEPMODE_IDLE; _mode = PM_SLEEPCFG_SLEEPMODE_IDLE;
#else #else