diff options
Diffstat (limited to 'os/hal/ports/SAMA/SAMA5D2x')
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_cache.c | 18 | ||||
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_cache.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c index 64f1f32d2..5c01ba359 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c @@ -26,7 +26,6 @@ /**
* @brief Invalidate D-Cache Region
- * @TODO: Extend to L2C
*
* @param[in] start Pointer to beginning of memory region.
* @param[in] length Length of the memory location.
@@ -41,11 +40,18 @@ void cacheInvalidateRegion(void *start, uint32_t length) { for (mva = start_addr & ~L1_CACHE_BYTES; mva < end_addr; mva += L1_CACHE_BYTES) {
L1C_InvalidateDCacheMVA((uint32_t *)mva);
}
+#if defined(ARM_ENABLE_L2CC)
+#if ARM_ENABLE_L2CC
+ /* Invalidate L2 Cache */
+ for (mva = start_addr & ~L2_CACHE_BYTES; mva < end_addr; mva += L2_CACHE_BYTES) {
+ L2C_InvPa((uint32_t *)mva);
+ }
+#endif
+#endif
}
/**
* @brief Clean D-Cache Region
- * @TODO: Extend to L2C
*
* @param[in] start Pointer to beginning of memory region.
* @param[in] length Length of the memory location.
@@ -60,6 +66,14 @@ void cacheCleanRegion(void *start, uint32_t length) { for (mva = start_addr & ~L1_CACHE_BYTES; mva < end_addr; mva += L1_CACHE_BYTES) {
L1C_CleanDCacheMVA((uint32_t *)mva);
}
+#if defined(ARM_ENABLE_L2CC)
+#if ARM_ENABLE_L2CC
+ /* Invalidate L2 Cache */
+ for (mva = start_addr & ~L2_CACHE_BYTES; mva < end_addr; mva += L2_CACHE_BYTES) {
+ L2C_CleanPa((uint32_t *)mva);
+ }
+#endif
+#endif
}
/** @} */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h index fc7bcedac..1608a023c 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h @@ -28,6 +28,7 @@ /* Driver constants. */
/*===========================================================================*/
#define L1_CACHE_BYTES 32u
+#define L2_CACHE_BYTES 32u
#ifdef __cplusplus
extern "C" {
|