source: rtems/c/src/lib/libbsp/arm/shared/arm-cp15-set-ttb-entries.c @ a91dc98b

4.115
Last change on this file since a91dc98b was 037e8ae5, checked in by Sebastian Huber <sebastian.huber@…>, on 05/02/13 at 15:42:20

bsps/arm: Add arm_cp15_set_trans*_table_entries()

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * Copyright (c) 2010-2013 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@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 <libcpu/arm-cp15.h>
16
17static uint32_t set_translation_table_entries(
18  const void *begin,
19  const void *end,
20  uint32_t section_flags
21)
22{
23  uint32_t cl_size = arm_cp15_get_min_cache_line_size();
24  uint32_t *ttb = arm_cp15_get_translation_table_base();
25  uint32_t i = ARM_MMU_SECT_GET_INDEX(begin);
26  uint32_t iend = ARM_MMU_SECT_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(end));
27  uint32_t ctrl;
28  uint32_t section_flags_of_first_entry;
29
30  ctrl = arm_cp15_mmu_disable(cl_size);
31  arm_cp15_tlb_invalidate();
32  section_flags_of_first_entry = ttb [i];
33
34  while (i < iend) {
35    uint32_t addr = i << ARM_MMU_SECT_BASE_SHIFT;
36
37    ttb [i] = addr | section_flags;
38
39    ++i;
40  }
41
42  arm_cp15_set_control(ctrl);
43
44  return section_flags_of_first_entry;
45}
46
47uint32_t arm_cp15_set_translation_table_entries(
48  const void *begin,
49  const void *end,
50  uint32_t section_flags
51)
52{
53  rtems_interrupt_level level;
54  uint32_t section_flags_of_first_entry;
55
56  rtems_interrupt_disable(level);
57  section_flags_of_first_entry =
58    set_translation_table_entries(begin, end, section_flags);
59  rtems_interrupt_enable(level);
60
61  return section_flags_of_first_entry;
62}
Note: See TracBrowser for help on using the repository browser.