[PATCH 1/4] Code refactor altera-cyclone-V MMU initialization

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


---
 c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am  |    4 ++++
 .../arm/altera-cyclone-v/startup/bspstarthooks.c   |   22 ++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
index 6afe681..887a63a 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -31,6 +31,7 @@ include_bsp_HEADERS =
 include_bsp_socal_HEADERS =
 
 include_bsp_HEADERS += ../../shared/include/utility.h
+include_bsp_HEADERS += ../../../libbsp/shared/include/mm.h
 include_bsp_HEADERS += ../../shared/include/irq-generic.h
 include_bsp_HEADERS += ../../shared/include/irq-info.h
 include_bsp_HEADERS += ../../shared/include/stackalloc.h
@@ -176,6 +177,9 @@ libbsp_a_SOURCES += ../shared/arm-a9mpcore-smp.c
 libbsp_a_SOURCES += startup/bspsmp.c
 endif
 
+# LIBMM
+libbsp_a_SOURCES += ../shared/mminit.c
+
 # IRQ
 libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
 libbsp_a_SOURCES += ../../shared/src/irq-generic.c
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
index bd1f1c8..9f3ec03 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/startup/bspstarthooks.c
@@ -15,6 +15,7 @@
 #define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
 
 #include <bsp.h>
+#include <bsp/mm.h>
 #include <bsp/start.h>
 #include <bsp/arm-cp15-start.h>
 #include <bsp/arm-a9mpcore-start.h>
@@ -35,18 +36,13 @@ BSP_START_TEXT_SECTION void bsp_start_hook_0( void )
 }
 
 BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
-{
-  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
-    ARM_CP15_CTRL_A | ARM_CP15_CTRL_M,
-    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
-  );
-
-  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
-    ctrl,
-    (uint32_t *) bsp_translation_table_base,
-    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
-    &arm_cp15_start_mmu_config_table[0],
-    arm_cp15_start_mmu_config_table_size
+{ 
+  uint32_t bsp_initial_mmu_ctrl_clear = ARM_CP15_CTRL_M | ARM_CP15_CTRL_A; 
+  uint32_t bsp_initial_mmu_ctrl_set = ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z;
+  
+    bsp_memory_management_initialize(
+    bsp_initial_mmu_ctrl_set,
+    bsp_initial_mmu_ctrl_clear
   );
 }
 
@@ -91,4 +87,4 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
   rtems_cache_enable_data();
 #endif
   bsp_start_clear_bss();
-}
+}
\ No newline at end of file
-- 
1.7.9.5



More information about the devel mailing list