memc: stm32_xspi_psram: init shared_multi_heap area
Initialize the whole psram as a shared_multi_heap_area if SHARED_MULTI_HEAP is enabled. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
This commit is contained in:
parent
2a623605ab
commit
b7f73710b2
1 changed files with 17 additions and 0 deletions
|
@ -14,11 +14,20 @@
|
|||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/multi_heap/shared_multi_heap.h>
|
||||
|
||||
LOG_MODULE_REGISTER(memc_stm32_xspi_psram, CONFIG_MEMC_LOG_LEVEL);
|
||||
|
||||
#define STM32_XSPI_NODE DT_INST_PARENT(0)
|
||||
|
||||
#ifdef CONFIG_SHARED_MULTI_HEAP
|
||||
struct shared_multi_heap_region smh_psram = {
|
||||
.addr = DT_REG_ADDR(DT_NODELABEL(psram)),
|
||||
.size = DT_REG_SIZE(DT_NODELABEL(psram)),
|
||||
.attr = SMH_REG_ATTR_EXTERNAL,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Memory registers definition */
|
||||
#define MR0 0x00000000U
|
||||
#define MR1 0x00000001U
|
||||
|
@ -347,6 +356,14 @@ static int memc_stm32_xspi_psram_init(const struct device *dev)
|
|||
MODIFY_REG(hxspi.Instance->CR, XSPI_CR_NOPREF, HAL_XSPI_AUTOMATIC_PREFETCH_DISABLE);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SHARED_MULTI_HEAP
|
||||
shared_multi_heap_pool_init();
|
||||
ret = shared_multi_heap_add(&smh_psram, NULL);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue