module ti.sysbios.family.c64p.MemoryProtect

MemoryProtect Module

This module provide an API to get and to set the permission attributes of a memory range. A memory range can be set to user executable, user writable, user readable, supervisor executable, supervisor writable, or supervisor readable. Setting a memory range to only user readable, writable or executable should be done with caution because BIOS executes in supervisor mode. Whenever setting the permission attributes of a memory range, the local CPU access field must be set, if the local CPU accesses the memory range. If the local field is not set, an exception is generated if the CPU tries to access the memory range. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/c64p/MemoryProtect.xdc
#include <ti/sysbios/family/c64p/MemoryProtect.h>
Functions
Bool 
Bool 
Bool 
Functions common to all target modules
Defines
#define
#define
#define
#define
#define
#define
#define
#define
Typedefs
typedef enum
 
DETAILS
This module provide an API to get and to set the permission attributes of a memory range. A memory range can be set to user executable, user writable, user readable, supervisor executable, supervisor writable, or supervisor readable. Setting a memory range to only user readable, writable or executable should be done with caution because BIOS executes in supervisor mode. Whenever setting the permission attributes of a memory range, the local CPU access field must be set, if the local CPU accesses the memory range. If the local field is not set, an exception is generated if the CPU tries to access the memory range.
This module is to be used in correlation with the Exception module. When this module is in use, external exceptions are enabled by default. Any memory protection fault which arises generates an exception. This exception is processed and decoded by the Exception module.
An example of setting Local L2 RAM to be supervisor read-only and CPU accessible:
    UInt32 paMask;
    paMask = MemoryProtect_MPPA_LOCAL |
             MemoryProtect_MPPA_SR;
              
    MemoryProtect_setPA((Ptr)0x11800000, 0x40000, paMask);

Calling Context

Function Hwi Swi Task Main Startup
getPA Y Y Y Y Y
setPA Y Y Y Y Y
Definitions:
  • Hwi: API is callable from a Hwi thread.
  • Swi: API is callable from a Swi thread.
  • Task: API is callable from a Task thread.
  • Main: API is callable during any of these phases:
    • In your module startup after this module is started (e.g. Mod_Module_startupDone() returns TRUE).
    • During xdc.runtime.Startup.lastFxns.
    • During main().
    • During BIOS.startupFxns.
  • Startup: API is callable during any of these phases:
    • During xdc.runtime.Startup.firstFxns.
    • In your module startup before this module is started (e.g. Mod_Module_startupDone() returns FALSE).
 
const MemoryProtect_MPPA_LOCAL

Local CPU may access

C synopsis target-domain
#define MemoryProtect_MPPA_LOCAL (UInt32)0x00000100
 
 
const MemoryProtect_MPPA_SR

Supervisor mode read

C synopsis target-domain
#define MemoryProtect_MPPA_SR (UInt32)0x00000020
 
 
const MemoryProtect_MPPA_SW

Supervisor mode may write

C synopsis target-domain
#define MemoryProtect_MPPA_SW (UInt32)0x00000010
 
 
const MemoryProtect_MPPA_SX

Supervisor mode may execute

C synopsis target-domain
#define MemoryProtect_MPPA_SX (UInt32)0x00000008
 
 
const MemoryProtect_MPPA_UR

User mode may read

C synopsis target-domain
#define MemoryProtect_MPPA_UR (UInt32)0x00000004
 
 
const MemoryProtect_MPPA_UW

User mode may write

C synopsis target-domain
#define MemoryProtect_MPPA_UW (UInt32)0x00000002
 
 
const MemoryProtect_MPPA_UX

User mode may execute

C synopsis target-domain
#define MemoryProtect_MPPA_UX (UInt32)0x00000001
 
 
const MemoryProtect_numXMCRegions
C synopsis target-domain
#define MemoryProtect_numXMCRegions (UInt)16
 
 
enum MemoryProtect_RegionSize
C synopsis target-domain
typedef enum MemoryProtect_RegionSize {
    MemoryProtect_RegionSize_4K,
    MemoryProtect_RegionSize_8K,
    MemoryProtect_RegionSize_16K,
    MemoryProtect_RegionSize_32K,
    MemoryProtect_RegionSize_64K,
    MemoryProtect_RegionSize_128K,
    MemoryProtect_RegionSize_256K,
    MemoryProtect_RegionSize_512K,
    MemoryProtect_RegionSize_1M,
    MemoryProtect_RegionSize_2M,
    MemoryProtect_RegionSize_4M,
    MemoryProtect_RegionSize_8M,
    MemoryProtect_RegionSize_16M,
    MemoryProtect_RegionSize_32M,
    MemoryProtect_RegionSize_64M,
    MemoryProtect_RegionSize_128M,
    MemoryProtect_RegionSize_256M,
    MemoryProtect_RegionSize_512M,
    MemoryProtect_RegionSize_1G,
    MemoryProtect_RegionSize_2G,
    MemoryProtect_RegionSize_4G
} MemoryProtect_RegionSize;
 
 
MemoryProtect_getPA()  // module-wide

Gets the PA (Permission Attribute) corresponding to addr

C synopsis target-domain
Bool MemoryProtect_getPA(Ptr addr, UInt32 *paMask);
 
ARGUMENTS
addr — address of memory location for which the PA applies
paMask — ptr to location where PA mask for addr is stored
RETURNS
if address doesn't belong to any configured MPC then FALSE, otherwise TRUE and *paMask contains addr's MPPA setting
 
MemoryProtect_setPA()  // module-wide

Sets the PA (Permission Attribute) corresponding to addr/size

C synopsis target-domain
Bool MemoryProtect_setPA(Ptr addr, SizeT size, UInt32 paMask);
 
ARGUMENTS
addr — begin address of memory block for which the PA applies
size — size of memory block
paMask — PA mask to assign for the memory block
RETURNS
if address doesn't belong to any configured MPC then FALSE, otherwise TRUE and PA was written to addr's MPPA register
DETAILS
The PA is applied to all addresses that are spanned by the memory block.
 
MemoryProtect_setXMCRegion()  // module-wide

Set XMC region mapping and permission attributes

C synopsis target-domain
Bool MemoryProtect_setXMCRegion(Int8 id, Ptr baseAddr, MemoryProtect_RegionSize size, Ptr rAddr35_12, UInt32 paMask);
 
ARGUMENTS
regionId — XMC region (segment) number
baseAddr — XMC region logical address
size — XMC region size
rAddr35_12 — XMC region translated/extended address bits 35:12
paMask — XMC region permission bits
RETURNS
if baseAddr < 0x0C000000 or regionId >= numXMCRegions then FALSE, othersize TRUE and the region is mapped with permission attributes paMask.
DETAILS
The C66 CorePac XMC (eXtended Memory Controller) controls access to L2 SRAM. It contains 16 MPAX registers that define memory translations and address extensions along with their associated permission attributes. Regions can overlap one another, with higher numbered regions taking priority over lower ones. Regions 0 & 1 are automatically populated by XMC with power up configuratoin values which map the entire 4GB logical address space to the corresponding physical address space. These region mappings allow safe fallback handling for addresses that are not otherwise mapped in higher MPAX registers.
Addresses < 0x0C000000 do not reach the XMC, so baseAddr should be greater than or equal to 0x0C000000.
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId MemoryProtect_Module_id();
// Get this module's unique id
 
Bool MemoryProtect_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle MemoryProtect_Module_heap();
// The heap from which this module allocates memory
 
Bool MemoryProtect_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 MemoryProtect_Module_getMask();
// Returns the diagnostics mask for this module
 
