1 | /* |
---|
2 | * Copyright (c) 2013 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <info@embedded-brains.de> |
---|
9 | * |
---|
10 | * Copyright (c) 2014 Chris Johns. All rights reserved. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <bsp/start.h> |
---|
19 | #include <bsp/arm-cp15-start.h> |
---|
20 | |
---|
21 | #define ARM_SECTIONS 4096 /* all sections needed to describe the |
---|
22 | virtual address space */ |
---|
23 | #define ARM_SECTION_SIZE (1024 * 1024) /* how much virtual memory is described |
---|
24 | by one section */ |
---|
25 | |
---|
26 | //static uint32_t pagetable[ARM_SECTIONS] __attribute__((aligned (1024*16))); |
---|
27 | |
---|
28 | BSP_START_DATA_SECTION static const arm_cp15_start_section_config |
---|
29 | beagle_mmu_config_table[] = { |
---|
30 | ARMV7_CP15_START_DEFAULT_SECTIONS, |
---|
31 | { |
---|
32 | .begin = 0x40000000U, |
---|
33 | .end = 0x4FFFFFFFU, |
---|
34 | .flags = ARMV7_MMU_DEVICE |
---|
35 | } |
---|
36 | }; |
---|
37 | |
---|
38 | /* |
---|
39 | * Make weak and let the user override. |
---|
40 | */ |
---|
41 | BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) __attribute__ ((weak)); |
---|
42 | |
---|
43 | BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) |
---|
44 | { |
---|
45 | /* turn mmu off first in case it's on */ |
---|
46 | uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache( |
---|
47 | ARM_CP15_CTRL_M | ARM_CP15_CTRL_A, /* clear - mmu off */ |
---|
48 | ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z |
---|
49 | ); |
---|
50 | |
---|
51 | arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache( |
---|
52 | ctrl, |
---|
53 | (uint32_t *) bsp_translation_table_base, |
---|
54 | ARM_MMU_DEFAULT_CLIENT_DOMAIN, |
---|
55 | &beagle_mmu_config_table[0], |
---|
56 | RTEMS_ARRAY_SIZE(beagle_mmu_config_table) |
---|
57 | ); |
---|
58 | } |
---|