1 /* 2 * Copyright (c) 2019-2023 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_ 7 #define ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_ 8 9 #include <zephyr/cache.h> 10 11 /* memcopy used by boot loader */ bmemcpy(void * dest,void * src,size_t bytes)12static ALWAYS_INLINE void bmemcpy(void *dest, void *src, size_t bytes) 13 { 14 volatile uint32_t *d = (uint32_t *)dest; 15 volatile uint32_t *s = (uint32_t *)src; 16 17 sys_cache_data_invd_range(src, bytes); 18 for (size_t i = 0; i < (bytes >> 2); i++) { 19 d[i] = s[i]; 20 } 21 22 sys_cache_data_flush_range(dest, bytes); 23 } 24 25 /* bzero used by bootloader */ bbzero(void * dest,size_t bytes)26static ALWAYS_INLINE void bbzero(void *dest, size_t bytes) 27 { 28 volatile uint32_t *d = (uint32_t *)dest; 29 30 for (size_t i = 0; i < (bytes >> 2); i++) { 31 d[i] = 0; 32 } 33 34 sys_cache_data_flush_range(dest, bytes); 35 } 36 37 #endif /* ZEPHYR_SOC_INTEL_ADSP_COMMON_UTIL_H_ */ 38