Call chx_sleep_mode change.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
2017-11-17 NIIBE Yutaka <gniibe@fsij.org>
|
2017-11-17 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* chopstx.c (chopstx_conf_idle): Call chx_sleep_mode before
|
||||||
|
changing chx_allow_sleep.
|
||||||
|
|
||||||
* board/board-blue-pill.h, board/board-cq-starm.h,
|
* board/board-blue-pill.h, board/board-cq-starm.h,
|
||||||
board/board-fst-01-00.h, board/board-fst-01.h,
|
board/board-fst-01-00.h, board/board-fst-01.h,
|
||||||
board/board-fst-01g.h, board/board-maple-mini.h,
|
board/board-fst-01g.h, board/board-maple-mini.h,
|
||||||
|
|||||||
11
chopstx.c
11
chopstx.c
@@ -79,7 +79,7 @@ chx_fatal (uint32_t err_code)
|
|||||||
#include "chopstx-cortex-m.h"
|
#include "chopstx-cortex-m.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ALLOW_SLEEP for idle */
|
/* ALLOW_SLEEP for the idle thread. */
|
||||||
int chx_allow_sleep;
|
int chx_allow_sleep;
|
||||||
static struct chx_spinlock chx_enable_sleep_lock;
|
static struct chx_spinlock chx_enable_sleep_lock;
|
||||||
|
|
||||||
@@ -1488,12 +1488,15 @@ chopstx_setpriority (chopstx_prio_t prio_new)
|
|||||||
* For STM32F0, 1 for Sleep (CPU clock OFF only), 2 for Stop (Wakeup
|
* For STM32F0, 1 for Sleep (CPU clock OFF only), 2 for Stop (Wakeup
|
||||||
* by EXTI, voltage regulator on), 3 for Stop (Wakeup by EXTI, voltage
|
* by EXTI, voltage regulator on), 3 for Stop (Wakeup by EXTI, voltage
|
||||||
* regulator low-power), 4 for Standby (Wakeup by RESET, voltage
|
* regulator low-power), 4 for Standby (Wakeup by RESET, voltage
|
||||||
* regulator off), and 128 is or-ed to ask WFE instead of WFI.
|
* regulator off).
|
||||||
*
|
*
|
||||||
* For STM32F103, 1 for sleep with lower 8MHz clock.
|
* For STM32F103, 1 for normal sleep, and 2 for sleep with lower 8MHz
|
||||||
|
* clock.
|
||||||
*
|
*
|
||||||
* Return previous value of @enable_sleep.
|
* Return previous value of @enable_sleep.
|
||||||
*/
|
*/
|
||||||
|
extern void chx_sleep_mode (int enable_sleep);
|
||||||
|
|
||||||
int
|
int
|
||||||
chopstx_conf_idle (int enable_sleep)
|
chopstx_conf_idle (int enable_sleep)
|
||||||
{
|
{
|
||||||
@@ -1501,8 +1504,8 @@ chopstx_conf_idle (int enable_sleep)
|
|||||||
|
|
||||||
chx_spin_lock (&chx_enable_sleep_lock);
|
chx_spin_lock (&chx_enable_sleep_lock);
|
||||||
r = chx_allow_sleep;
|
r = chx_allow_sleep;
|
||||||
|
chx_sleep_mode (enable_sleep);
|
||||||
chx_allow_sleep = enable_sleep;
|
chx_allow_sleep = enable_sleep;
|
||||||
chx_sleep_mode ((enable_sleep & 0x7f));
|
|
||||||
chx_spin_unlock (&chx_enable_sleep_lock);
|
chx_spin_unlock (&chx_enable_sleep_lock);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user