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

4.115
Last change on this file since 936c8d6 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
RevLine 
[f140fdc]1/*
[037e8ae5]2 * Copyright (c) 2010-2013 embedded brains GmbH.  All rights reserved.
[f140fdc]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
[037e8ae5]15#include <libcpu/arm-cp15.h>
[f437107]16
[037e8ae5]17static uint32_t set_translation_table_entries(
[cfe13cb]18  const void *begin,
19  const void *end,
[f140fdc]20  uint32_t section_flags
21)
22{
[037e8ae5]23  uint32_t cl_size = arm_cp15_get_min_cache_line_size();
[f140fdc]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));
[037e8ae5]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];
[f140fdc]33
34  while (i < iend) {
[037e8ae5]35    uint32_t addr = i << ARM_MMU_SECT_BASE_SHIFT;
36
37    ttb [i] = addr | section_flags;
38
[f140fdc]39    ++i;
40  }
[f437107]41
[037e8ae5]42  arm_cp15_set_control(ctrl);
[f437107]43
44  return section_flags_of_first_entry;
45}
46
[037e8ae5]47uint32_t arm_cp15_set_translation_table_entries(
[f437107]48  const void *begin,
49  const void *end,
50  uint32_t section_flags
51)
52{
53  rtems_interrupt_level level;
[037e8ae5]54  uint32_t section_flags_of_first_entry;
[f437107]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;
[f140fdc]62}
Note: See TracBrowser for help on using the repository browser.