Skip to content

Commit 0c11903

Browse files
mmahadevan108dleach02
authored andcommitted
mcux-sdk: drivers: Add macros for secure and non-secure address
Add macros for secure and non-secure address Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
1 parent 466000a commit 0c11903

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

mcux/mcux-sdk/drivers/common/fsl_common_arm.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,23 @@ _Pragma("diag_suppress=Pm120")
473473
#else
474474
#error Toolchain not supported.
475475
#endif /* defined(__ICCARM__) */
476-
/* @} */
476+
/*! @} */
477+
478+
/*!
479+
* @def MSDK_REG_SECURE_ADDR(x)
480+
* Convert the register address to the one used in secure mode.
481+
*
482+
* @def MSDK_REG_NONSECURE_ADDR(x)
483+
* Convert the register address to the one used in non-secure mode.
484+
*/
485+
486+
#if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE & 0x2))
487+
#define MSDK_REG_SECURE_ADDR(x) ((uintptr_t)(x) | (0x1UL << 28))
488+
#define MSDK_REG_NONSECURE_ADDR(x) ((uintptr_t)(x) & ~(0x1UL << 28))
489+
#else
490+
#define MSDK_REG_SECURE_ADDR(x) (x)
491+
#define MSDK_REG_NONSECURE_ADDR(x) (x)
492+
#endif
477493

478494
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
479495
void DefaultISR(void);

0 commit comments

Comments
 (0)