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
RevLine 
[a91dc98b]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>
[db42c079]18#include <bsp/arm-a9mpcore-start.h>
[a91dc98b]19#include <bsp/linker-symbols.h>
20
[db42c079]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
[a91dc98b]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,
[1dcf5fe]32    .flags = ARMV7_MMU_CODE_CACHED
[a91dc98b]33  }, {
34    .begin = (uint32_t) bsp_section_fast_data_begin,
35    .end = (uint32_t) bsp_section_fast_data_end,
[db42c079]36    .flags = MMU_DATA_READ_WRITE
[a91dc98b]37  }, {
38    .begin = (uint32_t) bsp_section_start_begin,
39    .end = (uint32_t) bsp_section_start_end,
[1dcf5fe]40    .flags = ARMV7_MMU_CODE_CACHED
[a91dc98b]41  }, {
42    .begin = (uint32_t) bsp_section_vector_begin,
43    .end = (uint32_t) bsp_section_vector_end,
[db42c079]44    .flags = MMU_DATA_READ_WRITE
[a91dc98b]45  }, {
46    .begin = (uint32_t) bsp_section_text_begin,
47    .end = (uint32_t) bsp_section_text_end,
[1dcf5fe]48    .flags = ARMV7_MMU_CODE_CACHED
[a91dc98b]49  }, {
50    .begin = (uint32_t) bsp_section_rodata_begin,
51    .end = (uint32_t) bsp_section_rodata_end,
[1dcf5fe]52    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
[a91dc98b]53  }, {
54    .begin = (uint32_t) bsp_section_data_begin,
55    .end = (uint32_t) bsp_section_data_end,
[db42c079]56    .flags = MMU_DATA_READ_WRITE
[a91dc98b]57  }, {
58    .begin = (uint32_t) bsp_section_bss_begin,
59    .end = (uint32_t) bsp_section_bss_end,
[db42c079]60    .flags = MMU_DATA_READ_WRITE
[a91dc98b]61  }, {
62    .begin = (uint32_t) bsp_section_work_begin,
63    .end = (uint32_t) bsp_section_work_end,
[db42c079]64    .flags = MMU_DATA_READ_WRITE
[a91dc98b]65  }, {
66    .begin = (uint32_t) bsp_section_stack_begin,
67    .end = (uint32_t) bsp_section_stack_end,
[db42c079]68    .flags = MMU_DATA_READ_WRITE
[a91dc98b]69  }, {
70    .begin = 0x10000000U,
71    .end = 0x10020000U,
[1dcf5fe]72    .flags = ARMV7_MMU_DEVICE
[a91dc98b]73  }, {
74    .begin = 0x1f000000U,
75    .end = 0x20000000U,
[1dcf5fe]76    .flags = ARMV7_MMU_DEVICE
[a91dc98b]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
[1df348b]87  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
[a91dc98b]88    ctrl,
89    (uint32_t *) bsp_translation_table_base,
[1dcf5fe]90    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
[a91dc98b]91    &rvpbxa9_mmu_config_table[0],
92    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
93  );
94}
95
[db42c079]96BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
97{
98  arm_a9mpcore_start_hook_0();
99}
100
[a91dc98b]101BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
102{
[9a037da9]103  arm_a9mpcore_start_hook_1();
[a91dc98b]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.