From 7e4c5d3daa066d0d37101e410ba2b61156008864 Mon Sep 17 00:00:00 2001 From: ligd Date: Wed, 7 Dec 2022 12:29:05 +0800 Subject: [PATCH] armv7a/r: cache function should depends on CONFIG_ARCH_XCACHE Signed-off-by: ligd --- arch/arm/src/armv7-a/arm_cache.c | 124 ++++++++++++++++--------------- arch/arm/src/armv7-r/arm_cache.c | 124 ++++++++++++++++--------------- 2 files changed, 132 insertions(+), 116 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_cache.c b/arch/arm/src/armv7-a/arm_cache.c index bb59ebc4d0..7b8479c78c 100644 --- a/arch/arm/src/armv7-a/arm_cache.c +++ b/arch/arm/src/armv7-a/arm_cache.c @@ -34,6 +34,70 @@ * Public Functions ****************************************************************************/ +#ifdef CONFIG_ARCH_ICACHE + +/**************************************************************************** + * Name: up_invalidate_icache_all + * + * Description: + * Invalidate all instruction caches to PoU, also flushes branch target + * cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_invalidate_icache_all(void) +{ + cp15_invalidate_icache(); +} + +/**************************************************************************** + * Name: up_enable_icache + * + * Description: + * Enable the I-Cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_enable_icache(void) +{ + cp15_enable_icache(); +} + +/**************************************************************************** + * Name: up_disable_icache + * + * Description: + * Disable the I-Cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_disable_icache(void) +{ + cp15_disable_icache(); +} + +#endif /* CONFIG_ARCH_ICACHE */ + +#ifdef CONFIG_ARCH_DCACHE + /**************************************************************************** * Name: up_invalidate_dcache * @@ -91,26 +155,6 @@ void up_invalidate_dcache_all(void) #endif } -/**************************************************************************** - * Name: up_invalidate_icache_all - * - * Description: - * Invalidate all instruction caches to PoU, also flushes branch target - * cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_invalidate_icache_all(void) -{ - cp15_invalidate_icache(); -} - /**************************************************************************** * Name: up_clean_dcache * @@ -238,44 +282,6 @@ void up_flush_dcache_all(void) l2cc_flush_all(); } -/**************************************************************************** - * Name: up_enable_icache - * - * Description: - * Enable the I-Cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_enable_icache(void) -{ - cp15_enable_icache(); -} - -/**************************************************************************** - * Name: up_disable_icache - * - * Description: - * Disable the I-Cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_disable_icache(void) -{ - cp15_disable_icache(); -} - /**************************************************************************** * Name: up_enable_dcache * @@ -349,3 +355,5 @@ void up_coherent_dcache(uintptr_t addr, size_t len) #endif } } + +#endif /* CONFIG_ARCH_DCACHE */ diff --git a/arch/arm/src/armv7-r/arm_cache.c b/arch/arm/src/armv7-r/arm_cache.c index f1598d174c..ef35e50306 100644 --- a/arch/arm/src/armv7-r/arm_cache.c +++ b/arch/arm/src/armv7-r/arm_cache.c @@ -34,6 +34,70 @@ * Public Functions ****************************************************************************/ +#ifdef CONFIG_ARCH_ICACHE + +/**************************************************************************** + * Name: up_invalidate_icache_all + * + * Description: + * Invalidate all instruction caches to PoU, also flushes branch target + * cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_invalidate_icache_all(void) +{ + cp15_invalidate_icache(); +} + +/**************************************************************************** + * Name: up_enable_icache + * + * Description: + * Enable the I-Cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_enable_icache(void) +{ + cp15_enable_icache(); +} + +/**************************************************************************** + * Name: up_disable_icache + * + * Description: + * Disable the I-Cache + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_disable_icache(void) +{ + cp15_disable_icache(); +} + +#endif /* CONFIG_ARCH_ICACHE */ + +#ifdef CONFIG_ARCH_DCACHE + /**************************************************************************** * Name: up_invalidate_dcache * @@ -91,26 +155,6 @@ void up_invalidate_dcache_all(void) #endif } -/**************************************************************************** - * Name: up_invalidate_icache_all - * - * Description: - * Invalidate all instruction caches to PoU, also flushes branch target - * cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_invalidate_icache_all(void) -{ - cp15_invalidate_icache(); -} - /**************************************************************************** * Name: up_clean_dcache * @@ -238,44 +282,6 @@ void up_flush_dcache_all(void) l2cc_flush_all(); } -/**************************************************************************** - * Name: up_enable_icache - * - * Description: - * Enable the I-Cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_enable_icache(void) -{ - cp15_enable_icache(); -} - -/**************************************************************************** - * Name: up_disable_icache - * - * Description: - * Disable the I-Cache - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -void up_disable_icache(void) -{ - cp15_disable_icache(); -} - /**************************************************************************** * Name: up_enable_dcache * @@ -349,3 +355,5 @@ void up_coherent_dcache(uintptr_t addr, size_t len) #endif } } + +#endif /* CONFIG_ARCH_DCACHE */