Changeset 037e8ae5 in rtems


Ignore:
Timestamp:
May 2, 2013, 3:42:20 PM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
88cf23f
Parents:
544615d
git-author:
Sebastian Huber <sebastian.huber@…> (05/02/13 15:42:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/03/13 15:30:55)
Message:

bsps/arm: Add arm_cp15_set_trans*_table_entries()

Location:
c/src/lib
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/lpc32xx/Makefile.am

    r544615d r037e8ae5  
    9494libbsp_a_SOURCES += ../shared/abort/simple_abort.c
    9595libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
     96libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
    9697
    9798# Startup
     
    129130libbsp_a_SOURCES += misc/emc.c
    130131libbsp_a_SOURCES += misc/i2c.c
    131 libbsp_a_SOURCES += misc/mmu.c
    132132libbsp_a_SOURCES += misc/nand-mlc.c
    133133libbsp_a_SOURCES += misc/nand-mlc-erase-block-safe.c
  • c/src/lib/libbsp/arm/lpc32xx/include/mmu.h

    r544615d r037e8ae5  
    6262 * @return Previous section flags of the first modified entry.
    6363 */
    64 uint32_t lpc32xx_set_translation_table_entries(
     64static inline uint32_t lpc32xx_set_translation_table_entries(
    6565  const void *begin,
    6666  const void *end,
    6767  uint32_t section_flags
    68 );
     68)
     69{
     70  return arm_cp15_set_translation_table_entries(begin, end, section_flags);
     71}
    6972
    7073/** @} */
  • c/src/lib/libbsp/arm/shared/arm-cp15-set-ttb-entries.c

    r544615d r037e8ae5  
    1 /**
    2  * @file
    3  *
    4  * @ingroup lpc32xx_mmu
    5  *
    6  * @brief MMU support implementation.
    7  */
    8 
    91/*
    10  * Copyright (c) 2010-2011 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2010-2013 embedded brains GmbH.  All rights reserved.
    113 *
    124 *  embedded brains GmbH
     
    2113 */
    2214
    23 #include <bsp/mmu.h>
     15#include <libcpu/arm-cp15.h>
    2416
    25 static uint32_t disable_mmu(void)
    26 {
    27   uint32_t ctrl = 0;
    28 
    29   arm_cp15_data_cache_test_and_clean_and_invalidate();
    30 
    31   ctrl = arm_cp15_get_control();
    32   arm_cp15_set_control(ctrl & ~ARM_CP15_CTRL_M);
    33 
    34   arm_cp15_tlb_invalidate();
    35 
    36   return ctrl;
    37 }
    38 
    39 static void restore_mmu_control(uint32_t ctrl)
    40 {
    41   arm_cp15_set_control(ctrl);
    42 }
    43 
    44 uint32_t set_translation_table_entries(
     17static uint32_t set_translation_table_entries(
    4518  const void *begin,
    4619  const void *end,
     
    4821)
    4922{
     23  uint32_t cl_size = arm_cp15_get_min_cache_line_size();
    5024  uint32_t *ttb = arm_cp15_get_translation_table_base();
    5125  uint32_t i = ARM_MMU_SECT_GET_INDEX(begin);
    5226  uint32_t iend = ARM_MMU_SECT_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(end));
    53   uint32_t ctrl = disable_mmu();
    54   uint32_t section_flags_of_first_entry = ttb [i];
     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];
    5533
    5634  while (i < iend) {
    57     ttb [i] = (i << ARM_MMU_SECT_BASE_SHIFT) | section_flags;
     35    uint32_t addr = i << ARM_MMU_SECT_BASE_SHIFT;
     36
     37    ttb [i] = addr | section_flags;
     38
    5839    ++i;
    5940  }
    6041
    61   restore_mmu_control(ctrl);
     42  arm_cp15_set_control(ctrl);
    6243
    6344  return section_flags_of_first_entry;
    6445}
    6546
    66 uint32_t lpc32xx_set_translation_table_entries(
     47uint32_t arm_cp15_set_translation_table_entries(
    6748  const void *begin,
    6849  const void *end,
     
    7152{
    7253  rtems_interrupt_level level;
    73   uint32_t section_flags_of_first_entry = 0;
     54  uint32_t section_flags_of_first_entry;
    7455
    7556  rtems_interrupt_disable(level);
  • c/src/lib/libcpu/arm/shared/include/arm-cp15.h

    r544615d r037e8ae5  
    775775}
    776776
     777/**
     778 * @brief Sets the @a section_flags for the address range [@a begin, @a end).
     779 *
     780 * @return Previous section flags of the first modified entry.
     781 */
     782uint32_t arm_cp15_set_translation_table_entries(
     783  const void *begin,
     784  const void *end,
     785  uint32_t section_flags
     786);
     787
    777788/** @} */
    778789
Note: See TracChangeset for help on using the changeset viewer.