The MCUXpresso SDK provides a driver for the Extended Resource Domain Controller 2 (XRDC2) block of MCUXpresso SDK devices.
XRDC2 functions
XRDC2 module includes such submodules:
- XRDC2_MGR The Manager submodule coordinates all programming model reads and writes.
- XRDC2_MDAC The Master Domain Assignment Controller handles resource assignments and generation of the domain identifiers (domain ID).
- XRDC2_MSC The Memory Slot Controller implements the access controls for slave memory slots based on the pre-programmed region descriptor registers.
- XRDC2_MRC The Memory Region Controller implements the access controls for slave memories based on the pre-programmed region descriptor registers.
- XRDC2_PAC The Peripheral Access Controller implements the access controls for slave peripherals based on the preprogrammed domain access control registers.
Accordingly, the XRDC2 driver functions could be grouped as follows:
- XRDC2_MGR functions.
- XRDC2_MDAC functions.
- XRDC2_MSC functions.
- XRDC2_MRC functions.
- XRDC2_PAC functions.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/xrdc2
|
enum | xrdc2_global_config_lock_t {
kXRDC2_GlobalConfigLockDisabled,
kXRDC2_GlobalConfigLockDisabledUntilReset,
kXRDC2_GlobalConfigLockOwnerOnly,
kXRDC2_GlobalConfigLockEnabledUntilReset
} |
| Global configuration lock. More...
|
|
enum | xrdc2_secure_attr_t {
kXRDC2_MasterSecure = 0,
kXRDC2_ForceSecure = 2,
kXRDC2_ForceNonSecure = 3
} |
| XRDC2 secure attribute, the register bit MDACi_MDAj_W0[SA], secure/nonsecure attribute output on a hit. More...
|
|
enum | xrdc2_privilege_attr_t {
kXRDC2_MasterPrivilege = 0,
kXRDC2_ForceUser = 2,
kXRDC2_ForcePrivilege = 3
} |
| XRDC2 privileged attribute, the register bit MDACi_MDAj_W0[PA], defines the privileged/user attribute on a hit. More...
|
|
enum | xrdc2_access_policy_t |
| XRDC2 domain access control policy.
|
|
enum | xrdc2_access_config_lock_t {
kXRDC2_AccessConfigLockDisabled = 0U,
kXRDC2_AccessConfigLockDisabledUntilReset = 1U,
kXRDC2_AccessConfigLockDomainXOnly = 2U,
kXRDC2_AccessConfigLockEnabledUntilReset = 3U
} |
| Access configuration lock mode, the register field PDAC and MRGD LK2. More...
|
|
|
void | XRDC2_GetMemSlotAccessDefaultConfig (xrdc2_mem_slot_access_config_t *config) |
| Gets the default memory slot access configuration. More...
|
|
void | XRDC2_SetMemSlotAccessConfig (XRDC2_Type *base, xrdc2_mem_slot_t memSlot, const xrdc2_mem_slot_access_config_t *config) |
| Sets the memory slot access policy. More...
|
|
void | XRDC2_SetMemSlotAccessValid (XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool valid) |
| Sets the memory slot descriptor as valid or invalid. More...
|
|
void | XRDC2_SetMemSlotAccessLockMode (XRDC2_Type *base, xrdc2_mem_slot_t memSlot, xrdc2_access_config_lock_t lockMode) |
| Sets the memory slot descriptor lock mode. More...
|
|
void | XRDC2_SetMemSlotDomainAccessPolicy (XRDC2_Type *base, xrdc2_mem_slot_t memSlot, uint8_t domainId, xrdc2_access_policy_t policy) |
| Sets the memory slot access policy for specific domain. More...
|
|
void | XRDC2_EnableMemSlotExclAccessLock (XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool enable) |
| Enable or disable the memory slot exclusive access lock. More...
|
|
uint8_t | XRDC2_GetMemSlotExclAccessLockDomainOwner (XRDC2_Type *base, xrdc2_mem_slot_t memSlot) |
| Get current memory slot exclusive access lock owner. More...
|
|
status_t | XRDC2_TryLockMemSlotExclAccess (XRDC2_Type *base, xrdc2_mem_slot_t memSlot) |
| Try to lock the memory slot exclusive access. More...
|
|
void | XRDC2_LockMemSlotExclAccess (XRDC2_Type *base, xrdc2_mem_slot_t memSlot) |
| Lock the memory slot exclusive access using blocking method. More...
|
|
static void | XRDC2_UnlockMemSlotExclAccess (XRDC2_Type *base, xrdc2_mem_slot_t memSlot) |
| Unlock the memory slot exclusive access. More...
|
|
static void | XRDC2_ForceMemSlotExclAccessLockRelease (XRDC2_Type *base, xrdc2_mem_slot_t memSlot) |
| Force the memory slot exclusive access lock release. More...
|
|
|
void | XRDC2_GetMemAccessDefaultConfig (xrdc2_mem_access_config_t *config) |
| Gets the default memory access configuration. More...
|
|
void | XRDC2_SetMemAccessConfig (XRDC2_Type *base, xrdc2_mem_t mem, const xrdc2_mem_access_config_t *config) |
| Sets the memory region access policy. More...
|
|
void | XRDC2_SetMemAccessValid (XRDC2_Type *base, xrdc2_mem_t mem, bool valid) |
| Sets the memory region descriptor as valid or invalid. More...
|
|
void | XRDC2_SetMemAccessLockMode (XRDC2_Type *base, xrdc2_mem_t mem, xrdc2_access_config_lock_t lockMode) |
| Sets the memory descriptor lock mode. More...
|
|
void | XRDC2_SetMemDomainAccessPolicy (XRDC2_Type *base, xrdc2_mem_t mem, uint8_t domainId, xrdc2_access_policy_t policy) |
| Sets the memory region access policy for specific domain. More...
|
|
void | XRDC2_EnableMemExclAccessLock (XRDC2_Type *base, xrdc2_mem_t mem, bool enable) |
| Enable or disable the memory region exclusive access lock. More...
|
|
uint8_t | XRDC2_GetMemExclAccessLockDomainOwner (XRDC2_Type *base, xrdc2_mem_t mem) |
| Get current memory region exclusive access lock owner. More...
|
|
status_t | XRDC2_TryLockMemExclAccess (XRDC2_Type *base, xrdc2_mem_t mem) |
| Try to lock the memory region exclusive access. More...
|
|
void | XRDC2_LockMemExclAccess (XRDC2_Type *base, xrdc2_mem_t mem) |
| Lock the memory region exclusive access using blocking method. More...
|
|
void | XRDC2_UnlockMemExclAccess (XRDC2_Type *base, xrdc2_mem_t mem) |
| Unlock the memory region exclusive access. More...
|
|
void | XRDC2_ForceMemExclAccessLockRelease (XRDC2_Type *base, xrdc2_mem_t mem) |
| Force the memory region exclusive access lock release. More...
|
|
|
void | XRDC2_GetPeriphAccessDefaultConfig (xrdc2_periph_access_config_t *config) |
| Gets the default peripheral access configuration. More...
|
|
void | XRDC2_SetPeriphAccessConfig (XRDC2_Type *base, xrdc2_periph_t periph, const xrdc2_periph_access_config_t *config) |
| Sets the peripheral access policy. More...
|
|
void | XRDC2_SetPeriphAccessValid (XRDC2_Type *base, xrdc2_periph_t periph, bool valid) |
| Sets the peripheral descriptor as valid or invalid. More...
|
|
void | XRDC2_SetPeriphAccessLockMode (XRDC2_Type *base, xrdc2_periph_t periph, xrdc2_access_config_lock_t lockMode) |
| Sets the peripheral descriptor lock mode. More...
|
|
void | XRDC2_SetPeriphDomainAccessPolicy (XRDC2_Type *base, xrdc2_periph_t periph, uint8_t domainId, xrdc2_access_policy_t policy) |
| Sets the peripheral access policy for specific domain. More...
|
|
void | XRDC2_EnablePeriphExclAccessLock (XRDC2_Type *base, xrdc2_periph_t periph, bool enable) |
| Disable the peripheral exclusive access lock. More...
|
|
uint8_t | XRDC2_GetPeriphExclAccessLockDomainOwner (XRDC2_Type *base, xrdc2_periph_t periph) |
| Get current peripheral exclusive access lock owner. More...
|
|
status_t | XRDC2_TryLockPeriphExclAccess (XRDC2_Type *base, xrdc2_periph_t periph) |
| Try to lock the peripheral exclusive access. More...
|
|
void | XRDC2_LockPeriphExclAccess (XRDC2_Type *base, xrdc2_periph_t periph) |
| Lock the peripheral exclusive access using blocking method. More...
|
|
void | XRDC2_UnlockPeriphExclAccess (XRDC2_Type *base, xrdc2_periph_t periph) |
| Unlock the peripheral exclusive access. More...
|
|
void | XRDC2_ForcePeriphExclAccessLockRelease (XRDC2_Type *base, xrdc2_periph_t periph) |
| Force the peripheral exclusive access lock release. More...
|
|
struct xrdc2_master_domain_assignment_t |
XRDC2 compares the bus master match input with the parameter mask and match in this structure. If hit, the domain ID, privilege attribute, and secure attribute are used for the access.
bool xrdc2_master_domain_assignment_t::lock |
uint8_t xrdc2_master_domain_assignment_t::domainId |
uint16_t xrdc2_master_domain_assignment_t::mask |
uint16_t xrdc2_master_domain_assignment_t::match |
struct xrdc2_periph_access_config_t |
struct xrdc2_mem_access_config_t |
uint32_t xrdc2_mem_access_config_t::startAddr |
uint32_t xrdc2_mem_access_config_t::endAddr |
struct xrdc2_mem_slot_access_config_t |
Enumerator |
---|
kXRDC2_GlobalConfigLockDisabled |
Lock disabled, registers can be written by any domain.
|
kXRDC2_GlobalConfigLockDisabledUntilReset |
Lock disabled until the next reset.
|
kXRDC2_GlobalConfigLockOwnerOnly |
Lock enabled, only the lock owner can write.
|
kXRDC2_GlobalConfigLockEnabledUntilReset |
Lock enabled, all registers are read only until the next reset.
|
Enumerator |
---|
kXRDC2_MasterSecure |
Use the bus master's secure/nonsecure attribute directly.
|
kXRDC2_ForceSecure |
Force the bus attribute for this master to secure.
|
kXRDC2_ForceNonSecure |
Force the bus attribute for this master to non-secure.
|
Enumerator |
---|
kXRDC2_MasterPrivilege |
Use the bus master's attribute directly.
|
kXRDC2_ForceUser |
Force the bus attribute for this master to user.
|
kXRDC2_ForcePrivilege |
Force the bus attribute for this master to privileged.
|
Enumerator |
---|
kXRDC2_AccessConfigLockDisabled |
Entire PDACn/MRGDn/MSC can be written.
|
kXRDC2_AccessConfigLockDisabledUntilReset |
Entire PDACn/MRGDn/MSC can be written until next reset.
|
kXRDC2_AccessConfigLockDomainXOnly |
Domain x only write the DxACP field.
|
kXRDC2_AccessConfigLockEnabledUntilReset |
PDACn/MRGDn/MSC is read-only until the next reset.
|
void XRDC2_Init |
( |
XRDC2_Type * |
base | ) |
|
- Parameters
-
base | XRDC2 peripheral base address. |
void XRDC2_Deinit |
( |
XRDC2_Type * |
base | ) |
|
- Parameters
-
base | XRDC2 peripheral base address. |
void XRDC2_SetGlobalValid |
( |
XRDC2_Type * |
base, |
|
|
bool |
valid |
|
) |
| |
This function sets the XRDC2 global valid or invalid. When the XRDC2 is global invalid, all accesses from all bus masters to all slaves are allowed.
- Parameters
-
base | XRDC2 peripheral base address. |
valid | True to valid XRDC2. |
static uint8_t XRDC2_GetCurrentMasterDomainId |
( |
XRDC2_Type * |
base | ) |
|
|
inlinestatic |
This function returns the domain ID of the current bus master.
- Parameters
-
base | XRDC2 peripheral base address. |
- Returns
- Domain ID of current bus master.
Once change the lock mode, it could not be changed until next reset.
- Parameters
-
base | XRDC2 peripheral base address. |
lock | The lock mode. |
static uint8_t XRDC2_GetCurrentGlobalConfigLockOwnerDomainId |
( |
XRDC2_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | XRDC2 peripheral base address. |
- Returns
- Domain ID of the global configuration lock owner.
This function sets the assignment as follows:
* config->lock = false;
* config->domainId = 0U;
* config->mask = 0U;
* config->match = 0U;
*
- Parameters
-
assignment | Pointer to the assignment structure. |
- Parameters
-
base | XRDC2 peripheral base address. |
master | Which master to configure. |
assignIndex | Which assignment register to set. |
assignment | Pointer to the assignment structure. |
static void XRDC2_LockMasterDomainAssignment |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_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 | XRDC2 peripheral base address. |
master | Which master to configure. |
assignIndex | Which assignment register to lock. |
static void XRDC2_SetMasterDomainAssignmentValid |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_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 | XRDC2 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 sets the assignment as follows:
* config->policy[0] = kXRDC2_AccessPolicyNone;
* config->policy[1] = kXRDC2_AccessPolicyNone;
* ...
*
- Parameters
-
config | Pointer to the configuration. |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | Which memory slot descriptor to set. |
config | Pointer to the access policy configuration structure. |
void XRDC2_SetMemSlotAccessValid |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot, |
|
|
bool |
valid |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | Which memory slot descriptor to set. |
valid | True to set valid, false to set invalid. |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | Which memory slot descriptor to set. |
lockMode | The lock mode to set. |
void XRDC2_SetMemSlotDomainAccessPolicy |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot, |
|
|
uint8_t |
domainId, |
|
|
xrdc2_access_policy_t |
policy |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
domainId | The ID of the domain whose policy will be changed. |
policy | The access policy to set. |
void XRDC2_EnableMemSlotExclAccessLock |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot, |
|
|
bool |
enable |
|
) |
| |
The lock must be enabled first before use. Once disabled, it could not be enabled until reset.
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
enable | True to enable, false to disable. |
uint8_t XRDC2_GetMemSlotExclAccessLockDomainOwner |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
- Returns
- The domain ID of the lock owner.
status_t XRDC2_TryLockMemSlotExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
- Return values
-
kStatus_Fail | Failed to lock. |
kStatus_Success | Locked succussfully. |
void XRDC2_LockMemSlotExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
- Note
- This function must be called when the lock is not disabled.
static void XRDC2_UnlockMemSlotExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
- Note
- This function must be called by the lock owner.
static void XRDC2_ForceMemSlotExclAccessLockRelease |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_slot_t |
memSlot |
|
) |
| |
|
inlinestatic |
The master does not own the lock could call this function to force release the lock.
- Parameters
-
base | XRDC2 peripheral base address. |
memSlot | The memory slot to operate. |
This function sets the assignment as follows:
* config->startAddr = 0U;
* config->endAddr = 0xFFFFFFFFU;
* config->policy[0] = kXRDC2_AccessPolicyNone;
* config->policy[1] = kXRDC2_AccessPolicyNone;
* ...
*
- Parameters
-
config | Pointer to the configuration. |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | Which memory region descriptor to set. |
config | Pointer to the access policy configuration structure. |
void XRDC2_SetMemAccessValid |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem, |
|
|
bool |
valid |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | Which memory region descriptor to set. |
valid | True to set valid, false to set invalid. |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | Which memory descriptor to set. |
lockMode | The lock mode to set. |
void XRDC2_SetMemDomainAccessPolicy |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem, |
|
|
uint8_t |
domainId, |
|
|
xrdc2_access_policy_t |
policy |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
domainId | The ID of the domain whose policy will be changed. |
policy | The access policy to set. |
void XRDC2_EnableMemExclAccessLock |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem, |
|
|
bool |
enable |
|
) |
| |
Once disabled, it could not be enabled until reset.
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
enable | True to enable, false to disable. |
uint8_t XRDC2_GetMemExclAccessLockDomainOwner |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
- Returns
- The domain ID of the lock owner.
status_t XRDC2_TryLockMemExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
- Return values
-
kStatus_Fail | Failed to lock. |
kStatus_Success | Locked succussfully. |
void XRDC2_LockMemExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
- Note
- This function must be called when the lock is not disabled.
void XRDC2_UnlockMemExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
- Note
- This function must be called by the lock owner.
void XRDC2_ForceMemExclAccessLockRelease |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_mem_t |
mem |
|
) |
| |
The master does not own the lock could call this function to force release the lock.
- Parameters
-
base | XRDC2 peripheral base address. |
mem | The memory region to operate. |
The default configuration is set as follows:
* config->lockMode = kXRDC2_AccessConfigLockWritable;
* config->policy[0] = kXRDC2_AccessPolicyNone;
* config->policy[1] = kXRDC2_AccessPolicyNone;
* ...
* config->policy[15] = kXRDC2_AccessPolicyNone;
*
- Parameters
-
config | Pointer to the configuration structure. |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | Which peripheral descriptor to set. |
config | Pointer to the access policy configuration structure. |
void XRDC2_SetPeriphAccessValid |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph, |
|
|
bool |
valid |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | Which peripheral descriptor to set. |
valid | True to set valid, false to set invalid. |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | Which peripheral descriptor to set. |
lockMode | The lock mode to set. |
void XRDC2_SetPeriphDomainAccessPolicy |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph, |
|
|
uint8_t |
domainId, |
|
|
xrdc2_access_policy_t |
policy |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
domainId | The ID of the domain whose policy will be changed. |
policy | The access policy to set. |
void XRDC2_EnablePeriphExclAccessLock |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph, |
|
|
bool |
enable |
|
) |
| |
Once disabled, it could not be enabled until reset.
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
enable | True to enable, false to disable. |
uint8_t XRDC2_GetPeriphExclAccessLockDomainOwner |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
- Returns
- The domain ID of the lock owner.
status_t XRDC2_TryLockPeriphExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
- Return values
-
kStatus_Fail | Failed to lock. |
kStatus_Success | Locked succussfully. |
void XRDC2_LockPeriphExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
- Note
- This function must be called when the lock is not disabled.
void XRDC2_UnlockPeriphExclAccess |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph |
|
) |
| |
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |
- Note
- This function must be called by the lock owner.
void XRDC2_ForcePeriphExclAccessLockRelease |
( |
XRDC2_Type * |
base, |
|
|
xrdc2_periph_t |
periph |
|
) |
| |
The master does not own the lock could call this function to force release the lock.
- Parameters
-
base | XRDC2 peripheral base address. |
periph | The peripheral to operate. |