Changeset 8eb559d3 in rtems


Ignore:
Timestamp:
Apr 11, 2012, 8:34:01 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
0c9173d, 5eb434e
Parents:
2d0ca000
git-author:
Sebastian Huber <sebastian.huber@…> (04/11/12 08:34:01)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/11/12 09:24:41)
Message:

nios2: New functions

Add

o _Nios2_MPU_Get_region_descriptor(), and
o _Nios2_MPU_Set_region_registers().

Location:
cpukit/score/cpu/nios2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/nios2/nios2-mpu-descriptor.c

    r2d0ca000 r8eb559d3  
    107107  return ok;
    108108}
     109
     110bool _Nios2_MPU_Get_region_descriptor(
     111  const Nios2_MPU_Configuration *config,
     112  int index,
     113  bool data,
     114  Nios2_MPU_Region_descriptor *desc
     115)
     116{
     117  bool ok = _Nios2_MPU_Is_valid_index( config, index, data );
     118
     119  if ( ok ) {
     120    uint32_t mpubase;
     121    uint32_t mpuacc;
     122
     123    _Nios2_MPU_Get_region_registers( index, data, &mpubase, &mpuacc );
     124
     125    desc->index = index;
     126    desc->base = (void *) (mpubase & NIOS2_MPUBASE_BASE_MASK);
     127    if ( config->region_uses_limit ) {
     128      desc->end = (void *) (mpuacc & NIOS2_MPUACC_LIMIT_MASK);
     129    } else {
     130      desc->end = (void *) ((mpuacc & NIOS2_MPUACC_MASK_MASK) + 1);
     131    }
     132    desc->perm = (mpuacc & NIOS2_MPUACC_PERM_MASK) >> NIOS2_MPUACC_PERM_OFFSET;
     133    desc->data = data;
     134    desc->cacheable = (mpuacc & NIOS2_MPUACC_C) != 0;
     135    desc->read = (mpuacc & NIOS2_MPUACC_RD) != 0;
     136    desc->write = (mpuacc & NIOS2_MPUACC_WR) != 0;
     137  }
     138
     139  return ok;
     140}
  • cpukit/score/cpu/nios2/rtems/score/nios2-utility.h

    r2d0ca000 r8eb559d3  
    402402);
    403403
     404bool _Nios2_MPU_Get_region_descriptor(
     405  const Nios2_MPU_Configuration *config,
     406  int index,
     407  bool data,
     408  Nios2_MPU_Region_descriptor *desc
     409);
     410
    404411/**
    405412 * @brief Seaches the region table part for a disabled region.
     
    452459}
    453460
     461static inline void _Nios2_MPU_Set_region_registers(
     462  uint32_t mpubase,
     463  uint32_t mpuacc
     464)
     465{
     466  _Nios2_Set_ctlreg_mpubase( mpubase );
     467  _Nios2_Set_ctlreg_mpuacc( mpuacc );
     468  _Nios2_Flush_pipeline();
     469}
     470
    454471static inline void _Nios2_MPU_Enable( void )
    455472{
Note: See TracChangeset for help on using the changeset viewer.