The MCUXpresso SDK provides a driver for the Extended Resource Domain Controller (XRDC) block of MCUXpresso SDK devices.
XRDC functions
The XRDC module includes four submodules, as follows:
- XRDC_MGR The Manager submodule coordinates all programming model reads and writes.
- XRDC_MDAC The Master Domain Assignment Controller handles resource assignments and generation of the domain identifiers (domain ID).
- XRDC_MRC The Memory Region Controller implements the access controls for slave memories based on the pre-programmed region descriptor registers.
- XRDC_PAC The Peripheral Access Controller implements the access controls for slave peripherals based on the preprogrammed domain access control registers.
Accordingly, the XRDC driver functions could be grouped as follows:
- XRDC_MGR functions.
- XRDC_MDAC functions.
- XRDC_MRC functions.
- XRDC_PAC functions.
Typical use case
Set up configurations during system initialization
The domain assignment and access policy can be configured during the system initialization.
{
{
.pidMask = 0x3E,
.pid = 0x00,
},
{
.domainId = 2U,
.pidMask = 0x3E,
.pid = 0x01,
}
};
{
};
{
{
.baseAddress = 0x1FFF0000U,
.size = kXRDC_MemSize32K,
.policy[0] = kXRDC_AccessPolicyAll,
.policy[1] = kXRDC_AccessPolicyNone,
.policy[2] = kXRDC_AccessPolicyAll,
},
{
.mem = kXRDC_MemMrc0_1,
.baseAddress = 0x20000000U,
.size = kXRDC_MemSize32K,
.policy[0] = kXRDC_AccessPolicyAll,
.policy[1] = kXRDC_AccessPolicyNone,
.policy[2] = kXRDC_AccessPolicyAll,
}
};
{
{
.policy[0] = kXRDC_AccessPolicyAll,
.policy[1] = kXRDC_AccessPolicyNone,
.policy[2] = kXRDC_AccessPolicyAll,
},
{
.periph = kXRDC_PeriphLpuart0,
.policy[0] = kXRDC_AccessPolicyAll,
.policy[1] = kXRDC_AccessPolicyNone,
.policy[2] = kXRDC_AccessPolicyAll,
}
};
void main(void)
{
uint32_t i;
uint8_t domainId;
for (i=0U; i<(sizeof(core0DomainAssignments)/sizeof(core0DomainAssignments[0])); i++)
{
}
for (i=0U; i<(sizeof(memAccessPolicy)/sizeof(memAccessPolicy[0])); i++)
{
}
for (i=0U; i<(sizeof(periphAccessPolicy)/sizeof(periphAccessPolicy[0])); i++)
{
}
assert(0 == domainId);
assert(2 == domainId);
while (1)
{
}
}
XRDC error handle
When an access violation occurs, the hard fault is triggered. The function XRDC_GetAndClearFirstDomainError() is used to get the error information. Although there might be more than one error, this function only gets the first error.
void HardFault_Handler(void)
{
{
}
}
Access involve SEMA42
See the SoC reference manual to check which SEMA42 instance is used. For example, for KL28, the memory region defined by the MRC0 uses the SEMA42-0, while the memory region defined by MRC1 uses the SEMA42-1. The peripherals controlled by the PAC0 and PAC2 use the SEMA42-0, while the peripherals controlled by PAC1 use the SEMA42-1.
{
.enableSema = true,
.semaNum = 5,
.baseAddress = 0x1FFF0000U,
.size = kXRDC_MemSize32K,
.policy[0] = kXRDC_AccessPolicyAll,
.policy[1] = kXRDC_AccessPolicyNone,
.policy[2] = kXRDC_AccessPolicyAll,
};
SEMA42_Lock(SEMA42_0, 5, XRDC_GetDomainId(XRDC));
SEMA42_Unlock(SEMA42_0, 5);
|
enum | _xrdc_status { kStatus_XRDC_NoError = MAKE_STATUS(kStatusGroup_XRDC, 0)
} |
| XRDC status. More...
|
|
enum | xrdc_pid_enable_t {
kXRDC_PidDisable,
kXRDC_PidDisable1,
kXRDC_PidExp0,
kXRDC_PidExp1
} |
| XRDC PID enable mode, the register bit XRDC_MDA_Wx[PE], used for domain hit evaluation. More...
|
|
enum | xrdc_did_sel_t {
kXRDC_DidMda,
kXRDC_DidInput,
kXRDC_DidMdaAndInput,
kXRDC_DidReserved
} |
| XRDC domain ID select method, the register bit XRDC_MDA_Wx[DIDS], used for domain hit evaluation. More...
|
|
enum | xrdc_secure_attr_t {
kXRDC_ForceSecure,
kXRDC_ForceNonSecure,
kXRDC_MasterSecure,
kXRDC_MasterSecure1
} |
| XRDC secure attribute, the register bit XRDC_MDA_Wx[SA], used for non-processor bus master domain assignment. More...
|
|
enum | xrdc_privilege_attr_t {
kXRDC_ForceUser,
kXRDC_ForcePrivilege,
kXRDC_MasterPrivilege,
kXRDC_MasterPrivilege1
} |
| XRDC privileged attribute, the register bit XRDC_MDA_Wx[PA], used for non-processor bus master domain assignment. More...
|
|
enum | xrdc_pid_lock_t {
kXRDC_PidLockSecurePrivilegeWritable = 0U,
kXRDC_PidLockSecurePrivilegeWritable1 = 1U,
kXRDC_PidLockMasterXOnly = 2U,
kXRDC_PidLockLocked = 3U
} |
| XRDC PID LK2 definition XRDC_PIDn[LK2]. More...
|
|
enum | xrdc_access_policy_t |
| XRDC domain access control policy.
|
|
enum | xrdc_access_config_lock_t {
kXRDC_AccessConfigLockWritable = 0U,
kXRDC_AccessConfigLockWritable1 = 1U,
kXRDC_AccessConfigLockDomainXOnly = 2U,
kXRDC_AccessConfigLockLocked = 3U
} |
| Access configuration lock mode, the register field PDAC and MRGD LK2. More...
|
|
enum | xrdc_excl_access_lock_config_t {
kXRDC_ExclAccessLockDisabled = 0U,
kXRDC_ExclAccessLockDisabledUntilNextRst = 1U,
kXRDC_ExclAccessLockEnabledStateAvail = 2U,
kXRDC_ExclAccessLockEnabledStateNotAvail = 3U
} |
| Exclusive access lock mode configuration, the register field PDAC and MRGD EAL. More...
|
|
enum | xrdc_mem_accset_t {
kXRDC_MemAccset1 = 0U,
kXRDC_MemAccset2 = 1U
} |
| XRDC memory ACCSET (SET of programmable access flags). More...
|
|
enum | xrdc_mem_code_region_t {
kXRDC_MemCodeRegion0 = 0U,
kXRDC_MemCodeRegion1 = 1U
} |
| XRDC memory code region indicator. More...
|
|
enum | xrdc_access_flags_select_t |
| XRDC domain access flags/policy select. More...
|
|
enum | xrdc_controller_t {
kXRDC_MemController0 = 0U,
kXRDC_MemController1 = 1U,
kXRDC_MemController2 = 2U,
kXRDC_MemController3 = 3U,
kXRDC_MemController4 = 4U,
kXRDC_MemController5 = 5U,
kXRDC_MemController6 = 6U,
kXRDC_MemController7 = 7U,
kXRDC_MemController8 = 8U,
kXRDC_MemController9 = 9U,
kXRDC_MemController10 = 10U,
kXRDC_MemController11 = 11U,
kXRDC_MemController12 = 12U,
kXRDC_MemController13 = 13U,
kXRDC_MemController14 = 14U,
kXRDC_MemController15 = 15U,
kXRDC_PeriphController0 = 16U,
kXRDC_PeriphController1 = 17U,
kXRDC_PeriphController2 = 18U,
kXRDC_PeriphController3 = 19U
} |
| XRDC controller definition for domain error check. More...
|
|
enum | xrdc_error_state_t {
kXRDC_ErrorStateNone = 0x00U,
kXRDC_ErrorStateNone1 = 0x01U,
kXRDC_ErrorStateSingle = 0x02U,
kXRDC_ErrorStateMulti = 0x03U
} |
| XRDC domain error state definition XRDC_DERR_W1_n[EST]. More...
|
|
enum | xrdc_error_attr_t {
kXRDC_ErrorSecureUserInst = 0x00U,
kXRDC_ErrorSecureUserData = 0x01U,
kXRDC_ErrorSecurePrivilegeInst = 0x02U,
kXRDC_ErrorSecurePrivilegeData = 0x03U,
kXRDC_ErrorNonSecureUserInst = 0x04U,
kXRDC_ErrorNonSecureUserData = 0x05U,
kXRDC_ErrorNonSecurePrivilegeInst = 0x06U,
kXRDC_ErrorNonSecurePrivilegeData = 0x07U
} |
| XRDC domain error attribute definition XRDC_DERR_W1_n[EATR]. More...
|
|
enum | xrdc_error_type_t {
kXRDC_ErrorTypeRead = 0x00U,
kXRDC_ErrorTypeWrite = 0x01U
} |
| XRDC domain error access type definition XRDC_DERR_W1_n[ERW]. More...
|
|
|
static void | XRDC_GetPidDefaultConfig (xrdc_pid_config_t *config) |
| Gets the default PID configuration structure. More...
|
|
static void | XRDC_SetPidConfig (XRDC_Type *base, xrdc_master_t master, const xrdc_pid_config_t *config) |
| Configures the PID for a specific bus master. More...
|
|
static void | XRDC_SetPidLockMode (XRDC_Type *base, xrdc_master_t master, xrdc_pid_lock_t lockMode) |
| Sets the PID configuration register lock mode. More...
|
|
static void | XRDC_GetDefaultNonProcessorDomainAssignment (xrdc_non_processor_domain_assignment_t *assignment) |
| Gets the default master domain assignment for non-processor bus master. More...
|
|
static void | XRDC_GetDefaultProcessorDomainAssignment (xrdc_processor_domain_assignment_t *assignment) |
| Gets the default master domain assignment for the processor bus master. More...
|
|
static void | XRDC_SetNonProcessorDomainAssignment (XRDC_Type *base, xrdc_master_t master, uint8_t assignIndex, const xrdc_non_processor_domain_assignment_t *assignment) |
| Sets the non-processor bus master domain assignment. More...
|
|
static void | XRDC_SetProcessorDomainAssignment (XRDC_Type *base, xrdc_master_t master, uint8_t assignIndex, const xrdc_processor_domain_assignment_t *assignment) |
| Sets the processor bus master domain assignment. More...
|
|
static void | XRDC_LockMasterDomainAssignment (XRDC_Type *base, xrdc_master_t master, uint8_t assignIndex) |
| Locks the bus master domain assignment register. More...
|
|
static void | XRDC_SetMasterDomainAssignmentValid (XRDC_Type *base, xrdc_master_t master, uint8_t assignIndex, bool valid) |
| Sets the master domain assignment as valid or invalid. More...
|
|
|
void | XRDC_GetMemAccessDefaultConfig (xrdc_mem_access_config_t *config) |
| Gets the default memory region access policy. More...
|
|
void | XRDC_SetMemAccessConfig (XRDC_Type *base, const xrdc_mem_access_config_t *config) |
| Sets the memory region access policy. More...
|
|
static void | XRDC_SetMemAccessLockMode (XRDC_Type *base, xrdc_mem_t mem, xrdc_access_config_lock_t lockMode) |
| Sets the memory region descriptor register lock mode. More...
|
|
static void | XRDC_SetMemAccessValid (XRDC_Type *base, xrdc_mem_t mem, bool valid) |
| Sets the memory region descriptor as valid or invalid. More...
|
|
void | XRDC_SetMemExclAccessLockMode (XRDC_Type *base, xrdc_mem_t mem, xrdc_excl_access_lock_config_t lockMode) |
| Sets the memory region exclusive access lock mode configuration. More...
|
|
void | XRDC_ForceMemExclAccessLockRelease (XRDC_Type *base, xrdc_mem_t mem) |
| Forces the release of the memory region exclusive access lock. More...
|
|
static uint8_t | XRDC_GetMemExclAccessLockDomainOwner (XRDC_Type *base, xrdc_mem_t mem) |
| Gets the exclusive access lock domain owner of the memory region. More...
|
|
void | XRDC_SetMemAccsetLock (XRDC_Type *base, xrdc_mem_t mem, xrdc_mem_accset_t accset, bool lock) |
| Sets the memory region ACCSET (programmable access flags) lock. More...
|
|
struct xrdc_hardware_config_t |
uint8_t xrdc_hardware_config_t::masterNumber |
uint8_t xrdc_hardware_config_t::domainNumber |
uint8_t xrdc_hardware_config_t::pacNumber |
uint8_t xrdc_hardware_config_t::mrcNumber |
struct xrdc_processor_domain_assignment_t |
uint32_t xrdc_processor_domain_assignment_t::domainId |
uint32_t xrdc_processor_domain_assignment_t::domainIdSelect |
uint32_t xrdc_processor_domain_assignment_t::pidEnable |
uint32_t xrdc_processor_domain_assignment_t::pidMask |
uint32_t xrdc_processor_domain_assignment_t::__pad0__ |
uint32_t xrdc_processor_domain_assignment_t::pid |
uint32_t xrdc_processor_domain_assignment_t::__pad1__ |
uint32_t xrdc_processor_domain_assignment_t::__pad2__ |
uint32_t xrdc_processor_domain_assignment_t::__pad3__ |
uint32_t xrdc_processor_domain_assignment_t::__pad4__ |
uint32_t xrdc_processor_domain_assignment_t::lock |
uint32_t xrdc_processor_domain_assignment_t::__pad5__ |
struct xrdc_non_processor_domain_assignment_t |
uint32_t xrdc_non_processor_domain_assignment_t::domainId |
uint32_t xrdc_non_processor_domain_assignment_t::privilegeAttr |
uint32_t xrdc_non_processor_domain_assignment_t::secureAttr |
uint32_t xrdc_non_processor_domain_assignment_t::bypassDomainId |
uint32_t xrdc_non_processor_domain_assignment_t::__pad0__ |
uint32_t xrdc_non_processor_domain_assignment_t::__pad1__ |
uint32_t xrdc_non_processor_domain_assignment_t::__pad2__ |
uint32_t xrdc_non_processor_domain_assignment_t::__pad3__ |
uint32_t xrdc_non_processor_domain_assignment_t::lock |
uint32_t xrdc_non_processor_domain_assignment_t::__pad4__ |
uint32_t xrdc_pid_config_t::pid |
uint32_t xrdc_pid_config_t::__pad0__ |
uint32_t xrdc_pid_config_t::tsmEnable |
uint32_t xrdc_pid_config_t::lockMode |
uint32_t xrdc_pid_config_t::__pad1__ |
struct xrdc_periph_access_config_t |
xrdc_periph_t xrdc_periph_access_config_t::periph |
struct xrdc_mem_access_config_t |
xrdc_mem_t xrdc_mem_access_config_t::mem |
bool xrdc_mem_access_config_t::enableAccset1Lock |
bool xrdc_mem_access_config_t::enableAccset2Lock |
uint16_t xrdc_mem_access_config_t::accset1 |
xxx_xxx_xxx_xxx => PS{R,W,X}_PN{R,W,X}_US{R,W,X}_UN{R,W,X}. flag = 0 : inhibits access, flag = 1 : allows access.
uint16_t xrdc_mem_access_config_t::accset2 |
xxx_xxx_xxx_xxx => PS{R,W,X}_PN{R,W,X}_US{R,W,X}_UN{R,W,X}. flag = 0 : inhibits access, flag = 1 : allows access.
uint32_t xrdc_mem_access_config_t::baseAddress |
uint32_t xrdc_mem_access_config_t::endAddress |
The 5 LSB of end address is ignored and forced to 0x1F by hardware.
uint32_t xrdc_error_t::address |
uint8_t xrdc_error_t::errorPort |
uint8_t xrdc_error_t::domainId |
#define FSL_XRDC_DRIVER_VERSION (MAKE_VERSION(2, 0, 3)) |
Enumerator |
---|
kStatus_XRDC_NoError |
No error captured.
|
Enumerator |
---|
kXRDC_PidDisable |
PID is not used in domain hit evalution.
|
kXRDC_PidDisable1 |
PID is not used in domain hit evalution.
|
kXRDC_PidExp0 |
((XRDC_MDA_W[PID] & ~XRDC_MDA_W[PIDM]) == (XRDC_PID[PID] & ~XRDC_MDA_W[PIDM])).
|
kXRDC_PidExp1 |
~((XRDC_MDA_W[PID] & ~XRDC_MDA_W[PIDM]) == (XRDC_PID[PID] & ~XRDC_MDA_W[PIDM])).
|
Enumerator |
---|
kXRDC_DidMda |
Use MDAn[3:0] as DID.
|
kXRDC_DidInput |
Use the input DID (DID_in) as DID.
|
kXRDC_DidMdaAndInput |
Use MDAn[3:2] concatenated with DID_in[1:0] as DID.
|
kXRDC_DidReserved |
Reserved.
|
Enumerator |
---|
kXRDC_ForceSecure |
Force the bus attribute for this master to secure.
|
kXRDC_ForceNonSecure |
Force the bus attribute for this master to non-secure.
|
kXRDC_MasterSecure |
Use the bus master's secure/nonsecure attribute directly.
|
kXRDC_MasterSecure1 |
Use the bus master's secure/nonsecure attribute directly.
|
Enumerator |
---|
kXRDC_ForceUser |
Force the bus attribute for this master to user.
|
kXRDC_ForcePrivilege |
Force the bus attribute for this master to privileged.
|
kXRDC_MasterPrivilege |
Use the bus master's attribute directly.
|
kXRDC_MasterPrivilege1 |
Use the bus master's attribute directly.
|
Enumerator |
---|
kXRDC_PidLockSecurePrivilegeWritable |
Writable by any secure privileged write.
|
kXRDC_PidLockSecurePrivilegeWritable1 |
Writable by any secure privileged write.
|
kXRDC_PidLockMasterXOnly |
PIDx is only writable by master x.
|
kXRDC_PidLockLocked |
Read-only until the next reset.
|
Enumerator |
---|
kXRDC_AccessConfigLockWritable |
Entire PDACn/MRGDn can be written.
|
kXRDC_AccessConfigLockWritable1 |
Entire PDACn/MRGDn can be written.
|
kXRDC_AccessConfigLockDomainXOnly |
Domain x only write the DxACP field.
|
kXRDC_AccessConfigLockLocked |
PDACn is read-only until the next reset.
|
Enumerator |
---|
kXRDC_ExclAccessLockDisabled |
Lock disabled.
|
kXRDC_ExclAccessLockDisabledUntilNextRst |
Lock disabled until next reset.
|
kXRDC_ExclAccessLockEnabledStateAvail |
Lock enabled, lock state = available.
|
kXRDC_ExclAccessLockEnabledStateNotAvail |
Lock enabled, lock state = not available.
|
Enumerator |
---|
kXRDC_MemAccset1 |
Memory region SET 1 of programmable access flags.
|
kXRDC_MemAccset2 |
Memory region SET 2 of programmable access flags.
|
Enumerator |
---|
kXRDC_MemCodeRegion0 |
Code region indicator 0=data.
|
kXRDC_MemCodeRegion1 |
Code region indicator 1=code.
|
Policy: {R,W,X} Read, write, execute flags. flag = 0 : inhibits access, flag = 1 : allows access. policy => SecurePriv_NonSecurePriv_SecureUser_NonSecureUsr xxx_xxx_xxx_xxx => PS{R,W,X}_PN{R,W,X}_US{R,W,X}_UN{R,W,X}
PS > PN > US > UN PS > PN > US > UN
DxSEL CodeRegion = 0 CodeRegion = 1 000 000_000_000_000 = 0x000 000_000_000_000 = 0x000 001 ACCSET1 010 ACCSET2 011 110_000_000_000 = 0xC00 001_001_001_001 = 0x249 100 110_110_000_000 = 0xD80 111_000_000_000 = 0xE00 101 110_110_100_100 = 0xDA4 110_111_000_000 = 0xDC0 110 110_110_110_000 = 0xDB0 110_110_111_000 = 0xDB8 111 110_110_110_110 = 0xDB6 110_110_111_111 = 0xDBF
Enumerator |
---|
kXRDC_MemController0 |
Memory region controller 0.
|
kXRDC_MemController1 |
Memory region controller 1.
|
kXRDC_MemController2 |
Memory region controller 2.
|
kXRDC_MemController3 |
Memory region controller 3.
|
kXRDC_MemController4 |
Memory region controller 4.
|
kXRDC_MemController5 |
Memory region controller 5.
|
kXRDC_MemController6 |
Memory region controller 6.
|
kXRDC_MemController7 |
Memory region controller 7.
|
kXRDC_MemController8 |
Memory region controller 8.
|
kXRDC_MemController9 |
Memory region controller 9.
|
kXRDC_MemController10 |
Memory region controller 10.
|
kXRDC_MemController11 |
Memory region controller 11.
|
kXRDC_MemController12 |
Memory region controller 12.
|
kXRDC_MemController13 |
Memory region controller 13.
|
kXRDC_MemController14 |
Memory region controller 14.
|
kXRDC_MemController15 |
Memory region controller 15.
|
kXRDC_PeriphController0 |
Peripheral access controller 0.
|
kXRDC_PeriphController1 |
Peripheral access controller 1.
|
kXRDC_PeriphController2 |
Peripheral access controller 2.
|
kXRDC_PeriphController3 |
Peripheral access controller 3.
|
Enumerator |
---|
kXRDC_ErrorStateNone |
No access violation detected.
|
kXRDC_ErrorStateNone1 |
No access violation detected.
|
kXRDC_ErrorStateSingle |
Single access violation detected.
|
kXRDC_ErrorStateMulti |
Multiple access violation detected.
|
Enumerator |
---|
kXRDC_ErrorSecureUserInst |
Secure user mode, instruction fetch access.
|
kXRDC_ErrorSecureUserData |
Secure user mode, data access.
|
kXRDC_ErrorSecurePrivilegeInst |
Secure privileged mode, instruction fetch access.
|
kXRDC_ErrorSecurePrivilegeData |
Secure privileged mode, data access.
|
kXRDC_ErrorNonSecureUserInst |
NonSecure user mode, instruction fetch access.
|
kXRDC_ErrorNonSecureUserData |
NonSecure user mode, data access.
|
kXRDC_ErrorNonSecurePrivilegeInst |
NonSecure privileged mode, instruction fetch access.
|
kXRDC_ErrorNonSecurePrivilegeData |
NonSecure privileged mode, data access.
|
Enumerator |
---|
kXRDC_ErrorTypeRead |
Error occurs on read reference.
|
kXRDC_ErrorTypeWrite |
Error occurs on write reference.
|
void XRDC_Init |
( |
XRDC_Type * |
base | ) |
|
This function enables the XRDC clock.
- Parameters
-
base | XRDC peripheral base address. |
void XRDC_Deinit |
( |
XRDC_Type * |
base | ) |
|
This function disables the XRDC clock.
- Parameters
-
base | XRDC peripheral base address. |
This function gets the XRDC hardware configurations, including number of bus masters, number of domains, number of MRCs and number of PACs.
- Parameters
-
base | XRDC peripheral base address. |
config | Pointer to the structure to get the configuration. |
static void XRDC_LockGlobalControl |
( |
XRDC_Type * |
base | ) |
|
|
inlinestatic |
This function locks the XRDC_CR register. After it is locked, the register is read-only until the next reset.
- Parameters
-
base | XRDC peripheral base address. |
static void XRDC_SetGlobalValid |
( |
XRDC_Type * |
base, |
|
|
bool |
valid |
|
) |
| |
|
inlinestatic |
This function sets the XRDC global valid or invalid. When the XRDC is global invalid, all accesses from all bus masters to all slaves are allowed.
- Parameters
-
base | XRDC peripheral base address. |
valid | True to valid XRDC. |
static uint8_t XRDC_GetCurrentMasterDomainId |
( |
XRDC_Type * |
base | ) |
|
|
inlinestatic |
This function returns the domain ID of the current bus master.
- Parameters
-
base | XRDC peripheral base address. |
- Returns
- Domain ID of current bus master.
status_t XRDC_GetAndClearFirstDomainError |
( |
XRDC_Type * |
base, |
|
|
xrdc_error_t * |
error |
|
) |
| |
This function gets the first access violation information for the current domain and clears the pending flag. There might be multiple access violations pending for the current domain. This function only processes the first error.
- Parameters
-
base | XRDC peripheral base address. |
error | Pointer to the error information. |
- Returns
- If the access violation is captured, this function returns the kStatus_Success. The error information can be obtained from the parameter error. If no access violation is captured, this function returns the kStatus_XRDC_NoError.
status_t XRDC_GetAndClearFirstSpecificDomainError |
( |
XRDC_Type * |
base, |
|
|
xrdc_error_t * |
error, |
|
|
uint8_t |
domainId |
|
) |
| |
This function gets the first access violation information for the specific domain and clears the pending flag. There might be multiple access violations pending for the current domain. This function only processes the first error.
- Parameters
-
base | XRDC peripheral base address. |
error | Pointer to the error information. |
domainId | The error of which domain to get and clear. |
- Returns
- If the access violation is captured, this function returns the kStatus_Success. The error information can be obtained from the parameter error. If no access violation is captured, this function returns the kStatus_XRDC_NoError.
This function initializes the configuration structure to default values. The default values are:
* config->pid = 0U;
* config->tsmEnable = 0U;
* config->sp4smEnable = 0U;
*
- Parameters
-
config | Pointer to the configuration structure. |
static void XRDC_SetPidConfig |
( |
XRDC_Type * |
base, |
|
|
xrdc_master_t |
master, |
|
|
const xrdc_pid_config_t * |
config |
|
) |
| |
|
inlinestatic |
This function configures the PID for a specific bus master. Do not use this function for non-processor bus masters.
- Parameters
-
base | XRDC peripheral base address. |
master | Which bus master to configure. |
config | Pointer to the configuration structure. |
static void XRDC_SetPidLockMode |
( |
XRDC_Type * |
base, |
|
|
xrdc_master_t |
master, |
|
|
xrdc_pid_lock_t |
lockMode |
|
) |
| |
|
inlinestatic |
This function sets the PID configuration register lock XRDC_PIDn[LK2].
- Parameters
-
base | XRDC peripheral base address. |
master | Which master's PID to lock. |
lockMode | Lock mode to set. |
This function gets the default master domain assignment for non-processor bus master. It should only be used for the no-processor bus masters, such as DMA. This function sets the assignment as follows:
* assignment->domainId = 0U;
* assignment->bypassDomainId = 0U;
* assignment->blogicPartId = 0U;
* assignment->benableLogicPartId = 0U;
* assignment->lock = 0U;
*
- Parameters
-
assignment | Pointer to the assignment structure. |
This function gets the default master domain assignment for the processor bus master. It should only be used for the processor bus masters, such as CORE0. This function sets the assignment as follows:
* assignment->domainId = 0U;
* assignment->pidMask = 0U;
* assignment->pid = 0U;
* assignment->logicPartId = 0U;
* assignment->enableLogicPartId = 0U;
* assignment->lock = 0U;
*
- Parameters
-
assignment | Pointer to the assignment structure. |
This function sets the non-processor master domain assignment as valid. One bus master might have multiple domain assignment registers. The parameter assignIndex
specifies which assignment register to set.
Example: Set domain assignment for DMA0.
*
*
* nonProcessorAssignment.xxx = xxx;
*
*
* XRDC_SetMasterDomainAssignment(XRDC, kXrdcMasterDma0, 0U, &nonProcessorAssignment);
*
- Parameters
-
base | XRDC peripheral base address. |
master | Which master to configure. |
assignIndex | Which assignment register to set. |
assignment | Pointer to the assignment structure. |
This function sets the processor master domain assignment as valid. One bus master might have multiple domain assignment registers. The parameter assignIndex
specifies which assignment register to set.
Example: Set domain assignment for core 0.
*
*
*
*
* processorAssignment.xxx = xxx;
* XRDC_SetMasterDomainAssignment(XRDC, kXrdcMasterCpu0, 0U, &processorAssignment);
*
*
* processorAssignment.xxx = xxx;
* XRDC_SetMasterDomainAssignment(XRDC, kXrdcMasterCpu0, 1U, &processorAssignment);
*
*
* processorAssignment.xxx = xxx;
* XRDC_SetMasterDomainAssignment(XRDC, kXrdcMasterCpu0, 2U, &processorAssignment);
*
- Parameters
-
base | XRDC peripheral base address. |
master | Which master to configure. |
assignIndex | Which assignment register to set. |
assignment | Pointer to the assignment structure. |
static void XRDC_LockMasterDomainAssignment |
( |
XRDC_Type * |
base, |
|
|
xrdc_master_t |
master, |
|
|
uint8_t |
assignIndex |
|
) |
| |
|
inlinestatic |
This function locks the master domain assignment. One bus master might have multiple domain assignment registers. The parameter assignIndex
specifies which assignment register to lock. After it is locked, the register can't be changed until next reset.
- Parameters
-
base | XRDC peripheral base address. |
master | Which master to configure. |
assignIndex | Which assignment register to lock. |
static void XRDC_SetMasterDomainAssignmentValid |
( |
XRDC_Type * |
base, |
|
|
xrdc_master_t |
master, |
|
|
uint8_t |
assignIndex, |
|
|
bool |
valid |
|
) |
| |
|
inlinestatic |
This function sets the master domain assignment as valid or invalid. One bus master might have multiple domain assignment registers. The parameter assignIndex
specifies which assignment register to configure.
- Parameters
-
base | XRDC peripheral base address. |
master | Which master to configure. |
assignIndex | Index for the domain assignment register. |
valid | True to set valid, false to set invalid. |
This function gets the default memory region access policy. It sets the policy as follows:
* config->enableSema = false;
* config->semaNum = 0U;
* config->subRegionDisableMask = 0U;
* config->size = kXrdcMemSizeNone;
* config->baseAddress = 0U;
* config->policy[0] = kXRDC_AccessPolicyNone;
* config->policy[1] = kXRDC_AccessPolicyNone;
* ...
* config->policy[15] = kXRDC_AccessPolicyNone;
*
- Parameters
-
config | Pointer to the configuration structure. |
This function sets the memory region access configuration as valid. There are two methods to use it:
Example 1: Set one configuration run time.
*
* {
* .mem = kXRDC_MemMrc0_1,
* .baseAddress = 0x20000000U,
* .size = kXRDC_MemSize1K,
* .policy[0] = kXRDC_AccessPolicyAll
* };
*
Example 2: Set multiple configurations during startup.
*
*
* {
* {
* .
mem = kXRDC_MemMrc0_1,
* .baseAddress = 0x20000000U,
* .size = kXRDC_MemSize1K,
* .policy[0] = kXRDC_AccessPolicyAll
* },
* {
* .mem = kXRDC_MemMrc0_2,
* .baseAddress = 0x1FFF0000U,
* .size = kXRDC_MemSize2K,
* .policy[0] = kXRDC_AccessPolicyAll
* }
* };
*
*
* for (i=0U; i<((sizeof(configs)/sizeof(configs[0]))); i++)
* {
* }
*
- Parameters
-
base | XRDC peripheral base address. |
config | Pointer to the access policy configuration structure. |
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region descriptor to lock. |
lockMode | The lock mode to set. |
static void XRDC_SetMemAccessValid |
( |
XRDC_Type * |
base, |
|
|
xrdc_mem_t |
mem, |
|
|
bool |
valid |
|
) |
| |
|
inlinestatic |
This function sets the memory region access configuration dynamically. For example:
*
* {
* .
mem = kXRDC_MemMrc0_1,
* .baseAddress = 0x20000000U,
* .size = kXRDC_MemSize1K,
* .policy[0] = kXRDC_AccessPolicyAll
* };
*
*
*
*
*
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region descriptor to set. |
valid | True to set valid, false to set invalid. |
Note: Any write to MRGD_W[0-3]_n clears the MRGD_W4_n[VLD] indicator so a coherent register state can be supported. It is indispensable to re-assert the valid bit when dynamically changing the EAL in the MRGD, which is done in this API.
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region's exclusive access lock mode to configure. |
lockMode | The exclusive access lock mode to set. |
void XRDC_ForceMemExclAccessLockRelease |
( |
XRDC_Type * |
base, |
|
|
xrdc_mem_t |
mem |
|
) |
| |
A lock can be forced to the available state (EAL=10) by a domain that does not own the lock through the forced lock release procedure: The procedure to force a exclusive access lock release is as follows:
- Write 0x02000046 to W1 register (PAC/MSC) or W3 register (MRC)
- Write 0x02000052 to W1 register (PAC/MSC) or W3 register (MRC)
Note: The two writes must be consecutive, any intervening write to the register resets the sequence.
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region's exclusive access lock to force release. |
static uint8_t XRDC_GetMemExclAccessLockDomainOwner |
( |
XRDC_Type * |
base, |
|
|
xrdc_mem_t |
mem |
|
) |
| |
|
inlinestatic |
This function returns the domain ID of the exclusive access lock owner of the memory region.
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region's exclusive access lock domain owner to get. |
- Returns
- Domain ID of the memory region exclusive access lock owner.
void XRDC_SetMemAccsetLock |
( |
XRDC_Type * |
base, |
|
|
xrdc_mem_t |
mem, |
|
|
xrdc_mem_accset_t |
accset, |
|
|
bool |
lock |
|
) |
| |
- Parameters
-
base | XRDC peripheral base address. |
mem | Which memory region descriptor to lock. |
mem | Which set/index of ACCSET to lock. |
lock | True to set lock, false to set unlock. |
The default configuration is set as follows:
* config->enableSema = false;
* config->semaNum = 0U;
* config->
policy[0] = kXRDC_AccessPolicyNone;
* config->
policy[1] = kXRDC_AccessPolicyNone;
* ...
* config->
policy[15] = kXRDC_AccessPolicyNone;
*
- Parameters
-
config | Pointer to the configuration structure. |
This function sets the peripheral access configuration as valid. Two methods to use it: Method 1: Set for one peripheral, which is used for runtime settings.
*
*
* config.
periph = kXRDC_PeriphLptmr0;
* config.
policy[0] = kXRDC_AccessPolicyAll;
*
Method 2: Set for multiple peripherals, which is used for initialization settings.
*
* {
* {
* .periph = kXRDC_PeriphLptmr0,
* .
policy[0] = kXRDC_AccessPolicyAll,
* .policy[1] = kXRDC_AccessPolicyAll
* },
* {
* .periph = kXRDC_PeriphLpuart0,
* .policy[0] = kXRDC_AccessPolicyAll,
* .policy[1] = kXRDC_AccessPolicyAll
* }
* };
*
*
* for (i=0U; i<(sizeof(configs)/sizeof(configs[0])), i++)
* {
* }
*
- Parameters
-
base | XRDC peripheral base address. |
config | Pointer to the configuration structure. |
- Parameters
-
base | XRDC peripheral base address. |
periph | Which peripheral access configuration register to lock. |
lockMode | The lock mode to set. |
static void XRDC_SetPeriphAccessValid |
( |
XRDC_Type * |
base, |
|
|
xrdc_periph_t |
periph, |
|
|
bool |
valid |
|
) |
| |
|
inlinestatic |
This function sets the peripheral access configuration dynamically. For example:
*
* {
* .
periph = kXRDC_PeriphLptmr0;
* .policy[0] = kXRDC_AccessPolicyAll;
* };
*
*
*
*
*
- Parameters
-
base | XRDC peripheral base address. |
periph | Which peripheral access configuration to set. |
valid | True to set valid, false to set invalid. |
- Parameters
-
base | XRDC peripheral base address. |
periph | Which peripheral's exclusive access lock mode to configure. |
lockMode | The exclusive access lock mode to set. |
void XRDC_ForcePeriphExclAccessLockRelease |
( |
XRDC_Type * |
base, |
|
|
xrdc_periph_t |
periph |
|
) |
| |
A lock can be forced to the available state (EAL=10) by a domain that does not own the lock through the forced lock release procedure: The procedure to force a exclusive access lock release is as follows:
- Write 0x02000046 to W1 register (PAC/MSC) or W3 register (MRC)
- Write 0x02000052 to W1 register (PAC/MSC) or W3 register (MRC)
Note: The two writes must be consecutive, any intervening write to the register resets the sequence.
- Parameters
-
base | XRDC peripheral base address. |
periph | Which peripheral's exclusive access lock to force release. |
static uint8_t XRDC_GetPeriphExclAccessLockDomainOwner |
( |
XRDC_Type * |
base, |
|
|
xrdc_periph_t |
periph |
|
) |
| |
|
inlinestatic |
This function returns the domain ID of the exclusive access lock owner of the peripheral.
- Parameters
-
base | XRDC peripheral base address. |
periph | Which peripheral's exclusive access lock domain owner to get. |
- Returns
- Domain ID of the peripheral exclusive access lock owner.