summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-02 17:40:45 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-03 17:30:54 +0200
commitd2d0296138aced3ccc0828dc1a109b1df61f1bbb (patch)
tree16e686379e4f7a5355d80bae976f9472d916b5e0
parentbsps/arm: Add and use bsp_translation_table_base (diff)
downloadrtems-d2d0296138aced3ccc0828dc1a109b1df61f1bbb.tar.bz2
bsps/arm: Add arm_cp15_get_min_cache_line_size()
-rw-r--r--c/src/lib/libcpu/arm/shared/include/arm-cp15.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/c/src/lib/libcpu/arm/shared/include/arm-cp15.h b/c/src/lib/libcpu/arm/shared/include/arm-cp15.h
index 017c0e3cd0..7f7249f311 100644
--- a/c/src/lib/libcpu/arm/shared/include/arm-cp15.h
+++ b/c/src/lib/libcpu/arm/shared/include/arm-cp15.h
@@ -7,12 +7,13 @@
*/
/*
- * Copyright (c) 2009, 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <info@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -443,6 +444,25 @@ static inline uint32_t arm_cp15_get_cache_type(void)
return val;
}
+static inline uint32_t arm_cp15_get_min_cache_line_size(void)
+{
+ uint32_t mcls = 0;
+ uint32_t ct = arm_cp15_get_cache_type();
+ uint32_t format = (ct >> 29) & 0x7U;
+
+ if (format == 0x4) {
+ mcls = (1U << (ct & 0xf)) * 4;
+ } else if (format == 0x0) {
+ uint32_t mask = (1U << 12) - 1;
+ uint32_t dcls = (ct >> 12) & mask;
+ uint32_t icls = ct & mask;
+
+ mcls = dcls <= icls ? dcls : icls;
+ }
+
+ return mcls;
+}
+
static inline void arm_cp15_cache_invalidate(void)
{
ARM_SWITCH_REGISTERS;