source: rtems/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c @ 1df348b

4.115
Last change on this file since 1df348b was 1df348b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/24/13 at 09:00:36

bsps/arm: Rename function

Rename arm_cp15_start_setup_translation_table_and_enable_mmu()
in arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache()
to emphasize that the cache is also enabled after this operation.

  • Property mode set to 100644
File size: 2.9 KB
Line 
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 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15#include <bsp.h>
16#include <bsp/start.h>
17#include <bsp/arm-cp15-start.h>
18#include <bsp/arm-a9mpcore-start.h>
19#include <bsp/linker-symbols.h>
20
21#ifdef RTEMS_SMP
22  #define MMU_DATA_READ_WRITE ARMV7_MMU_DATA_READ_WRITE_SHAREABLE
23#else
24  #define MMU_DATA_READ_WRITE ARMV7_MMU_DATA_READ_WRITE_CACHED
25#endif
26
27BSP_START_DATA_SECTION static const arm_cp15_start_section_config
28rvpbxa9_mmu_config_table[] = {
29  {
30    .begin = (uint32_t) bsp_section_fast_text_begin,
31    .end = (uint32_t) bsp_section_fast_text_end,
32    .flags = ARMV7_MMU_CODE_CACHED
33  }, {
34    .begin = (uint32_t) bsp_section_fast_data_begin,
35    .end = (uint32_t) bsp_section_fast_data_end,
36    .flags = MMU_DATA_READ_WRITE
37  }, {
38    .begin = (uint32_t) bsp_section_start_begin,
39    .end = (uint32_t) bsp_section_start_end,
40    .flags = ARMV7_MMU_CODE_CACHED
41  }, {
42    .begin = (uint32_t) bsp_section_vector_begin,
43    .end = (uint32_t) bsp_section_vector_end,
44    .flags = MMU_DATA_READ_WRITE
45  }, {
46    .begin = (uint32_t) bsp_section_text_begin,
47    .end = (uint32_t) bsp_section_text_end,
48    .flags = ARMV7_MMU_CODE_CACHED
49  }, {
50    .begin = (uint32_t) bsp_section_rodata_begin,
51    .end = (uint32_t) bsp_section_rodata_end,
52    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
53  }, {
54    .begin = (uint32_t) bsp_section_data_begin,
55    .end = (uint32_t) bsp_section_data_end,
56    .flags = MMU_DATA_READ_WRITE
57  }, {
58    .begin = (uint32_t) bsp_section_bss_begin,
59    .end = (uint32_t) bsp_section_bss_end,
60    .flags = MMU_DATA_READ_WRITE
61  }, {
62    .begin = (uint32_t) bsp_section_work_begin,
63    .end = (uint32_t) bsp_section_work_end,
64    .flags = MMU_DATA_READ_WRITE
65  }, {
66    .begin = (uint32_t) bsp_section_stack_begin,
67    .end = (uint32_t) bsp_section_stack_end,
68    .flags = MMU_DATA_READ_WRITE
69  }, {
70    .begin = 0x10000000U,
71    .end = 0x10020000U,
72    .flags = ARMV7_MMU_DEVICE
73  }, {
74    .begin = 0x1f000000U,
75    .end = 0x20000000U,
76    .flags = ARMV7_MMU_DEVICE
77  }
78};
79
80BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
81{
82  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
83    0,
84    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
85  );
86
87  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
88    ctrl,
89    (uint32_t *) bsp_translation_table_base,
90    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
91    &rvpbxa9_mmu_config_table[0],
92    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
93  );
94}
95
96BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
97{
98  arm_a9mpcore_start_hook_0();
99}
100
101BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
102{
103  arm_a9mpcore_start_hook_1();
104  bsp_start_copy_sections();
105  setup_mmu_and_cache();
106  bsp_start_clear_bss();
107}
Note: See TracBrowser for help on using the repository browser.