Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:48

0001 /*
0002  * Copyright (c) 2013 embedded brains GmbH & Co. KG
0003  *
0004  * Copyright (c) 2014 Chris Johns.  All rights reserved.
0005  *
0006  * The license and distribution terms for this file may be
0007  * found in the file LICENSE in this distribution or at
0008  * http://www.rtems.org/license/LICENSE.
0009  */
0010 
0011 #include <bsp.h>
0012 #include <bsp/start.h>
0013 #include <bsp/arm-cp15-start.h>
0014 
0015 #define ARM_SECTIONS       4096          /* all sections needed to describe the
0016                                             virtual address space */
0017 #define ARM_SECTION_SIZE   (1024 * 1024) /* how much virtual memory is described
0018                                             by one section */
0019 
0020 //static uint32_t pagetable[ARM_SECTIONS] __attribute__((aligned (1024*16)));
0021 
0022 BSP_START_DATA_SECTION static const arm_cp15_start_section_config
0023 beagle_mmu_config_table[] = {
0024   ARMV7_CP15_START_DEFAULT_SECTIONS,
0025   {
0026     .begin = 0x40000000U,
0027     .end = 0x4FFFFFFFU,
0028     .flags = ARMV7_MMU_DEVICE
0029   }
0030 };
0031 
0032 /*
0033  * Make weak and let the user override.
0034  */
0035 BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) __attribute__ ((weak));
0036 
0037 BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void)
0038 {
0039   /* turn mmu off first in case it's on */
0040   uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
0041     ARM_CP15_CTRL_M | ARM_CP15_CTRL_A,  /* clear - mmu off */
0042     ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
0043   );
0044 
0045   arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
0046     ctrl,
0047     (uint32_t *) bsp_translation_table_base,
0048     ARM_MMU_DEFAULT_CLIENT_DOMAIN,
0049     &beagle_mmu_config_table[0],
0050     RTEMS_ARRAY_SIZE(beagle_mmu_config_table)
0051   );
0052 }