[PATCH] Code refactor changes to mm.h and mminit.c

Rohini Kulkarni krohini1593 at gmail.com
Thu Aug 13 21:53:10 UTC 2015


---
 c/src/lib/libbsp/arm/shared/mminit.c |   17 +++++++++++------
 c/src/lib/libbsp/shared/include/mm.h |    5 ++++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/c/src/lib/libbsp/arm/shared/mminit.c b/c/src/lib/libbsp/arm/shared/mminit.c
index acfbfc0..f2617f8 100644
--- a/c/src/lib/libbsp/arm/shared/mminit.c
+++ b/c/src/lib/libbsp/arm/shared/mminit.c
@@ -11,14 +11,19 @@
 #include <bsp/start.h>
 #include <bsp/arm-cp15-start.h>
 #include <bsp/linker-symbols.h>
+#include <libcpu/arm-cp15.h>
 #include <bsp/mm.h>
 
-BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
+BSP_START_TEXT_SECTION void bsp_memory_management_initialize(
+  uint32_t bsp_initial_mmu_ctrl_set,
+  uint32_t bsp_initial_mmu_ctrl_clear
+)
 {
-  uint32_t ctrl = arm_cp15_get_control();
-
-  ctrl |= ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_S | ARM_CP15_CTRL_XP;
-
+  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
+    bsp_initial_mmu_ctrl_clear,
+    bsp_initial_mmu_ctrl_set  
+  );
+  
   arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
     ctrl,
     (uint32_t *) bsp_translation_table_base,
@@ -26,4 +31,4 @@ BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
     &arm_cp15_start_mmu_config_table[0],
     arm_cp15_start_mmu_config_table_size
   );
-}
+}
\ No newline at end of file
diff --git a/c/src/lib/libbsp/shared/include/mm.h b/c/src/lib/libbsp/shared/include/mm.h
index 2152f68..aad6b05 100644
--- a/c/src/lib/libbsp/shared/include/mm.h
+++ b/c/src/lib/libbsp/shared/include/mm.h
@@ -33,7 +33,10 @@ extern "C" {
  *  @brief MM Support Package
  */
 
-void bsp_memory_management_initialize(void);
+void bsp_memory_management_initialize(
+  uint32_t bsp_initial_mmu_ctrl_set,
+  uint32_t bsp_initial_mmu_ctrl_clear
+);
 
 #ifdef __cplusplus
 }
-- 
1.7.9.5



More information about the devel mailing list