Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:02

0001 /*
0002  * Copyright 2019-2020 NXP
0003  * All rights reserved.
0004  *
0005  * SPDX-License-Identifier: BSD-3-Clause
0006  */
0007 
0008 #ifndef _FSL_XRDC2_H_
0009 #define _FSL_XRDC2_H_
0010 
0011 #include "fsl_common.h"
0012 
0013 /*!
0014  * @addtogroup xrdc2
0015  * @{
0016  */
0017 
0018 /******************************************************************************
0019  * Definitions
0020  *****************************************************************************/
0021 /*! @brief Driver version. */
0022 #define FSL_XRDC2_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
0023 
0024 /* Definitions for XRDC2 Exclusive access lock. */
0025 #define XRDC2_EAL_FORCE_RELEASE_MAGIC_0 0x02000046UL
0026 #define XRDC2_EAL_FORCE_RELEASE_MAGIC_1 0x02000052UL
0027 
0028 #define XRDC2_EAL_DISABLE             (0UL << XRDC2_MSC_MSAC_W1_EAL_SHIFT)
0029 #define XRDC2_EAL_DISABLE_UNTIL_RESET (1UL << XRDC2_MSC_MSAC_W1_EAL_SHIFT)
0030 #define XRDC2_EAL_UNLOCKED            (2UL << XRDC2_MSC_MSAC_W1_EAL_SHIFT)
0031 #define XRDC2_EAL_LOCKED              (3UL << XRDC2_MSC_MSAC_W1_EAL_SHIFT)
0032 
0033 #define XRDC2_EAL_MASK XRDC2_MSC_MSAC_W1_EAL_MASK
0034 
0035 /*!
0036  * @brief Global configuration lock.
0037  */
0038 typedef enum _xrdc2_global_config_lock
0039 {
0040     kXRDC2_GlobalConfigLockDisabled,           /*!< Lock disabled, registers can be written by any domain. */
0041     kXRDC2_GlobalConfigLockDisabledUntilReset, /*!< Lock disabled until the next reset. */
0042     kXRDC2_GlobalConfigLockOwnerOnly,          /*!< Lock enabled, only the lock owner can write. */
0043     kXRDC2_GlobalConfigLockEnabledUntilReset   /*!< Lock enabled, all registers are read only until the next reset. */
0044 } xrdc2_global_config_lock_t;
0045 
0046 /*!
0047  * @brief XRDC2 secure attribute, the register bit MDACi_MDAj_W0[SA],
0048  * secure/nonsecure attribute output on a hit.
0049  */
0050 typedef enum _xrdc2_secure_attr
0051 {
0052     kXRDC2_MasterSecure   = 0, /*!< Use the bus master's secure/nonsecure attribute directly. */
0053     kXRDC2_ForceSecure    = 2, /*!< Force the bus attribute for this master to secure.        */
0054     kXRDC2_ForceNonSecure = 3, /*!< Force the bus attribute for this master to non-secure.    */
0055 } xrdc2_secure_attr_t;
0056 
0057 /*!
0058  * @brief XRDC2 privileged attribute, the register bit MDACi_MDAj_W0[PA],
0059  * defines the privileged/user attribute on a hit.
0060  */
0061 typedef enum _xrdc2_privilege_attr
0062 {
0063     kXRDC2_MasterPrivilege = 0, /*!< Use the bus master's attribute directly. */
0064     kXRDC2_ForceUser       = 2, /*!< Force the bus attribute for this master to user.       */
0065     kXRDC2_ForcePrivilege  = 3, /*!< Force the bus attribute for this master to privileged. */
0066 } xrdc2_privilege_attr_t;
0067 
0068 /*!
0069  * @brief Domain assignment for the bus master.
0070  *
0071  * XRDC2 compares the bus master @e match @e input with the parameter @ref mask
0072  * and @ref match in this structure. If hit, the domain ID, privilege attribute,
0073  * and secure attribute are used for the access.
0074  */
0075 typedef struct _xrdc2_master_domain_assignment
0076 {
0077     bool lock;                            /*!< Set true to lock the descriptor. */
0078     xrdc2_privilege_attr_t privilegeAttr; /*!< Privilege attribute. */
0079     xrdc2_secure_attr_t secureAttr;       /*!< Secure attribute. */
0080     uint8_t domainId;                     /*!< Domain ID used when this descriptor hit. */
0081     uint16_t mask;                        /*!< Mask used for descriptor hit. */
0082     uint16_t match;                       /*!< Match used for descriptor hit. */
0083 } xrdc2_master_domain_assignment_t;
0084 
0085 /*!
0086  * @brief XRDC2 domain access control policy.
0087  */
0088 typedef enum _xrdc2_access_policy
0089 {
0090     /*                               policy SecurePriv  SecureUser  NonSecurePriv  NonSecureUsr */
0091     kXRDC2_AccessPolicyNone = 0U, /*  000      none        none        none            none     */
0092     kXRDC2_AccessPolicyAlt1 = 1U, /*  001      r             r         none            none     */
0093     kXRDC2_AccessPolicyAlt2 = 2U, /*  010      r,w         none        none            none     */
0094     kXRDC2_AccessPolicyAlt3 = 3U, /*  011      r,w          r,w        none            none     */
0095     kXRDC2_AccessPolicyAlt4 = 4U, /*  100      r,w          r,w         r              none     */
0096     kXRDC2_AccessPolicyAlt5 = 5U, /*  101      r,w          r,w         r                r      */
0097     kXRDC2_AccessPolicyAlt6 = 6U, /*  110      r,w          r,w         r,w            none     */
0098     kXRDC2_AccessPolicyAll  = 7U  /*  111      r,w          r,w         r,w             r,w     */
0099 } xrdc2_access_policy_t;
0100 
0101 /*!
0102  * @brief Access configuration lock mode, the register field PDAC and MRGD LK2.
0103  */
0104 typedef enum _xrdc2_access_config_lock
0105 {
0106     kXRDC2_AccessConfigLockDisabled           = 0U, /*!< Entire PDACn/MRGDn/MSC can be written.       */
0107     kXRDC2_AccessConfigLockDisabledUntilReset = 1U, /*!< Entire PDACn/MRGDn/MSC can be written until next reset. */
0108     kXRDC2_AccessConfigLockDomainXOnly        = 2U, /*!< Domain x only write the DxACP field.     */
0109     kXRDC2_AccessConfigLockEnabledUntilReset  = 3U  /*!< PDACn/MRGDn/MSC is read-only until the next reset. */
0110 } xrdc2_access_config_lock_t;
0111 
0112 /*!
0113  * @brief XRDC2 peripheral domain access control configuration.
0114  */
0115 typedef struct _xrdc2_periph_access_config
0116 {
0117     xrdc2_access_config_lock_t lockMode;                          /*!< PDACn lock configuration.      */
0118     xrdc2_access_policy_t policy[FSL_FEATURE_XRDC2_DOMAIN_COUNT]; /*!< Access policy for each domain. */
0119 } xrdc2_periph_access_config_t;
0120 
0121 /*!
0122  * @brief XRDC2 memory region domain access control configuration.
0123  */
0124 typedef struct _xrdc2_mem_access_config
0125 {
0126     uint32_t startAddr;                  /*!< Memory region start address, should be 4k aligned. */
0127     uint32_t endAddr;                    /*!< Memory region end address, (endAddr + 1) should be 4k aligned. */
0128     xrdc2_access_config_lock_t lockMode; /*!< MRGDn lock configuration.      */
0129     xrdc2_access_policy_t policy[FSL_FEATURE_XRDC2_DOMAIN_COUNT]; /*!< Access policy for each domain. */
0130 } xrdc2_mem_access_config_t;
0131 
0132 /*!
0133  * @brief XRDC2 memory slot domain access control configuration.
0134  */
0135 typedef struct _xrdc2_mem_slot_access_config
0136 {
0137     xrdc2_access_config_lock_t lockMode;                          /*!< Descriptor lock configuration.      */
0138     xrdc2_access_policy_t policy[FSL_FEATURE_XRDC2_DOMAIN_COUNT]; /*!< Access policy for each domain. */
0139 } xrdc2_mem_slot_access_config_t;
0140 
0141 /*******************************************************************************
0142  * API
0143  ******************************************************************************/
0144 
0145 #if defined(__cplusplus)
0146 extern "C" {
0147 #endif
0148 
0149 /*!
0150  * @brief Initializes the XRDC2 module.
0151  *
0152  * @param base XRDC2 peripheral base address.
0153  */
0154 void XRDC2_Init(XRDC2_Type *base);
0155 
0156 /*!
0157  * @brief De-initializes the XRDC2 module.
0158  *
0159  * @param base XRDC2 peripheral base address.
0160  */
0161 void XRDC2_Deinit(XRDC2_Type *base);
0162 
0163 /*!
0164  * @name XRDC2 manager (XRDC2)
0165  * @{
0166  */
0167 
0168 /*!
0169  * @brief Sets the XRDC2 global valid.
0170  *
0171  * This function sets the XRDC2 global valid or invalid. When the XRDC2 is global
0172  * invalid, all accesses from all bus masters to all slaves are allowed.
0173  *
0174  * @param base XRDC2 peripheral base address.
0175  * @param valid True to valid XRDC2.
0176  */
0177 void XRDC2_SetGlobalValid(XRDC2_Type *base, bool valid);
0178 
0179 /*!
0180  * @brief Gets the domain ID of the current bus master.
0181  *
0182  * This function returns the domain ID of the current bus master.
0183  *
0184  * @param base XRDC2 peripheral base address.
0185  * @return Domain ID of current bus master.
0186  */
0187 static inline uint8_t XRDC2_GetCurrentMasterDomainId(XRDC2_Type *base)
0188 {
0189 #if defined(XRDC2_SR_DIN_MASK)
0190     return (uint8_t)((base->SR & XRDC2_SR_DIN_MASK) >> XRDC2_SR_DIN_SHIFT);
0191 #else
0192     return (uint8_t)((base->SR & XRDC2_SR_DID_MASK) >> XRDC2_SR_DID_SHIFT);
0193 #endif
0194 }
0195 
0196 /*!
0197  * @brief Set the global configuration lock mode.
0198  *
0199  * Once change the lock mode, it could not be changed until next reset.
0200  *
0201  * @param base XRDC2 peripheral base address.
0202  * @param mode The lock mode.
0203  */
0204 static inline void XRDC2_SetGlobalConfigLock(XRDC2_Type *base, xrdc2_global_config_lock_t mode)
0205 {
0206     base->MCR = (base->MCR & ~XRDC2_MCR_GCL_MASK) | XRDC2_MCR_GCL(mode);
0207 }
0208 
0209 /*!
0210  * @brief Gets the domain ID of global configuration lock owner.
0211  *
0212  * @param base XRDC2 peripheral base address.
0213  * @return Domain ID of the global configuration lock owner.
0214  */
0215 static inline uint8_t XRDC2_GetCurrentGlobalConfigLockOwnerDomainId(XRDC2_Type *base)
0216 {
0217     return (uint8_t)((base->SR & XRDC2_SR_GCLO_MASK) >> XRDC2_SR_GCLO_SHIFT);
0218 }
0219 
0220 /*@}*/
0221 
0222 /*!
0223  * @name XRDC2 Master Domain Assignment Controller (XRDC2_MDAC).
0224  * @{
0225  */
0226 
0227 /*!
0228  * @brief Gets the default master domain assignment.
0229  *
0230  * This function sets the assignment as follows:
0231  *
0232  * @code
0233  *  config->lock = false;
0234  *  config->privilegeAttr = kXRDC2_MasterPrivilege;
0235  *  config->secureAttr = kXRDC2_MasterSecure;
0236  *  config->domainId = 0U;
0237  *  config->mask = 0U;
0238  *  config->match = 0U;
0239  * @endcode
0240  *
0241  * @param assignment Pointer to the assignment structure.
0242  */
0243 void XRDC2_GetDefaultMasterDomainAssignment(xrdc2_master_domain_assignment_t *assignment);
0244 
0245 /*!
0246  * @brief Sets the processor bus master domain assignment.
0247  *
0248  * @param base XRDC2 peripheral base address.
0249  * @param master Which master to configure.
0250  * @param assignIndex Which assignment register to set.
0251  * @param assignment Pointer to the assignment structure.
0252  */
0253 void XRDC2_SetMasterDomainAssignment(XRDC2_Type *base,
0254                                      xrdc2_master_t master,
0255                                      uint8_t assignIndex,
0256                                      const xrdc2_master_domain_assignment_t *assignment);
0257 
0258 /*!
0259  * @brief Locks the bus master domain assignment register.
0260  *
0261  * This function locks the master domain assignment. One bus master might have
0262  * multiple domain assignment registers. The parameter \p assignIndex specifies
0263  * which assignment register to lock. After it is locked, the register can't be changed
0264  * until next reset.
0265  *
0266  * @param base XRDC2 peripheral base address.
0267  * @param master Which master to configure.
0268  * @param assignIndex Which assignment register to lock.
0269  */
0270 static inline void XRDC2_LockMasterDomainAssignment(XRDC2_Type *base, xrdc2_master_t master, uint8_t assignIndex)
0271 {
0272     base->MDACI_MDAJ[master][assignIndex].MDAC_MDA_W1 |= XRDC2_MDAC_MDA_W1_DL_MASK;
0273 }
0274 
0275 /*!
0276  * @brief Sets the master domain assignment as valid or invalid.
0277  *
0278  * This function sets the master domain assignment as valid or invalid. One bus master might have
0279  * multiple domain assignment registers. The parameter \p assignIndex specifies
0280  * which assignment register to configure.
0281  *
0282  * @param base XRDC2 peripheral base address.
0283  * @param master Which master to configure.
0284  * @param assignIndex Index for the domain assignment register.
0285  * @param valid True to set valid, false to set invalid.
0286  */
0287 static inline void XRDC2_SetMasterDomainAssignmentValid(XRDC2_Type *base,
0288                                                         xrdc2_master_t master,
0289                                                         uint8_t assignIndex,
0290                                                         bool valid)
0291 {
0292     if (valid)
0293     {
0294         base->MDACI_MDAJ[master][assignIndex].MDAC_MDA_W1 |= XRDC2_MDAC_MDA_W1_VLD_MASK;
0295     }
0296     else
0297     {
0298         base->MDACI_MDAJ[master][assignIndex].MDAC_MDA_W1 &= ~XRDC2_MDAC_MDA_W1_VLD_MASK;
0299     }
0300 }
0301 
0302 /*@}*/
0303 
0304 /*!
0305  * @name XRDC2 Memory Slot Access Controller (XRDC2_MSC).
0306  * @{
0307  */
0308 
0309 /*!
0310  * @brief Gets the default memory slot access configuration.
0311  *
0312  * This function sets the assignment as follows:
0313  *
0314  * @code
0315  *  config->lockMode = kXRDC2_AccessConfigLockDisabled;
0316  *  config->policy[0] = kXRDC2_AccessPolicyNone;
0317  *  config->policy[1] = kXRDC2_AccessPolicyNone;
0318  *  ...
0319  * @endcode
0320  *
0321  * @param config Pointer to the configuration.
0322  */
0323 void XRDC2_GetMemSlotAccessDefaultConfig(xrdc2_mem_slot_access_config_t *config);
0324 
0325 /*!
0326  * @brief Sets the memory slot access policy.
0327  *
0328  * @param base XRDC2 peripheral base address.
0329  * @param memSlot Which memory slot descriptor to set.
0330  * @param config Pointer to the access policy configuration structure.
0331  */
0332 void XRDC2_SetMemSlotAccessConfig(XRDC2_Type *base,
0333                                   xrdc2_mem_slot_t memSlot,
0334                                   const xrdc2_mem_slot_access_config_t *config);
0335 
0336 /*!
0337  * @brief Sets the memory slot descriptor as valid or invalid.
0338  *
0339  * @param base XRDC2 peripheral base address.
0340  * @param memSlot Which memory slot descriptor to set.
0341  * @param valid True to set valid, false to set invalid.
0342  */
0343 void XRDC2_SetMemSlotAccessValid(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool valid);
0344 
0345 /*!
0346  * @brief Sets the memory slot descriptor lock mode.
0347  *
0348  * @param base XRDC2 peripheral base address.
0349  * @param memSlot Which memory slot descriptor to set.
0350  * @param lockMode The lock mode to set.
0351  */
0352 void XRDC2_SetMemSlotAccessLockMode(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, xrdc2_access_config_lock_t lockMode);
0353 
0354 /*!
0355  * @brief Sets the memory slot access policy for specific domain.
0356  *
0357  * @param base XRDC2 peripheral base address.
0358  * @param memSlot The memory slot to operate.
0359  * @param domainId The ID of the domain whose policy will be changed.
0360  * @param policy The access policy to set.
0361  */
0362 void XRDC2_SetMemSlotDomainAccessPolicy(XRDC2_Type *base,
0363                                         xrdc2_mem_slot_t memSlot,
0364                                         uint8_t domainId,
0365                                         xrdc2_access_policy_t policy);
0366 
0367 /*!
0368  * @brief Enable or disable the memory slot exclusive access lock.
0369  *
0370  * The lock must be enabled first before use. Once disabled, it could not be
0371  * enabled until reset.
0372  *
0373  * @param base XRDC2 peripheral base address.
0374  * @param memSlot The memory slot to operate.
0375  * @param enable True to enable, false to disable.
0376  */
0377 void XRDC2_EnableMemSlotExclAccessLock(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool enable);
0378 
0379 /*!
0380  * @brief Get current memory slot exclusive access lock owner.
0381  *
0382  * @param base XRDC2 peripheral base address.
0383  * @param memSlot The memory slot to operate.
0384  * @return The domain ID of the lock owner.
0385  */
0386 uint8_t XRDC2_GetMemSlotExclAccessLockDomainOwner(XRDC2_Type *base, xrdc2_mem_slot_t memSlot);
0387 
0388 /*!
0389  * @brief Try to lock the memory slot exclusive access.
0390  *
0391  * @param base XRDC2 peripheral base address.
0392  * @param memSlot The memory slot to operate.
0393  * @retval kStatus_Fail Failed to lock.
0394  * @retval kStatus_Success Locked succussfully.
0395  */
0396 status_t XRDC2_TryLockMemSlotExclAccess(XRDC2_Type *base, xrdc2_mem_slot_t memSlot);
0397 
0398 /*!
0399  * @brief Lock the memory slot exclusive access using blocking method.
0400  *
0401  * @param base XRDC2 peripheral base address.
0402  * @param memSlot The memory slot to operate.
0403  *
0404  * @note This function must be called when the lock is not disabled.
0405  */
0406 void XRDC2_LockMemSlotExclAccess(XRDC2_Type *base, xrdc2_mem_slot_t memSlot);
0407 
0408 /*!
0409  * @brief Unlock the memory slot exclusive access.
0410  *
0411  * @param base XRDC2 peripheral base address.
0412  * @param memSlot The memory slot to operate.
0413  *
0414  * @note This function must be called by the lock owner.
0415  */
0416 static inline void XRDC2_UnlockMemSlotExclAccess(XRDC2_Type *base, xrdc2_mem_slot_t memSlot)
0417 {
0418     base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = XRDC2_EAL_UNLOCKED;
0419 }
0420 
0421 /*!
0422  * @brief Force the memory slot exclusive access lock release.
0423  *
0424  * The master does not own the lock could call this function to force release the lock.
0425  *
0426  * @param base XRDC2 peripheral base address.
0427  * @param memSlot The memory slot to operate.
0428  */
0429 static inline void XRDC2_ForceMemSlotExclAccessLockRelease(XRDC2_Type *base, xrdc2_mem_slot_t memSlot)
0430 {
0431     base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = XRDC2_EAL_FORCE_RELEASE_MAGIC_0;
0432     base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = XRDC2_EAL_FORCE_RELEASE_MAGIC_1;
0433 }
0434 
0435 /*@}*/
0436 
0437 /*!
0438  * @name XRDC2 Memory Region Controller (XRDC2_MRC)
0439  * @{
0440  */
0441 
0442 /*!
0443  * @brief Gets the default memory access configuration.
0444  *
0445  * This function sets the assignment as follows:
0446  *
0447  * @code
0448  *  config->startAddr = 0U;
0449  *  config->endAddr = 0xFFFFFFFFU;
0450  *  config->lockMode = kXRDC2_AccessConfigLockDisabled;
0451  *  config->policy[0] = kXRDC2_AccessPolicyNone;
0452  *  config->policy[1] = kXRDC2_AccessPolicyNone;
0453  *  ...
0454  * @endcode
0455  *
0456  * @param config Pointer to the configuration.
0457  */
0458 void XRDC2_GetMemAccessDefaultConfig(xrdc2_mem_access_config_t *config);
0459 
0460 /*!
0461  * @brief Sets the memory region access policy.
0462  *
0463  * @param base XRDC2 peripheral base address.
0464  * @param mem Which memory region descriptor to set.
0465  * @param config Pointer to the access policy configuration structure.
0466  */
0467 void XRDC2_SetMemAccessConfig(XRDC2_Type *base, xrdc2_mem_t mem, const xrdc2_mem_access_config_t *config);
0468 
0469 /*!
0470  * @brief Sets the memory region descriptor as valid or invalid.
0471  *
0472  * @param base XRDC2 peripheral base address.
0473  * @param mem Which memory region descriptor to set.
0474  * @param valid True to set valid, false to set invalid.
0475  */
0476 void XRDC2_SetMemAccessValid(XRDC2_Type *base, xrdc2_mem_t mem, bool valid);
0477 
0478 /*!
0479  * @brief Sets the memory descriptor lock mode.
0480  *
0481  * @param base XRDC2 peripheral base address.
0482  * @param mem Which memory descriptor to set.
0483  * @param lockMode The lock mode to set.
0484  */
0485 void XRDC2_SetMemAccessLockMode(XRDC2_Type *base, xrdc2_mem_t mem, xrdc2_access_config_lock_t lockMode);
0486 
0487 /*!
0488  * @brief Sets the memory region access policy for specific domain.
0489  *
0490  * @param base XRDC2 peripheral base address.
0491  * @param mem The memory region to operate.
0492  * @param domainId The ID of the domain whose policy will be changed.
0493  * @param policy The access policy to set.
0494  */
0495 void XRDC2_SetMemDomainAccessPolicy(XRDC2_Type *base, xrdc2_mem_t mem, uint8_t domainId, xrdc2_access_policy_t policy);
0496 
0497 /*!
0498  * @brief Enable or disable the memory region exclusive access lock.
0499  *
0500  * Once disabled, it could not be enabled until reset.
0501  *
0502  * @param base XRDC2 peripheral base address.
0503  * @param mem The memory region to operate.
0504  * @param enable True to enable, false to disable.
0505  */
0506 void XRDC2_EnableMemExclAccessLock(XRDC2_Type *base, xrdc2_mem_t mem, bool enable);
0507 
0508 /*!
0509  * @brief Get current memory region exclusive access lock owner.
0510  *
0511  * @param base XRDC2 peripheral base address.
0512  * @param mem The memory region to operate.
0513  * @return The domain ID of the lock owner.
0514  */
0515 uint8_t XRDC2_GetMemExclAccessLockDomainOwner(XRDC2_Type *base, xrdc2_mem_t mem);
0516 
0517 /*!
0518  * @brief Try to lock the memory region exclusive access.
0519  *
0520  * @param base XRDC2 peripheral base address.
0521  * @param mem The memory region to operate.
0522  * @retval kStatus_Fail Failed to lock.
0523  * @retval kStatus_Success Locked succussfully.
0524  */
0525 status_t XRDC2_TryLockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem);
0526 
0527 /*!
0528  * @brief Lock the memory region exclusive access using blocking method.
0529  *
0530  * @param base XRDC2 peripheral base address.
0531  * @param mem The memory region to operate.
0532  *
0533  * @note This function must be called when the lock is not disabled.
0534  */
0535 void XRDC2_LockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem);
0536 
0537 /*!
0538  * @brief Unlock the memory region exclusive access.
0539  *
0540  * @param base XRDC2 peripheral base address.
0541  * @param mem The memory region to operate.
0542  *
0543  * @note This function must be called by the lock owner.
0544  */
0545 void XRDC2_UnlockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem);
0546 
0547 /*!
0548  * @brief Force the memory region exclusive access lock release.
0549  *
0550  * The master does not own the lock could call this function to force release the lock.
0551  *
0552  * @param base XRDC2 peripheral base address.
0553  * @param mem The memory region to operate.
0554  */
0555 void XRDC2_ForceMemExclAccessLockRelease(XRDC2_Type *base, xrdc2_mem_t mem);
0556 
0557 /*@}*/
0558 
0559 /*!
0560  * @name XRDC2 Peripheral Access Controller (XRDC2_PAC)
0561  * @{
0562  */
0563 
0564 /*!
0565  * @brief Gets the default peripheral access configuration.
0566  *
0567  * The default configuration is set as follows:
0568  * @code
0569  * config->lockMode          = kXRDC2_AccessConfigLockWritable;
0570  * config->policy[0]         = kXRDC2_AccessPolicyNone;
0571  * config->policy[1]         = kXRDC2_AccessPolicyNone;
0572  * ...
0573  * config->policy[15]        = kXRDC2_AccessPolicyNone;
0574  * @endcode
0575  *
0576  * @param config Pointer to the configuration structure.
0577  */
0578 void XRDC2_GetPeriphAccessDefaultConfig(xrdc2_periph_access_config_t *config);
0579 
0580 /*!
0581  * @brief Sets the peripheral access policy.
0582  *
0583  * @param base XRDC2 peripheral base address.
0584  * @param periph Which peripheral descriptor to set.
0585  * @param config Pointer to the access policy configuration structure.
0586  */
0587 void XRDC2_SetPeriphAccessConfig(XRDC2_Type *base, xrdc2_periph_t periph, const xrdc2_periph_access_config_t *config);
0588 
0589 /*!
0590  * @brief Sets the peripheral descriptor as valid or invalid.
0591  *
0592  * @param base XRDC2 peripheral base address.
0593  * @param periph Which peripheral descriptor to set.
0594  * @param valid True to set valid, false to set invalid.
0595  */
0596 void XRDC2_SetPeriphAccessValid(XRDC2_Type *base, xrdc2_periph_t periph, bool valid);
0597 
0598 /*!
0599  * @brief Sets the peripheral descriptor lock mode.
0600  *
0601  * @param base XRDC2 peripheral base address.
0602  * @param periph Which peripheral descriptor to set.
0603  * @param lockMode The lock mode to set.
0604  */
0605 void XRDC2_SetPeriphAccessLockMode(XRDC2_Type *base, xrdc2_periph_t periph, xrdc2_access_config_lock_t lockMode);
0606 
0607 /*!
0608  * @brief Sets the peripheral access policy for specific domain.
0609  *
0610  * @param base XRDC2 peripheral base address.
0611  * @param periph The peripheral to operate.
0612  * @param domainId The ID of the domain whose policy will be changed.
0613  * @param policy The access policy to set.
0614  */
0615 void XRDC2_SetPeriphDomainAccessPolicy(XRDC2_Type *base,
0616                                        xrdc2_periph_t periph,
0617                                        uint8_t domainId,
0618                                        xrdc2_access_policy_t policy);
0619 
0620 /*!
0621  * @brief Disable the peripheral exclusive access lock.
0622  *
0623  * Once disabled, it could not be enabled until reset.
0624  *
0625  * @param base XRDC2 peripheral base address.
0626  * @param periph The peripheral to operate.
0627  * @param enable True to enable, false to disable.
0628  */
0629 void XRDC2_EnablePeriphExclAccessLock(XRDC2_Type *base, xrdc2_periph_t periph, bool enable);
0630 
0631 /*!
0632  * @brief Get current peripheral exclusive access lock owner.
0633  *
0634  * @param base XRDC2 peripheral base address.
0635  * @param periph The peripheral to operate.
0636  * @return The domain ID of the lock owner.
0637  */
0638 uint8_t XRDC2_GetPeriphExclAccessLockDomainOwner(XRDC2_Type *base, xrdc2_periph_t periph);
0639 
0640 /*!
0641  * @brief Try to lock the peripheral exclusive access.
0642  *
0643  * @param base XRDC2 peripheral base address.
0644  * @param periph The peripheral to operate.
0645  * @retval kStatus_Fail Failed to lock.
0646  * @retval kStatus_Success Locked succussfully.
0647  */
0648 status_t XRDC2_TryLockPeriphExclAccess(XRDC2_Type *base, xrdc2_periph_t periph);
0649 
0650 /*!
0651  * @brief Lock the peripheral exclusive access using blocking method.
0652  *
0653  * @param base XRDC2 peripheral base address.
0654  * @param periph The peripheral to operate.
0655  *
0656  * @note This function must be called when the lock is not disabled.
0657  */
0658 void XRDC2_LockPeriphExclAccess(XRDC2_Type *base, xrdc2_periph_t periph);
0659 
0660 /*!
0661  * @brief Unlock the peripheral exclusive access.
0662  *
0663  * @param base XRDC2 peripheral base address.
0664  * @param periph The peripheral to operate.
0665  *
0666  * @note This function must be called by the lock owner.
0667  */
0668 void XRDC2_UnlockPeriphExclAccess(XRDC2_Type *base, xrdc2_periph_t periph);
0669 
0670 /*!
0671  * @brief Force the peripheral exclusive access lock release.
0672  *
0673  * The master does not own the lock could call this function to force release the lock.
0674  *
0675  * @param base XRDC2 peripheral base address.
0676  * @param periph The peripheral to operate.
0677  */
0678 void XRDC2_ForcePeriphExclAccessLockRelease(XRDC2_Type *base, xrdc2_periph_t periph);
0679 
0680 /*@}*/
0681 
0682 #if defined(__cplusplus)
0683 }
0684 #endif
0685 
0686 /*!
0687  * @}
0688  */
0689 
0690 #endif /* _FSL_XRDC2_H_ */