soc: stm32c0: add poweroff mode
Add poweroff mode support for STM32C0 Fixes #73371 Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
This commit is contained in:
parent
f7d2cc2d43
commit
202c16008f
3 changed files with 24 additions and 0 deletions
|
@ -5,6 +5,8 @@ zephyr_sources(
|
|||
soc.c
|
||||
)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)
|
||||
|
||||
zephyr_include_directories(.)
|
||||
|
||||
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
|
||||
|
|
|
@ -10,3 +10,4 @@ config SOC_SERIES_STM32C0X
|
|||
select CPU_HAS_ARM_MPU
|
||||
select HAS_STM32CUBE
|
||||
select CPU_CORTEX_M_HAS_SYSTICK
|
||||
select HAS_POWEROFF
|
||||
|
|
21
soc/st/stm32/stm32c0x/poweroff.c
Normal file
21
soc/st/stm32/stm32c0x/poweroff.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Kickmaker
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/poweroff.h>
|
||||
#include <zephyr/toolchain.h>
|
||||
|
||||
#include <stm32_ll_cortex.h>
|
||||
#include <stm32_ll_pwr.h>
|
||||
|
||||
void z_sys_poweroff(void)
|
||||
{
|
||||
LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
|
||||
LL_LPM_EnableDeepSleep();
|
||||
|
||||
k_cpu_idle();
|
||||
|
||||
CODE_UNREACHABLE;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue