bsps/arm: Add arm_cp15_set_trans*_table_entries()

This commit is contained in:
Sebastian Huber
2013-05-02 17:42:20 +02:00
parent 544615d22c
commit 037e8ae506
4 changed files with 34 additions and 39 deletions

View File

@@ -93,6 +93,7 @@ libbsp_a_SOURCES += ../../shared/src/stackalloc.c
libbsp_a_SOURCES += ../../shared/src/uart-output-char.c
libbsp_a_SOURCES += ../shared/abort/simple_abort.c
libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
# Startup
libbsp_a_SOURCES += startup/bspreset.c
@@ -128,7 +129,6 @@ libbsp_a_SOURCES += ../../shared/tod.c \
libbsp_a_SOURCES += misc/boot.c
libbsp_a_SOURCES += misc/emc.c
libbsp_a_SOURCES += misc/i2c.c
libbsp_a_SOURCES += misc/mmu.c
libbsp_a_SOURCES += misc/nand-mlc.c
libbsp_a_SOURCES += misc/nand-mlc-erase-block-safe.c
libbsp_a_SOURCES += misc/nand-mlc-read-blocks.c

View File

@@ -61,11 +61,14 @@ extern "C" {
*
* @return Previous section flags of the first modified entry.
*/
uint32_t lpc32xx_set_translation_table_entries(
static inline uint32_t lpc32xx_set_translation_table_entries(
const void *begin,
const void *end,
uint32_t section_flags
);
)
{
return arm_cp15_set_translation_table_entries(begin, end, section_flags);
}
/** @} */

View File

@@ -1,13 +1,5 @@
/**
* @file
*
* @ingroup lpc32xx_mmu
*
* @brief MMU support implementation.
*/
/*
* Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved.
* Copyright (c) 2010-2013 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
@@ -20,57 +12,46 @@
* http://www.rtems.com/license/LICENSE.
*/
#include <bsp/mmu.h>
#include <libcpu/arm-cp15.h>
static uint32_t disable_mmu(void)
{
uint32_t ctrl = 0;
arm_cp15_data_cache_test_and_clean_and_invalidate();
ctrl = arm_cp15_get_control();
arm_cp15_set_control(ctrl & ~ARM_CP15_CTRL_M);
arm_cp15_tlb_invalidate();
return ctrl;
}
static void restore_mmu_control(uint32_t ctrl)
{
arm_cp15_set_control(ctrl);
}
uint32_t set_translation_table_entries(
static uint32_t set_translation_table_entries(
const void *begin,
const void *end,
uint32_t section_flags
)
{
uint32_t cl_size = arm_cp15_get_min_cache_line_size();
uint32_t *ttb = arm_cp15_get_translation_table_base();
uint32_t i = ARM_MMU_SECT_GET_INDEX(begin);
uint32_t iend = ARM_MMU_SECT_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(end));
uint32_t ctrl = disable_mmu();
uint32_t section_flags_of_first_entry = ttb [i];
uint32_t ctrl;
uint32_t section_flags_of_first_entry;
ctrl = arm_cp15_mmu_disable(cl_size);
arm_cp15_tlb_invalidate();
section_flags_of_first_entry = ttb [i];
while (i < iend) {
ttb [i] = (i << ARM_MMU_SECT_BASE_SHIFT) | section_flags;
uint32_t addr = i << ARM_MMU_SECT_BASE_SHIFT;
ttb [i] = addr | section_flags;
++i;
}
restore_mmu_control(ctrl);
arm_cp15_set_control(ctrl);
return section_flags_of_first_entry;
}
uint32_t lpc32xx_set_translation_table_entries(
uint32_t arm_cp15_set_translation_table_entries(
const void *begin,
const void *end,
uint32_t section_flags
)
{
rtems_interrupt_level level;
uint32_t section_flags_of_first_entry = 0;
uint32_t section_flags_of_first_entry;
rtems_interrupt_disable(level);
section_flags_of_first_entry =

View File

@@ -774,6 +774,17 @@ static inline void arm_cp15_wait_for_interrupt(void)
);
}
/**
* @brief Sets the @a section_flags for the address range [@a begin, @a end).
*
* @return Previous section flags of the first modified entry.
*/
uint32_t arm_cp15_set_translation_table_entries(
const void *begin,
const void *end,
uint32_t section_flags
);
/** @} */
#ifdef __cplusplus