![]() |
|
|||
File indexing completed on 2025-05-11 08:23:01
0001 /* 0002 * Copyright 2017-2020, 2022 NXP 0003 * All rights reserved. 0004 * 0005 * SPDX-License-Identifier: BSD-3-Clause 0006 */ 0007 0008 #ifndef _FSL_RDC_SEMA42_H_ 0009 #define _FSL_RDC_SEMA42_H_ 0010 0011 #include "fsl_common.h" 0012 0013 /*! 0014 * @addtogroup rdc_sema42 0015 * @{ 0016 */ 0017 0018 /****************************************************************************** 0019 * Definitions 0020 *****************************************************************************/ 0021 0022 /*! @name Driver version */ 0023 /*@{*/ 0024 /*! @brief RDC_SEMA42 driver version */ 0025 #define FSL_RDC_SEMA42_DRIVER_VERSION (MAKE_VERSION(2, 0, 4)) 0026 /*@}*/ 0027 0028 /*! @brief The number to reset all RDC_SEMA42 gates. */ 0029 #define RDC_SEMA42_GATE_NUM_RESET_ALL (64U) 0030 0031 #if defined(RDC_SEMAPHORE_GATE_COUNT) 0032 0033 /*! @brief RDC_SEMA42 gate n register address. */ 0034 #define RDC_SEMA42_GATEn(base, n) ((base)->GATE[(n)]) 0035 0036 /*! @brief RDC_SEMA42 gate count. */ 0037 #define RDC_SEMA42_GATE_COUNT (RDC_SEMAPHORE_GATE_COUNT) 0038 0039 #else /* RDC_SEMAPHORE_GATE_COUNT */ 0040 0041 /*! @brief RDC_SEMA42 gate n register address. */ 0042 #define RDC_SEMA42_GATEn(base, n) (((volatile uint8_t *)(&((base)->GATE0)))[(n)]) 0043 0044 /*! @brief RDC_SEMA42 gate count. */ 0045 #define RDC_SEMA42_GATE_COUNT (64U) 0046 0047 /* Compatible remap. */ 0048 #define RDC_SEMAPHORE_GATE_GTFSM_MASK RDC_SEMAPHORE_GATE0_GTFSM_MASK 0049 0050 #endif /* RDC_SEMAPHORE_GATE_COUNT */ 0051 0052 /******************************************************************************* 0053 * API 0054 ******************************************************************************/ 0055 0056 #if defined(__cplusplus) 0057 extern "C" { 0058 #endif 0059 0060 /*! 0061 * @brief Initializes the RDC_SEMA42 module. 0062 * 0063 * This function initializes the RDC_SEMA42 module. It only enables the clock but does 0064 * not reset the gates because the module might be used by other processors 0065 * at the same time. To reset the gates, call either RDC_SEMA42_ResetGate or 0066 * RDC_SEMA42_ResetAllGates function. 0067 * 0068 * @param base RDC_SEMA42 peripheral base address. 0069 */ 0070 void RDC_SEMA42_Init(RDC_SEMAPHORE_Type *base); 0071 0072 /*! 0073 * @brief De-initializes the RDC_SEMA42 module. 0074 * 0075 * This function de-initializes the RDC_SEMA42 module. It only disables the clock. 0076 * 0077 * @param base RDC_SEMA42 peripheral base address. 0078 */ 0079 void RDC_SEMA42_Deinit(RDC_SEMAPHORE_Type *base); 0080 0081 /*! 0082 * @brief Tries to lock the RDC_SEMA42 gate. 0083 * 0084 * This function tries to lock the specific RDC_SEMA42 gate. If the gate has been 0085 * locked by another processor, this function returns an error code. 0086 * 0087 * @param base RDC_SEMA42 peripheral base address. 0088 * @param gateNum Gate number to lock. 0089 * @param masterIndex Current processor master index. 0090 * @param domainId Current processor domain ID. 0091 * 0092 * @retval kStatus_Success Lock the sema42 gate successfully. 0093 * @retval kStatus_Failed Sema42 gate has been locked by another processor. 0094 */ 0095 status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId); 0096 0097 /*! 0098 * @brief Locks the RDC_SEMA42 gate. 0099 * 0100 * This function locks the specific RDC_SEMA42 gate. If the gate has been 0101 * locked by other processors, this function waits until it is unlocked and then 0102 * lock it. 0103 * 0104 * @param base RDC_SEMA42 peripheral base address. 0105 * @param gateNum Gate number to lock. 0106 * @param masterIndex Current processor master index. 0107 * @param domainId Current processor domain ID. 0108 */ 0109 void RDC_SEMA42_Lock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId); 0110 0111 /*! 0112 * @brief Unlocks the RDC_SEMA42 gate. 0113 * 0114 * This function unlocks the specific RDC_SEMA42 gate. It only writes unlock value 0115 * to the RDC_SEMA42 gate register. However, it does not check whether the RDC_SEMA42 gate is locked 0116 * by the current processor or not. As a result, if the RDC_SEMA42 gate is not locked by the current 0117 * processor, this function has no effect. 0118 * 0119 * @param base RDC_SEMA42 peripheral base address. 0120 * @param gateNum Gate number to unlock. 0121 */ 0122 static inline void RDC_SEMA42_Unlock(RDC_SEMAPHORE_Type *base, uint8_t gateNum) 0123 { 0124 assert(gateNum < RDC_SEMA42_GATE_COUNT); 0125 0126 RDC_SEMA42_GATEn(base, gateNum) = 0U; 0127 } 0128 0129 /*! 0130 * @brief Gets which master has currently locked the gate. 0131 * 0132 * @param base RDC_SEMA42 peripheral base address. 0133 * @param gateNum Gate number. 0134 * 0135 * @return Return -1 if the gate is not locked by any master, otherwise return the 0136 * master index. 0137 */ 0138 static inline int32_t RDC_SEMA42_GetLockMasterIndex(RDC_SEMAPHORE_Type *base, uint8_t gateNum) 0139 { 0140 assert(gateNum < RDC_SEMA42_GATE_COUNT); 0141 0142 uint8_t regGate = RDC_SEMA42_GATEn(base, gateNum); 0143 0144 return (int32_t)((uint8_t)(regGate & RDC_SEMAPHORE_GATE_GTFSM_MASK)) - 1; 0145 } 0146 0147 /*! 0148 * @brief Gets which domain has currently locked the gate. 0149 * 0150 * @param base RDC_SEMA42 peripheral base address. 0151 * @param gateNum Gate number. 0152 * 0153 * @return Return -1 if the gate is not locked by any domain, otherwise return the 0154 * domain ID. 0155 */ 0156 int32_t RDC_SEMA42_GetLockDomainID(RDC_SEMAPHORE_Type *base, uint8_t gateNum); 0157 0158 /*! 0159 * @brief Resets the RDC_SEMA42 gate to an unlocked status. 0160 * 0161 * This function resets a RDC_SEMA42 gate to an unlocked status. 0162 * 0163 * @param base RDC_SEMA42 peripheral base address. 0164 * @param gateNum Gate number. 0165 * 0166 * @retval kStatus_Success RDC_SEMA42 gate is reset successfully. 0167 * @retval kStatus_Failed Some other reset process is ongoing. 0168 */ 0169 status_t RDC_SEMA42_ResetGate(RDC_SEMAPHORE_Type *base, uint8_t gateNum); 0170 0171 /*! 0172 * @brief Resets all RDC_SEMA42 gates to an unlocked status. 0173 * 0174 * This function resets all RDC_SEMA42 gate to an unlocked status. 0175 * 0176 * @param base RDC_SEMA42 peripheral base address. 0177 * 0178 * @retval kStatus_Success RDC_SEMA42 is reset successfully. 0179 * @retval kStatus_RDC_SEMA42_Reseting Some other reset process is ongoing. 0180 */ 0181 static inline status_t RDC_SEMA42_ResetAllGates(RDC_SEMAPHORE_Type *base) 0182 { 0183 return RDC_SEMA42_ResetGate(base, RDC_SEMA42_GATE_NUM_RESET_ALL); 0184 } 0185 0186 #if defined(__cplusplus) 0187 } 0188 #endif 0189 0190 /*! 0191 * @} 0192 */ 0193 0194 #endif /* _FSL_RDC_SEMA42_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |