module ti.sdo.ipc.SharedRegion

Shared memory manager and address translator

This module has a common header that can be found in the ti.ipc package. Application code should include the common header file (not the RTSC-generated one):
#include <ti/ipc/SharedRegion.h>
The RTSC module must be used in the application's RTSC configuration file (.cfg) if runtime APIs will be used in the application:
SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
Documentation for all runtime APIs, instance configuration parameters, error codes macros and type definitions available to the application integrator can be found in the Doxygen documenation for the IPC product. However, the documentation presented on this page should be referred to for information specific to the RTSC module, such as module configuration, Errors, and Asserts. [ more ... ]
C synopsis target-domain sourced in ti/sdo/ipc/SharedRegion.xdc
#include <ti/sdo/ipc/SharedRegion.h>
Functions common to all target modules
Defines
#define
#define
Typedefs
typedef struct
typedef Bits32 
Constants
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const SizeT 
extern const UInt16 
extern const Bool 
 
DETAILS
This module has a common header that can be found in the ti.ipc package. Application code should include the common header file (not the RTSC-generated one):
#include <ti/ipc/SharedRegion.h>
The RTSC module must be used in the application's RTSC configuration file (.cfg) if runtime APIs will be used in the application:
SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
Documentation for all runtime APIs, instance configuration parameters, error codes macros and type definitions available to the application integrator can be found in the Doxygen documenation for the IPC product. However, the documentation presented on this page should be referred to for information specific to the RTSC module, such as module configuration, Errors, and Asserts.
The SharedRegion module is designed to be used in a multi-processor environment in which memory regions are shared and accessed across different processors. The module itself does not use any shared memory, because all module state is stored locally. SharedRegion APIs use the system gate for thread protection.
This module creates and stores a local shared memory region table. The table contains the processor's view for every shared region in the system. The table must not contain any overlapping regions. Each processor's view of a particular shared memory region is determined by the region id. In cases where a processor cannot access a certain shared memory region, that shared memory region should be left invalid for that processor. Note: The numEntries must be the same on all processors.
Each shared region contains the following:
  • base: The base address
  • len: The length
  • name: The name of the region
  • isValid: Whether the region is valid
  • ownerProcId: The id of the processor which owns the region
  • cacheEnable: Whether the region is cacheable
  • cacheLineSize: The cache line size
  • createHeap: Whether a heap is created for the region.
A region is added statically using the setEntryMeta API. The length of a region must be the same across all processors. The owner of the region can be specified. If specified, the owner manages the shared region. It creates a HeapMemMP instance which spans the full size of the region. The other processors open the same HeapMemMP instance.
Note: Prior to calling Ipc_start(), If a SharedRegion's 'isValid' is true and 'createHeap' is true then the owner of the SharedRegion must be the same as the owner of SharedRegion 0.
An example of a SharedRegion configuration is as follows:
 var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
 SharedRegion.setEntryMeta(0,
     { base: 0x80000000,
       len: 0x20000,
       ownerProcId: 0,
       isValid: true,
       cacheLineSize: 64,
       name: "DDR2",
     });

The shared region table along with a shared region pointer (SRPtr) is used to do address translation at runtime. The shared region pointer is a 32-bit portable pointer composed of an id and offset. The most significant bits of a SRPtr are used for the id. The id corresponds to the index of the entry in the table. The offset is the offset from the base of the shared memory region. The number of entries in the table determines the number of bits to use for the id. Increasing the number of entries increases the range of ids but decreases the range of the offset.
Note: Region 0 must be visible by all processors. Region 0 is used for synchonizing the processors, creating the default GateMP, and creating Notify and MessageQ transport instances. The HeapMemMP created in Region 0 is the length of the region minus memory reserved for creating these internal instances.
Refer to the doxygen documentation for run-time API documenation.
 
const SharedRegion_DEFAULTOWNERID

Specifies the default owner proc id

C synopsis target-domain
#define SharedRegion_DEFAULTOWNERID (UInt16)~0
 
 
const SharedRegion_INVALIDREGIONID

Specifies the invalid id

C synopsis target-domain
#define SharedRegion_INVALIDREGIONID (UInt16)0xFFFF
 
 
typedef SharedRegion_SRPtr

Definition of shared region pointer type

C synopsis target-domain
typedef Bits32 SharedRegion_SRPtr;
 
 
struct SharedRegion_Entry

Structure for specifying a region

C synopsis target-domain
typedef struct SharedRegion_Entry {
    Ptr base;
    SizeT len;
    UInt16 ownerProcId;
    Bool isValid;
    Bool cacheEnable;
    SizeT cacheLineSize;
    Bool createHeap;
    String name;
} SharedRegion_Entry;
 
FIELDS
base — The base address.
len — The length.
ownerProcId — MultiProc id of processor that manages region.
isValid — Whether the region is valid or not.
cacheEnable — Whether the region is cacheable.
cacheLineSize — The cache line size for the region.
createHeap — Whether a heap is created for the region.
name — The name associated with the region.
DETAILS
Each region entry should not overlap with any other entry. The length of a region should be the same across all processors.
During static configuration, the 'isValid' field can be set to 'false' to signify a partially completed entry. This should only be done if the base address of the entry is not known during static configuration. The entry can be completed and the 'isValid' field can be set to true at runtime.
 
config SharedRegion_A_addrOutOfRange  // module-wide

Assert raised when an address is out of the range of the region id

C synopsis target-domain
extern const Assert_Id SharedRegion_A_addrOutOfRange;
 
 
config SharedRegion_A_alreadyExists  // module-wide

Assert raised when a valid table entry already exists

C synopsis target-domain
extern const Assert_Id SharedRegion_A_alreadyExists;
 
 
config SharedRegion_A_cacheLineSizeIsZero  // module-wide

Assert raised when cache enabled but cache line size = 0

C synopsis target-domain
extern const Assert_Id SharedRegion_A_cacheLineSizeIsZero;
 
 
config SharedRegion_A_idTooLarge  // module-wide

Assert raised when the id is larger than numEntries

C synopsis target-domain
extern const Assert_Id SharedRegion_A_idTooLarge;
 
 
config SharedRegion_A_noHeap  // module-wide

Assert raised when trying to use a heap for a region that has no heap

C synopsis target-domain
extern const Assert_Id SharedRegion_A_noHeap;
 
 
config SharedRegion_A_overlap  // module-wide

Assert raised when a new entry overlaps an existing one

C synopsis target-domain
extern const Assert_Id SharedRegion_A_overlap;
 
 
config SharedRegion_A_region0Clear  // module-wide

Assert raised when attempting to clear region 0

C synopsis target-domain
extern const Assert_Id SharedRegion_A_region0Clear;
 
 
config SharedRegion_A_region0Invalid  // module-wide

Assert raised when region zero is invalid

C synopsis target-domain
extern const Assert_Id SharedRegion_A_region0Invalid;
 
 
config SharedRegion_A_regionInvalid  // module-wide

Assert raised when region is invalid

C synopsis target-domain
extern const Assert_Id SharedRegion_A_regionInvalid;
 
 
config SharedRegion_A_reserveTooMuch  // module-wide

Assert raised when the trying to reserve too much memory

C synopsis target-domain
extern const Assert_Id SharedRegion_A_reserveTooMuch;
 
 
config SharedRegion_cacheLineSize  // module-wide

Worst-case cache line size

C synopsis target-domain
extern const SizeT SharedRegion_cacheLineSize;
 
DETAILS
This is the default system cache line size for all modules. When a module puts structures in shared memory, this value is used to make sure items are aligned on a cache line boundary. If no cacheLineSize is specified for a region, it will use this value.
 
config SharedRegion_numEntries  // module-wide

The number of shared region table entries

C synopsis target-domain
extern const UInt16 SharedRegion_numEntries;
 
DETAILS
This value is used for calculating the number of bits for the offset. Note: This value must be the same across all processors in the system. Increasing this parameter will increase the footprint and the time for translating a pointer to a SRPtr.
 
config SharedRegion_translate  // module-wide

Determines whether address translation is required

C synopsis target-domain
extern const Bool SharedRegion_translate;
 
DETAILS
This configuration parameter should be set to 'false' if and only if all shared memory regions have the same base address for all processors. If 'false', it results in a fast getPtr and getSRPtr, because a SRPtr is equivalent to a Ptr and no translation is done.
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId SharedRegion_Module_id();
// Get this module's unique id
 
Bool SharedRegion_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle SharedRegion_Module_heap();
// The heap from which this module allocates memory
 
Bool SharedRegion_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 SharedRegion_Module_getMask();
// Returns the diagnostics mask for this module
 
Void SharedRegion_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
XDCscript usage meta-domain sourced in ti/sdo/ipc/SharedRegion.xdc
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
module-wide constants & types
 
        obj.base = Ptr  ...
        obj.len = SizeT  ...
        obj.ownerProcId = UInt16  ...
        obj.isValid = Bool  ...
        obj.cacheEnable = Bool  ...
        obj.cacheLineSize = SizeT  ...
        obj.createHeap = Bool  ...
        obj.name = String  ...
module-wide config parameters
        msg: "A_addrOutOfRange: Address is out of region id's range"
    };
        msg: "A_alreadyExists: Trying to overwrite an existing valid entry"
    };
        msg: "A_cacheLineSizeIsZero: cache line size cannot be zero"
    };
        msg: "A_idTooLarge: id cannot be larger than numEntries"
    };
        msg: "A_noHeap: Region has no heap"
    };
        msg: "A_overlap: Shared region overlaps"
    };
        msg: "A_region0Clear: Region 0 cannot be cleared"
    };
        msg: "A_region0Invalid: Region zero is invalid"
    };
        msg: "A_regionInvalid: Region is invalid"
    };
        msg: "A_reserveTooMuch: Trying to reserve too much memory"
    };
 
module-wide functions
 
 
const SharedRegion.DEFAULTOWNERID

Specifies the default owner proc id

XDCscript usage meta-domain
const SharedRegion.DEFAULTOWNERID = ~0;
 
C SYNOPSIS
 
const SharedRegion.INVALIDREGIONID

Specifies the invalid id

XDCscript usage meta-domain
const SharedRegion.INVALIDREGIONID = 0xFFFF;
 
C SYNOPSIS
 
struct SharedRegion.Entry

Structure for specifying a region

XDCscript usage meta-domain
var obj = new SharedRegion.Entry;
 
    obj.base = Ptr  ...
    obj.len = SizeT  ...
    obj.ownerProcId = UInt16  ...
    obj.isValid = Bool  ...
    obj.cacheEnable = Bool  ...
    obj.cacheLineSize = SizeT  ...
    obj.createHeap = Bool  ...
    obj.name = String  ...
 
FIELDS
base — The base address.
len — The length.
ownerProcId — MultiProc id of processor that manages region.
isValid — Whether the region is valid or not.
cacheEnable — Whether the region is cacheable.
cacheLineSize — The cache line size for the region.
createHeap — Whether a heap is created for the region.
name — The name associated with the region.
DETAILS
Each region entry should not overlap with any other entry. The length of a region should be the same across all processors.
During static configuration, the 'isValid' field can be set to 'false' to signify a partially completed entry. This should only be done if the base address of the entry is not known during static configuration. The entry can be completed and the 'isValid' field can be set to true at runtime.
C SYNOPSIS
 
config SharedRegion.A_addrOutOfRange  // module-wide

Assert raised when an address is out of the range of the region id

XDCscript usage meta-domain
SharedRegion.A_addrOutOfRange = Assert.Desc {
    msg: "A_addrOutOfRange: Address is out of region id's range"
};
 
C SYNOPSIS
 
config SharedRegion.A_alreadyExists  // module-wide

Assert raised when a valid table entry already exists

XDCscript usage meta-domain
SharedRegion.A_alreadyExists = Assert.Desc {
    msg: "A_alreadyExists: Trying to overwrite an existing valid entry"
};
 
C SYNOPSIS
 
config SharedRegion.A_cacheLineSizeIsZero  // module-wide

Assert raised when cache enabled but cache line size = 0

XDCscript usage meta-domain
SharedRegion.A_cacheLineSizeIsZero = Assert.Desc {
    msg: "A_cacheLineSizeIsZero: cache line size cannot be zero"
};
 
C SYNOPSIS
 
config SharedRegion.A_idTooLarge  // module-wide

Assert raised when the id is larger than numEntries

XDCscript usage meta-domain
SharedRegion.A_idTooLarge = Assert.Desc {
    msg: "A_idTooLarge: id cannot be larger than numEntries"
};
 
C SYNOPSIS
 
config SharedRegion.A_noHeap  // module-wide

Assert raised when trying to use a heap for a region that has no heap

XDCscript usage meta-domain
SharedRegion.A_noHeap = Assert.Desc {
    msg: "A_noHeap: Region has no heap"
};
 
C SYNOPSIS
 
config SharedRegion.A_overlap  // module-wide

Assert raised when a new entry overlaps an existing one

XDCscript usage meta-domain
SharedRegion.A_overlap = Assert.Desc {
    msg: "A_overlap: Shared region overlaps"
};
 
C SYNOPSIS
 
config SharedRegion.A_region0Clear  // module-wide

Assert raised when attempting to clear region 0

XDCscript usage meta-domain
SharedRegion.A_region0Clear = Assert.Desc {
    msg: "A_region0Clear: Region 0 cannot be cleared"
};
 
C SYNOPSIS
 
config SharedRegion.A_region0Invalid  // module-wide

Assert raised when region zero is invalid

XDCscript usage meta-domain
SharedRegion.A_region0Invalid = Assert.Desc {
    msg: "A_region0Invalid: Region zero is invalid"
};
 
C SYNOPSIS
 
config SharedRegion.A_regionInvalid  // module-wide

Assert raised when region is invalid

XDCscript usage meta-domain
SharedRegion.A_regionInvalid = Assert.Desc {
    msg: "A_regionInvalid: Region is invalid"
};
 
C SYNOPSIS
 
config SharedRegion.A_reserveTooMuch  // module-wide

Assert raised when the trying to reserve too much memory

XDCscript usage meta-domain
SharedRegion.A_reserveTooMuch = Assert.Desc {
    msg: "A_reserveTooMuch: Trying to reserve too much memory"
};
 
C SYNOPSIS
 
config SharedRegion.cacheLineSize  // module-wide

Worst-case cache line size

XDCscript usage meta-domain
SharedRegion.cacheLineSize = SizeT 128;
 
DETAILS
This is the default system cache line size for all modules. When a module puts structures in shared memory, this value is used to make sure items are aligned on a cache line boundary. If no cacheLineSize is specified for a region, it will use this value.
C SYNOPSIS
 
config SharedRegion.numEntries  // module-wide

The number of shared region table entries

XDCscript usage meta-domain
SharedRegion.numEntries = UInt16 4;
 
DETAILS
This value is used for calculating the number of bits for the offset. Note: This value must be the same across all processors in the system. Increasing this parameter will increase the footprint and the time for translating a pointer to a SRPtr.
C SYNOPSIS
 
config SharedRegion.translate  // module-wide

Determines whether address translation is required

XDCscript usage meta-domain
SharedRegion.translate = Bool true;
 
DETAILS
This configuration parameter should be set to 'false' if and only if all shared memory regions have the same base address for all processors. If 'false', it results in a fast getPtr and getSRPtr, because a SRPtr is equivalent to a Ptr and no translation is done.
C SYNOPSIS
 
metaonly config SharedRegion.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
SharedRegion.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.
 
metaonly SharedRegion.getCacheLineSizeMeta()  // module-wide

Meta version of Ipc_getCacheLineSize

XDCscript usage meta-domain
SharedRegion.getCacheLineSizeMeta(UInt16 id) returns SizeT
 
 
metaonly SharedRegion.setEntryMeta()  // module-wide

Sets the entry at the specified region id in the shared region table

XDCscript usage meta-domain
SharedRegion.setEntryMeta(UInt16 id, SharedRegion.Entry entry) returns Void
 
ARGUMENTS
id — Region id.
entry — Entry fields about the region.
DETAILS
The required parameters are base and len. All the other fields will get their default if not specified.
generated on Sat, 11 Feb 2012 00:38:10 GMT