intel_adsp: move utils to a new header

Move utility code into a new header and cleanup soc.h

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-03-28 14:30:26 +00:00
commit e195739565
7 changed files with 40 additions and 30 deletions

View file

@ -21,7 +21,7 @@
*/
#include "mm_drv_intel_adsp.h"
#include <soc_util.h>
#include <zephyr/drivers/mm/mm_drv_intel_adsp_mtl_tlb.h>
#include <zephyr/drivers/mm/mm_drv_bank.h>
#include <zephyr/debug/sparse.h>

View file

@ -6,7 +6,7 @@
#include <stdint.h>
#include <zephyr/devicetree.h>
#include <soc.h>
#include <soc_util.h>
#include <zephyr/arch/xtensa/cache.h>
#include <adsp_shim.h>
#include <adsp_memory.h>

View file

@ -6,7 +6,7 @@
#include <stdint.h>
#include <zephyr/devicetree.h>
#include <soc.h>
#include <soc_util.h>
#include <zephyr/arch/xtensa/cache.h>
#include <adsp_shim.h>
#include <adsp_memory.h>

View file

@ -9,7 +9,7 @@
#include <zephyr/devicetree.h>
#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <soc.h>
#include <soc_util.h>
#include <zephyr/arch/xtensa/cache.h>
#include <adsp_shim.h>
#include <adsp_memory.h>

View file

@ -66,29 +66,4 @@ static ALWAYS_INLINE void z_idelay(int n)
}
}
/* memcopy used by boot loader */
static ALWAYS_INLINE void bmemcpy(void *dest, void *src, size_t bytes)
{
volatile uint32_t *d = (uint32_t *)dest;
volatile uint32_t *s = (uint32_t *)src;
z_xtensa_cache_inv(src, bytes);
for (size_t i = 0; i < (bytes >> 2); i++)
d[i] = s[i];
z_xtensa_cache_flush(dest, bytes);
}
/* bzero used by bootloader */
static ALWAYS_INLINE void bbzero(void *dest, size_t bytes)
{
volatile uint32_t *d = (uint32_t *)dest;
for (size_t i = 0; i < (bytes >> 2); i++)
d[i] = 0;
z_xtensa_cache_flush(dest, bytes);
}
#endif /* ZEPHYR_SOC_INTEL_ADSP_COMMON_SOC_H_ */

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_
#define ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_
#include <zephyr/cache.h>
/* memcopy used by boot loader */
static ALWAYS_INLINE void bmemcpy(void *dest, void *src, size_t bytes)
{
volatile uint32_t *d = (uint32_t *)dest;
volatile uint32_t *s = (uint32_t *)src;
sys_cache_data_invd_range(src, bytes);
for (size_t i = 0; i < (bytes >> 2); i++)
d[i] = s[i];
sys_cache_data_flush_range(dest, bytes);
}
/* bzero used by bootloader */
static ALWAYS_INLINE void bbzero(void *dest, size_t bytes)
{
volatile uint32_t *d = (uint32_t *)dest;
for (size_t i = 0; i < (bytes >> 2); i++)
d[i] = 0;
sys_cache_data_flush_range(dest, bytes);
}
#endif /* ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_ */

View file

@ -10,7 +10,7 @@
#include <adsp_memory.h>
#include <adsp_shim.h>
#include <mem_window.h>
#include <soc.h>
#include <soc_util.h>
/* host windows */
#define DMWBA(win_base) (win_base + 0x0)