soc: ambiq: fix potential issues
1. fix compile issue when CONFIG_DCACHE=n 2. check null in buf_in_nocache Signed-off-by: Swift Tian <swift.tian@ambiq.com>
This commit is contained in:
parent
465f6ba73e
commit
443b7012d7
1 changed files with 9 additions and 4 deletions
|
@ -8,9 +8,9 @@
|
||||||
#include <zephyr/cache.h>
|
#include <zephyr/cache.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <zephyr/mem_mgmt/mem_attr.h>
|
#include <zephyr/mem_mgmt/mem_attr.h>
|
||||||
#ifdef CONFIG_DCACHE
|
#ifdef CONFIG_CACHE_MANAGEMENT
|
||||||
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
|
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
|
||||||
#endif /* CONFIG_DCACHE */
|
#endif /* CONFIG_CACHE_MANAGEMENT */
|
||||||
|
|
||||||
#ifdef CONFIG_NOCACHE_MEMORY
|
#ifdef CONFIG_NOCACHE_MEMORY
|
||||||
#include <zephyr/linker/linker-defs.h>
|
#include <zephyr/linker/linker-defs.h>
|
||||||
|
@ -48,8 +48,9 @@ void soc_early_init_hook(void)
|
||||||
/*
|
/*
|
||||||
* Set default temperature for spotmgr to room temperature
|
* Set default temperature for spotmgr to room temperature
|
||||||
*/
|
*/
|
||||||
am_hal_pwrctrl_temp_thresh_t dummy[32];
|
am_hal_pwrctrl_temp_thresh_t dummy;
|
||||||
am_hal_pwrctrl_temp_update(25.0f, dummy);
|
|
||||||
|
am_hal_pwrctrl_temp_update(25.0f, &dummy);
|
||||||
|
|
||||||
/* Enable Icache*/
|
/* Enable Icache*/
|
||||||
sys_cache_instr_enable();
|
sys_cache_instr_enable();
|
||||||
|
@ -63,6 +64,10 @@ bool buf_in_nocache(uintptr_t buf, size_t len_bytes)
|
||||||
{
|
{
|
||||||
bool buf_within_nocache = false;
|
bool buf_within_nocache = false;
|
||||||
|
|
||||||
|
if (buf == 0 || len_bytes == 0) {
|
||||||
|
return buf_within_nocache;
|
||||||
|
}
|
||||||
|
|
||||||
#if CONFIG_NOCACHE_MEMORY
|
#if CONFIG_NOCACHE_MEMORY
|
||||||
/* Check if buffer is in nocache region defined by the linker */
|
/* Check if buffer is in nocache region defined by the linker */
|
||||||
buf_within_nocache = (buf >= ((uintptr_t)_nocache_ram_start)) &&
|
buf_within_nocache = (buf >= ((uintptr_t)_nocache_ram_start)) &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue