Skip to content

Commit

Permalink
cortexm_common: Introduce CPU_NOSLEEP to disable all sleep at compile…
Browse files Browse the repository at this point in the history
… time
  • Loading branch information
Joakim Nohlgård committed Nov 8, 2017
1 parent b3574e8 commit 22b9865
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cpu/cortexm_common/include/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
extern "C" {
#endif

/**
* @brief Set this to 1 to disable all sleep (useful for debugging)
*
* Example: CFLAGS=-DCPU_NOSLEEP make flash
*/
#ifndef CPU_NOSLEEP
#define CPU_NOSLEEP 0
#endif

/**
* @brief Interrupt stack canary value
*
Expand Down Expand Up @@ -96,6 +105,9 @@ static inline void cortexm_sleep_until_event(void)
*/
static inline void cortexm_sleep(int deep)
{
if (CPU_NOSLEEP) {
return;
}
if (deep) {
SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk);
}
Expand Down

0 comments on commit 22b9865

Please sign in to comment.