RTEMS 6.1-rc1
fsl_rdc_sema42.h
1/*
2 * Copyright 2017-2020, 2022 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef _FSL_RDC_SEMA42_H_
9#define _FSL_RDC_SEMA42_H_
10
11#include "fsl_common.h"
12
18/******************************************************************************
19 * Definitions
20 *****************************************************************************/
21
25#define FSL_RDC_SEMA42_DRIVER_VERSION (MAKE_VERSION(2, 0, 4))
29#define RDC_SEMA42_GATE_NUM_RESET_ALL (64U)
30
31#if defined(RDC_SEMAPHORE_GATE_COUNT)
32
34#define RDC_SEMA42_GATEn(base, n) ((base)->GATE[(n)])
35
37#define RDC_SEMA42_GATE_COUNT (RDC_SEMAPHORE_GATE_COUNT)
38
39#else /* RDC_SEMAPHORE_GATE_COUNT */
40
42#define RDC_SEMA42_GATEn(base, n) (((volatile uint8_t *)(&((base)->GATE0)))[(n)])
43
45#define RDC_SEMA42_GATE_COUNT (64U)
46
47/* Compatible remap. */
48#define RDC_SEMAPHORE_GATE_GTFSM_MASK RDC_SEMAPHORE_GATE0_GTFSM_MASK
49
50#endif /* RDC_SEMAPHORE_GATE_COUNT */
51
52/*******************************************************************************
53 * API
54 ******************************************************************************/
55
56#if defined(__cplusplus)
57extern "C" {
58#endif
59
71
80
95status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId);
96
109void RDC_SEMA42_Lock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId);
110
122static inline void RDC_SEMA42_Unlock(RDC_SEMAPHORE_Type *base, uint8_t gateNum)
123{
124 assert(gateNum < RDC_SEMA42_GATE_COUNT);
125
126 RDC_SEMA42_GATEn(base, gateNum) = 0U;
127}
128
138static inline int32_t RDC_SEMA42_GetLockMasterIndex(RDC_SEMAPHORE_Type *base, uint8_t gateNum)
139{
140 assert(gateNum < RDC_SEMA42_GATE_COUNT);
141
142 uint8_t regGate = RDC_SEMA42_GATEn(base, gateNum);
143
144 return (int32_t)((uint8_t)(regGate & RDC_SEMAPHORE_GATE_GTFSM_MASK)) - 1;
145}
146
156int32_t RDC_SEMA42_GetLockDomainID(RDC_SEMAPHORE_Type *base, uint8_t gateNum);
157
169status_t RDC_SEMA42_ResetGate(RDC_SEMAPHORE_Type *base, uint8_t gateNum);
170
181static inline status_t RDC_SEMA42_ResetAllGates(RDC_SEMAPHORE_Type *base)
182{
184}
185
186#if defined(__cplusplus)
187}
188#endif
189
194#endif /* _FSL_RDC_SEMA42_H_ */
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define RDC_SEMA42_GATE_COUNT
RDC_SEMA42 gate count.
Definition: fsl_rdc_sema42.h:45
void RDC_SEMA42_Deinit(RDC_SEMAPHORE_Type *base)
De-initializes the RDC_SEMA42 module.
Definition: fsl_rdc_sema42.c:105
#define RDC_SEMA42_GATE_NUM_RESET_ALL
The number to reset all RDC_SEMA42 gates.
Definition: fsl_rdc_sema42.h:29
void RDC_SEMA42_Lock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
Locks the RDC_SEMA42 gate.
Definition: fsl_rdc_sema42.c:163
void RDC_SEMA42_Init(RDC_SEMAPHORE_Type *base)
Initializes the RDC_SEMA42 module.
Definition: fsl_rdc_sema42.c:89
status_t RDC_SEMA42_ResetGate(RDC_SEMAPHORE_Type *base, uint8_t gateNum)
Resets the RDC_SEMA42 gate to an unlocked status.
Definition: fsl_rdc_sema42.c:210
#define RDC_SEMA42_GATEn(base, n)
RDC_SEMA42 gate n register address.
Definition: fsl_rdc_sema42.h:42
status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
Tries to lock the RDC_SEMA42 gate.
Definition: fsl_rdc_sema42.c:128
int32_t RDC_SEMA42_GetLockDomainID(RDC_SEMAPHORE_Type *base, uint8_t gateNum)
Gets which domain has currently locked the gate.
Definition: fsl_rdc_sema42.c:179
Definition: MIMXRT1166_cm4.h:72538