drivers: retained_mem: nrf: make ram_ctrl variant explicit
Updated retained_mem driver variant exposes vendor-specific API, rather than executing implicitly during boot. Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
This commit is contained in:
parent
e501b54bad
commit
7e84571dcd
2 changed files with 38 additions and 3 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <zephyr/devicetree.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/retained_mem/nrf_retained_mem.h>
|
||||
|
||||
#include <helpers/nrfx_ram_ctrl.h>
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ static const struct ret_mem_region ret_mem_regions[] = {
|
|||
DT_FOREACH_STATUS_OKAY(zephyr_retained_ram, _BUILD_MEM_REGION)
|
||||
};
|
||||
|
||||
static int retained_mem_nrf_init(void)
|
||||
int z_nrf_retained_mem_retention_apply(void)
|
||||
{
|
||||
const struct ret_mem_region *rmr;
|
||||
|
||||
|
|
@ -33,5 +34,3 @@ static int retained_mem_nrf_init(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(retained_mem_nrf_init, PRE_KERNEL_1, 0);
|
||||
|
|
|
|||
36
include/zephyr/drivers/retained_mem/nrf_retained_mem.h
Normal file
36
include/zephyr/drivers/retained_mem/nrf_retained_mem.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_DRIVERS_RETAINED_MEM_NRF_RETAINED_MEM_H
|
||||
#define ZEPHYR_INCLUDE_DRIVERS_RETAINED_MEM_NRF_RETAINED_MEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <zephyr/drivers/retained_mem.h>
|
||||
|
||||
#if defined(CONFIG_RETAINED_MEM_NRF_RAM_CTRL) || defined(__DOXYGEN__)
|
||||
/** @brief Apply memory retention settings.
|
||||
*
|
||||
* Memory retention settings to apply are derived from devicetree configuration.
|
||||
*
|
||||
* @retval 0 if the retention settings were applied successfully.
|
||||
* @retval -ENOTSUP if retention configuration is not present in devicetree.
|
||||
*/
|
||||
int z_nrf_retained_mem_retention_apply(void);
|
||||
#else
|
||||
static inline int z_nrf_retained_mem_retention_apply(void)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_DRIVERS_RETAINED_MEM_NRF_RETAINED_MEM_H */
|
||||
Loading…
Reference in a new issue