Void MemoryProtect_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
Configuration settings sourced in ti/sysbios/family/c64p/MemoryProtect.xdc
var MemoryProtect = xdc.useModule('ti.sysbios.family.c64p.MemoryProtect');
module-wide constants & types
    const MemoryProtect.MPPA_SR// Supervisor mode read = 0x00000020;
    const MemoryProtect.MPPA_UR// User mode may read = 0x00000004;
    const MemoryProtect.MPPA_UW// User mode may write = 0x00000002;
    const MemoryProtect.numXMCRegions//  = 16;
 
    values of type MemoryProtect.RegionSize// 
        const MemoryProtect.RegionSize_4K;
        const MemoryProtect.RegionSize_8K;
        const MemoryProtect.RegionSize_16K;
        const MemoryProtect.RegionSize_32K;
        const MemoryProtect.RegionSize_64K;
        const MemoryProtect.RegionSize_128K;
        const MemoryProtect.RegionSize_256K;
        const MemoryProtect.RegionSize_512K;
        const MemoryProtect.RegionSize_1M;
        const MemoryProtect.RegionSize_2M;
        const MemoryProtect.RegionSize_4M;
        const MemoryProtect.RegionSize_8M;
        const MemoryProtect.RegionSize_16M;
        const MemoryProtect.RegionSize_32M;
        const MemoryProtect.RegionSize_64M;
        const MemoryProtect.RegionSize_128M;
        const MemoryProtect.RegionSize_256M;
        const MemoryProtect.RegionSize_512M;
        const MemoryProtect.RegionSize_1G;
        const MemoryProtect.RegionSize_2G;
        const MemoryProtect.RegionSize_4G;
module-wide config parameters
 
 
const MemoryProtect.MPPA_LOCAL

Local CPU may access

Configuration settings
const MemoryProtect.MPPA_LOCAL = 0x00000100;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_SR

Supervisor mode read

Configuration settings
const MemoryProtect.MPPA_SR = 0x00000020;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_SW

Supervisor mode may write

Configuration settings
const MemoryProtect.MPPA_SW = 0x00000010;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_SX

Supervisor mode may execute

Configuration settings
const MemoryProtect.MPPA_SX = 0x00000008;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_UR

User mode may read

Configuration settings
const MemoryProtect.MPPA_UR = 0x00000004;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_UW

User mode may write

Configuration settings
const MemoryProtect.MPPA_UW = 0x00000002;
 
C SYNOPSIS
 
const MemoryProtect.MPPA_UX

User mode may execute

Configuration settings
const MemoryProtect.MPPA_UX = 0x00000001;
 
C SYNOPSIS
 
const MemoryProtect.numXMCRegions
Configuration settings
const MemoryProtect.numXMCRegions = 16;
 
C SYNOPSIS
 
enum MemoryProtect.RegionSize
Configuration settings
values of type MemoryProtect.RegionSize
    const MemoryProtect.RegionSize_4K;
    const MemoryProtect.RegionSize_8K;
    const MemoryProtect.RegionSize_16K;
    const MemoryProtect.RegionSize_32K;
    const MemoryProtect.RegionSize_64K;
    const MemoryProtect.RegionSize_128K;
    const MemoryProtect.RegionSize_256K;
    const MemoryProtect.RegionSize_512K;
    const MemoryProtect.RegionSize_1M;
    const MemoryProtect.RegionSize_2M;
    const MemoryProtect.RegionSize_4M;
    const MemoryProtect.RegionSize_8M;
    const MemoryProtect.RegionSize_16M;
    const MemoryProtect.RegionSize_32M;
    const MemoryProtect.RegionSize_64M;
    const MemoryProtect.RegionSize_128M;
    const MemoryProtect.RegionSize_256M;
    const MemoryProtect.RegionSize_512M;
    const MemoryProtect.RegionSize_1G;
    const MemoryProtect.RegionSize_2G;
    const MemoryProtect.RegionSize_4G;
 
C SYNOPSIS
 
metaonly config MemoryProtect.common$  // module-wide

Common module configuration parameters

Configuration settings
MemoryProtect.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
generated on Thu, 23 May 2019 00:22:26 GMT