soc: nordic: Add Nordic GPREGRET setting support
Adds support for setting GPREGRET register when rebooting. Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
This commit is contained in:
parent
9021b5d017
commit
183e7445c6
3 changed files with 24 additions and 0 deletions
|
@ -5,5 +5,6 @@ zephyr_compile_definitions_ifdef(
|
||||||
)
|
)
|
||||||
|
|
||||||
zephyr_sources(
|
zephyr_sources(
|
||||||
|
power.c
|
||||||
soc.c
|
soc.c
|
||||||
)
|
)
|
||||||
|
|
15
soc/arm/nordic_nrf/nrf51/power.c
Normal file
15
soc/arm/nordic_nrf/nrf51/power.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Intel Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <nrf_power.h>
|
||||||
|
|
||||||
|
/* Overrides the weak ARM implementation:
|
||||||
|
Set general purpose retention register and reboot */
|
||||||
|
void sys_arch_reboot(int type)
|
||||||
|
{
|
||||||
|
nrf_power_gpregret_set((uint8_t)type);
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
|
@ -115,3 +115,11 @@ bool _sys_soc_is_valid_power_state(enum power_states state)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Overrides the weak ARM implementation:
|
||||||
|
Set general purpose retention register and reboot */
|
||||||
|
void sys_arch_reboot(int type)
|
||||||
|
{
|
||||||
|
nrf_power_gpregret_set((uint8_t)type);
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue