Region based Address Translate
Features Supported
APIs to setup region based address translation using RAT HW on supported SOCs
APIs to translate 48b SOC view system addr to 32b local CPU view address.
When no address mapping is specified, no translation is done.
Features NOT Supported
NA
Important Usage Guidelines
The translation API
AddrTranslateP_getLocalAddris meant to be used to translate SOC specified peripheral MMR base addresses to local CPU accesible addresses, within device drivers. The API internally searches through a small array to find the address translations, hence to be efficient, this API should typically be called once during driver init to find the local address that CPU should use.
Errata i2449 - RAT MMR Parity Workaround (R5F only)
Values stored in Pulsar RAT MMRs are not parity protected in hardware. A bit flip in a RAT MMR would not be detected, allowing an unnoticed address translation corruption. This affects both transient (soft) and permanent (hard) errors.
Workaround
The software workaround is to periodically read back the RAT MMR values and compare them against the intended configuration. The SDK implements this via AddrTranslateP_readbackVerify.
Automatic check at init: AddrTranslateP_readbackVerify is called automatically at the end of AddrTranslateP_init as a post-write check, confirming the initial register writes succeeded.
Periodic runtime check: Applications requiring functional safety must call AddrTranslateP_readbackVerify periodically at runtime (for example from a periodic timer task or watchdog service routine) to detect any bit flip that occurs after initialization.
/* Example: call from a 1ms periodic safety task */
int32_t status = AddrTranslateP_readbackVerify();
if(status != SystemP_SUCCESS)
{
/* RAT MMR mismatch detected - handle the error */
}
This module is not normally required on R5F CPUs since all peripherals are typically mapped within the 32b address space of R5F.
Example Usage
Include the below file to access the APIs,
Example to translate a system address to local CPU address:
API Reference
Defines
-
AddrTranslateP_MAX_REGIONS
Maximum regions in the address translate module.
Enums
-
enum AddrTranslateP_RegionSize
Enum’s to represent different possible region size for the address translate module.
Values:
-
enumerator AddrTranslateP_RegionSize_1
-
enumerator AddrTranslateP_RegionSize_2
-
enumerator AddrTranslateP_RegionSize_4
-
enumerator AddrTranslateP_RegionSize_8
-
enumerator AddrTranslateP_RegionSize_16
-
enumerator AddrTranslateP_RegionSize_32
-
enumerator AddrTranslateP_RegionSize_64
-
enumerator AddrTranslateP_RegionSize_128
-
enumerator AddrTranslateP_RegionSize_256
-
enumerator AddrTranslateP_RegionSize_512
-
enumerator AddrTranslateP_RegionSize_1K
-
enumerator AddrTranslateP_RegionSize_2K
-
enumerator AddrTranslateP_RegionSize_4K
-
enumerator AddrTranslateP_RegionSize_8K
-
enumerator AddrTranslateP_RegionSize_16K
-
enumerator AddrTranslateP_RegionSize_32K
-
enumerator AddrTranslateP_RegionSize_64K
-
enumerator AddrTranslateP_RegionSize_128K
-
enumerator AddrTranslateP_RegionSize_256K
-
enumerator AddrTranslateP_RegionSize_512K
-
enumerator AddrTranslateP_RegionSize_1M
-
enumerator AddrTranslateP_RegionSize_2M
-
enumerator AddrTranslateP_RegionSize_4M
-
enumerator AddrTranslateP_RegionSize_8M
-
enumerator AddrTranslateP_RegionSize_16M
-
enumerator AddrTranslateP_RegionSize_32M
-
enumerator AddrTranslateP_RegionSize_64M
-
enumerator AddrTranslateP_RegionSize_128M
-
enumerator AddrTranslateP_RegionSize_256M
-
enumerator AddrTranslateP_RegionSize_512M
-
enumerator AddrTranslateP_RegionSize_1G
-
enumerator AddrTranslateP_RegionSize_2G
-
enumerator AddrTranslateP_RegionSize_4G
-
enumerator AddrTranslateP_RegionSize_1
Functions
-
void AddrTranslateP_Params_init(AddrTranslateP_Params *params)
Set default value for address translate parameters.
- Parameters:
params – [out] Structure initialized with default parameters
-
void AddrTranslateP_init(AddrTranslateP_Params *params)
Initialize Address translate sub-system, called by SysConfig, not to be called by end users.
- Parameters:
params – [in] Initialization parameters
-
void AddrTranslateP_setRegion(uint32_t ratBaseAddr, uint16_t regionNum, uint64_t systemAddr, uint32_t localAddr, uint32_t size, uint32_t enable)
Configure a single RAT region at runtime.
- Parameters:
ratBaseAddr – [in] Base address of the RAT HW module
regionNum – [in] RAT region number to configure
systemAddr – [in] 48b system (SOC) address, aligned to region size
localAddr – [in] CPU local address, aligned to region size
size – [in] Region size, see AddrTranslateP_RegionSize
enable – [in] 1 to enable the region, 0 to disable
-
void *AddrTranslateP_getLocalAddr(uint64_t systemAddr)
Translate from 48b system address to a CPU address as seen via the RAT module.
Note
If no mapping is found then lower 32b are returned as the local address, i.e no translation is done for 32b address, and address truncation for > 32b input addresses.
Note
All drivers MUST call this API to translate peripheral MMR base addresses to CPU visible base addr. It is recommended to call this once to get the base address during driver module init.
- Parameters:
systemAddr – [in] 48b system address or SOC view address
- Returns:
void * CPU view or local address
-
struct AddrTranslateP_RegionConfig
- #include <AddrTranslateP.h>
Region config structure, this is used by SysConfig and not to be used by end-users directly.
Public Members
-
uint64_t systemAddr
translated 48b system addr as seen by the SOC, MUST align to region size
-
uint32_t localAddr
region start address as seen by the CPU, MUST align to region size
-
uint32_t size
region size, see AddrTranslateP_RegionSize
-
uint64_t systemAddr
-
struct AddrTranslateP_Params
- #include <AddrTranslateP.h>
Parameters for AddrTranslateP_init, this is used by SysConfig and not to be used by end-users directly.
Public Members
-
uint32_t numRegions
Number of regions to configure
-
uint32_t ratBaseAddr
Base address of the RAT HW module
-
AddrTranslateP_RegionConfig *regionConfig
Pointer to array of region config, number of array element MUST be >= numRegions
-
uint32_t numRegions