1 /*
2  * Copyright 2021 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 #ifndef FSL_MSCM_H_
8 #define FSL_MSCM_H_
9 
10 #include "fsl_common.h"
11 
12 /*!
13  * @addtogroup mscm
14  * @{
15  */
16 
17 /*! @file */
18 
19 /*******************************************************************************
20  * Definitions
21  ******************************************************************************/
22 typedef struct _mscm_uid
23 {
24     uint32_t UID0;
25     uint32_t UID1;
26     uint32_t UID2;
27     uint32_t UID3;
28 } mscm_uid_t;
29 
30 /* Component ID definition, used by tools. */
31 #ifndef FSL_COMPONENT_ID
32 #define FSL_COMPONENT_ID "platform.drivers.mscm"
33 #endif
34 
35 /*! @name Driver version */
36 /*! @{ */
37 /*! @brief MSCM driver version 2.0.0. */
38 #define FSL_MSCM_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
39 /*! @} */
40 
41 #if defined(__cplusplus)
42 extern "C" {
43 #endif
44 
45 /*******************************************************************************
46  * API
47  ******************************************************************************/
48 /*!
49  * @brief Get MSCM UID.
50  *
51  * @param base MSCM peripheral base address.
52  * @param uid Pointer to an uid struct.
53  */
MSCM_GetUID(MSCM_Type * base,mscm_uid_t * uid)54 static inline void MSCM_GetUID(MSCM_Type *base, mscm_uid_t *uid)
55 {
56     uid->UID0 = base->UID[0];
57     uid->UID1 = base->UID[1];
58     uid->UID2 = base->UID[2];
59     uid->UID3 = base->UID[3];
60 }
61 
62 /*!
63  * @brief Set MSCM Secure Irq.
64  *
65  * @param base MSCM peripheral base address.
66  * @param parameter Value to be write to SECURE_IRQ.
67  */
MSCM_SetSecureIrqParameter(MSCM_Type * base,const uint32_t parameter)68 static inline void MSCM_SetSecureIrqParameter(MSCM_Type *base, const uint32_t parameter)
69 {
70     base->SECURE_IRQ = parameter;
71 }
72 
73 /*!
74  * @brief Get MSCM Secure Irq.
75  *
76  * @param base MSCM peripheral base address.
77  * @return MSCM Secure Irq.
78  */
MSCM_GetSecureIrq(MSCM_Type * base)79 static inline uint32_t MSCM_GetSecureIrq(MSCM_Type *base)
80 {
81     return base->SECURE_IRQ;
82 }
83 
84 /*! @} */
85 
86 #if defined(__cplusplus)
87 }
88 #endif
89 /*!
90  * @}
91  */
92 #endif /* FSL_MSCM_H_ */
93