1 /*
2 * Copyright (c) 2023 - 2025, Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef NRF_IPCT_H__
35 #define NRF_IPCT_H__
36
37 #include <nrfx.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /**
44 * @defgroup nrf_ipct_hal IPCT HAL
45 * @{
46 * @ingroup nrf_ipct
47 * @brief Hardware access layer for managing the Inter-Processor Communication Transceiver
48 * (IPCT) peripheral.
49 */
50
51 /** @brief Symbol indicating presence of ACK task and ACKED event. */
52 #if defined(IPCT_INTEN0_ACKED0_Msk) || defined(__NRFX_DOXYGEN__)
53 #define NRF_IPCT_HAS_ACK 1
54 #else
55 #define NRF_IPCT_HAS_ACK 0
56 #endif
57
58 /** @brief Number of send tasks. */
59 #define NRF_IPCT_TASKS_SEND_COUNT IPCT_TASKS_SEND_MaxCount
60
61 /** @brief Number of recieve tasks. */
62 #define NRF_IPCT_EVENTS_RECEIVE_COUNT IPCT_EVENTS_RECEIVE_MaxCount
63
64 /** @brief IPCT tasks. */
65 typedef enum
66 {
67 NRF_IPCT_TASK_SEND_0 = offsetof(NRF_IPCT_Type, TASKS_SEND[0]), /**< Send [0] task. */
68 NRF_IPCT_TASK_SEND_1 = offsetof(NRF_IPCT_Type, TASKS_SEND[1]), /**< Send [1] task. */
69 NRF_IPCT_TASK_SEND_2 = offsetof(NRF_IPCT_Type, TASKS_SEND[2]), /**< Send [2] task. */
70 NRF_IPCT_TASK_SEND_3 = offsetof(NRF_IPCT_Type, TASKS_SEND[3]), /**< Send [3] task. */
71 NRF_IPCT_TASK_SEND_4 = offsetof(NRF_IPCT_Type, TASKS_SEND[4]), /**< Send [4] task. */
72 #if NRF_IPCT_TASKS_SEND_COUNT > 5
73 NRF_IPCT_TASK_SEND_5 = offsetof(NRF_IPCT_Type, TASKS_SEND[5]), /**< Send [5] task. */
74 NRF_IPCT_TASK_SEND_6 = offsetof(NRF_IPCT_Type, TASKS_SEND[6]), /**< Send [6] task. */
75 NRF_IPCT_TASK_SEND_7 = offsetof(NRF_IPCT_Type, TASKS_SEND[7]), /**< Send [7] task. */
76 NRF_IPCT_TASK_SEND_8 = offsetof(NRF_IPCT_Type, TASKS_SEND[8]), /**< Send [8] task. */
77 NRF_IPCT_TASK_SEND_9 = offsetof(NRF_IPCT_Type, TASKS_SEND[9]), /**< Send [9] task. */
78 NRF_IPCT_TASK_SEND_10 = offsetof(NRF_IPCT_Type, TASKS_SEND[10]), /**< Send [10] task. */
79 NRF_IPCT_TASK_SEND_11 = offsetof(NRF_IPCT_Type, TASKS_SEND[11]), /**< Send [11] task. */
80 NRF_IPCT_TASK_SEND_12 = offsetof(NRF_IPCT_Type, TASKS_SEND[12]), /**< Send [12] task. */
81 NRF_IPCT_TASK_SEND_13 = offsetof(NRF_IPCT_Type, TASKS_SEND[13]), /**< Send [13] task. */
82 NRF_IPCT_TASK_SEND_14 = offsetof(NRF_IPCT_Type, TASKS_SEND[14]), /**< Send [14] task. */
83 NRF_IPCT_TASK_SEND_15 = offsetof(NRF_IPCT_Type, TASKS_SEND[15]), /**< Send [15] task. */
84 #endif
85 #if NRF_IPCT_HAS_ACK
86 NRF_IPCT_TASK_ACK_0 = offsetof(NRF_IPCT_Type, TASKS_ACK[0]), /**< Acknowledge the RECEIVE[0] task. */
87 NRF_IPCT_TASK_ACK_1 = offsetof(NRF_IPCT_Type, TASKS_ACK[1]), /**< Acknowledge the RECEIVE[1] task. */
88 NRF_IPCT_TASK_ACK_2 = offsetof(NRF_IPCT_Type, TASKS_ACK[2]), /**< Acknowledge the RECEIVE[2] task. */
89 NRF_IPCT_TASK_ACK_3 = offsetof(NRF_IPCT_Type, TASKS_ACK[3]), /**< Acknowledge the RECEIVE[3] task. */
90 NRF_IPCT_TASK_ACK_4 = offsetof(NRF_IPCT_Type, TASKS_ACK[4]), /**< Acknowledge the RECEIVE[4] task. */
91 NRF_IPCT_TASK_ACK_5 = offsetof(NRF_IPCT_Type, TASKS_ACK[5]), /**< Acknowledge the RECEIVE[5] task. */
92 NRF_IPCT_TASK_ACK_6 = offsetof(NRF_IPCT_Type, TASKS_ACK[6]), /**< Acknowledge the RECEIVE[6] task. */
93 NRF_IPCT_TASK_ACK_7 = offsetof(NRF_IPCT_Type, TASKS_ACK[7]), /**< Acknowledge the RECEIVE[7] task. */
94 NRF_IPCT_TASK_ACK_8 = offsetof(NRF_IPCT_Type, TASKS_ACK[8]), /**< Acknowledge the RECEIVE[8] task. */
95 NRF_IPCT_TASK_ACK_9 = offsetof(NRF_IPCT_Type, TASKS_ACK[9]), /**< Acknowledge the RECEIVE[9] task. */
96 NRF_IPCT_TASK_ACK_10 = offsetof(NRF_IPCT_Type, TASKS_ACK[10]), /**< Acknowledge the RECEIVE[10] task. */
97 NRF_IPCT_TASK_ACK_11 = offsetof(NRF_IPCT_Type, TASKS_ACK[11]), /**< Acknowledge the RECEIVE[11] task. */
98 NRF_IPCT_TASK_ACK_12 = offsetof(NRF_IPCT_Type, TASKS_ACK[12]), /**< Acknowledge the RECEIVE[12] task. */
99 NRF_IPCT_TASK_ACK_13 = offsetof(NRF_IPCT_Type, TASKS_ACK[13]), /**< Acknowledge the RECEIVE[13] task. */
100 NRF_IPCT_TASK_ACK_14 = offsetof(NRF_IPCT_Type, TASKS_ACK[14]), /**< Acknowledge the RECEIVE[14] task. */
101 NRF_IPCT_TASK_ACK_15 = offsetof(NRF_IPCT_Type, TASKS_ACK[15]), /**< Acknowledge the RECEIVE[15] task. */
102 #endif
103 } nrf_ipct_task_t;
104
105 /** @brief IPCT events. */
106 typedef enum
107 {
108 NRF_IPCT_EVENT_RECEIVE_0 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[0]), /**< Receive [0] event. */
109 NRF_IPCT_EVENT_RECEIVE_1 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[1]), /**< Receive [1] event. */
110 NRF_IPCT_EVENT_RECEIVE_2 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[2]), /**< Receive [2] event. */
111 NRF_IPCT_EVENT_RECEIVE_3 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[3]), /**< Receive [3] event. */
112 NRF_IPCT_EVENT_RECEIVE_4 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[4]), /**< Receive [4] event. */
113 #if NRF_IPCT_EVENTS_RECEIVE_COUNT > 5
114 NRF_IPCT_EVENT_RECEIVE_5 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[5]), /**< Receive [5] event. */
115 NRF_IPCT_EVENT_RECEIVE_6 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[6]), /**< Receive [6] event. */
116 NRF_IPCT_EVENT_RECEIVE_7 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[7]), /**< Receive [7] event. */
117 NRF_IPCT_EVENT_RECEIVE_8 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[8]), /**< Receive [8] event. */
118 NRF_IPCT_EVENT_RECEIVE_9 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[9]), /**< Receive [9] event. */
119 NRF_IPCT_EVENT_RECEIVE_10 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[10]), /**< Receive [10] event. */
120 NRF_IPCT_EVENT_RECEIVE_11 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[11]), /**< Receive [11] event. */
121 NRF_IPCT_EVENT_RECEIVE_12 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[12]), /**< Receive [12] event. */
122 NRF_IPCT_EVENT_RECEIVE_13 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[13]), /**< Receive [13] event. */
123 NRF_IPCT_EVENT_RECEIVE_14 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[14]), /**< Receive [14] event. */
124 NRF_IPCT_EVENT_RECEIVE_15 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[15]), /**< Receive [15] event. */
125 #endif
126 #if NRF_IPCT_HAS_ACK
127 NRF_IPCT_EVENT_ACKED_0 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[0]), /**< Acknowledged event for the SEND[0] task. */
128 NRF_IPCT_EVENT_ACKED_1 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[1]), /**< Acknowledged event for the SEND[1] task. */
129 NRF_IPCT_EVENT_ACKED_2 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[2]), /**< Acknowledged event for the SEND[2] task. */
130 NRF_IPCT_EVENT_ACKED_3 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[3]), /**< Acknowledged event for the SEND[3] task. */
131 NRF_IPCT_EVENT_ACKED_4 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[4]), /**< Acknowledged event for the SEND[4] task. */
132 NRF_IPCT_EVENT_ACKED_5 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[5]), /**< Acknowledged event for the SEND[5] task. */
133 NRF_IPCT_EVENT_ACKED_6 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[6]), /**< Acknowledged event for the SEND[6] task. */
134 NRF_IPCT_EVENT_ACKED_7 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[7]), /**< Acknowledged event for the SEND[7] task. */
135 NRF_IPCT_EVENT_ACKED_8 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[8]), /**< Acknowledged event for the SEND[8] task. */
136 NRF_IPCT_EVENT_ACKED_9 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[9]), /**< Acknowledged event for the SEND[9] task. */
137 NRF_IPCT_EVENT_ACKED_10 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[10]), /**< Acknowledged event for the SEND[10] task. */
138 NRF_IPCT_EVENT_ACKED_11 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[11]), /**< Acknowledged event for the SEND[11] task. */
139 NRF_IPCT_EVENT_ACKED_12 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[12]), /**< Acknowledged event for the SEND[12] task. */
140 NRF_IPCT_EVENT_ACKED_13 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[13]), /**< Acknowledged event for the SEND[13] task. */
141 NRF_IPCT_EVENT_ACKED_14 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[14]), /**< Acknowledged event for the SEND[14] task. */
142 NRF_IPCT_EVENT_ACKED_15 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[15]), /**< Acknowledged event for the SEND[15] task. */
143 #endif // NRF_IPCT_HAS_ACK
144 } nrf_ipct_event_t;
145
146 #if NRF_IPCT_HAS_ACK
147 /** @brief IPCT shortcuts. */
148 typedef enum
149 {
150 NRF_IPCT_SHORT_RECEIVE0_ACK0_MASK = IPCT_SHORTS_RECEIVE0_ACK0_Msk, /**< Shortcut between event RECEIVE[0] and task ACK[0]. */
151 NRF_IPCT_SHORT_RECEIVE1_ACK1_MASK = IPCT_SHORTS_RECEIVE1_ACK1_Msk, /**< Shortcut between event RECEIVE[1] and task ACK[1]. */
152 NRF_IPCT_SHORT_RECEIVE2_ACK2_MASK = IPCT_SHORTS_RECEIVE2_ACK2_Msk, /**< Shortcut between event RECEIVE[2] and task ACK[2]. */
153 NRF_IPCT_SHORT_RECEIVE3_ACK3_MASK = IPCT_SHORTS_RECEIVE3_ACK3_Msk, /**< Shortcut between event RECEIVE[3] and task ACK[3]. */
154 NRF_IPCT_SHORT_RECEIVE4_ACK4_MASK = IPCT_SHORTS_RECEIVE4_ACK4_Msk, /**< Shortcut between event RECEIVE[4] and task ACK[4]. */
155 NRF_IPCT_SHORT_RECEIVE5_ACK5_MASK = IPCT_SHORTS_RECEIVE5_ACK5_Msk, /**< Shortcut between event RECEIVE[5] and task ACK[5]. */
156 NRF_IPCT_SHORT_RECEIVE6_ACK6_MASK = IPCT_SHORTS_RECEIVE6_ACK6_Msk, /**< Shortcut between event RECEIVE[6] and task ACK[6]. */
157 NRF_IPCT_SHORT_RECEIVE7_ACK7_MASK = IPCT_SHORTS_RECEIVE7_ACK7_Msk, /**< Shortcut between event RECEIVE[7] and task ACK[7]. */
158 NRF_IPCT_SHORT_RECEIVE8_ACK8_MASK = IPCT_SHORTS_RECEIVE8_ACK8_Msk, /**< Shortcut between event RECEIVE[8] and task ACK[8]. */
159 NRF_IPCT_SHORT_RECEIVE9_ACK9_MASK = IPCT_SHORTS_RECEIVE9_ACK9_Msk, /**< Shortcut between event RECEIVE[9] and task ACK[9]. */
160 NRF_IPCT_SHORT_RECEIVE10_ACK10_MASK = IPCT_SHORTS_RECEIVE10_ACK10_Msk, /**< Shortcut between event RECEIVE[10] and task ACK[10]. */
161 NRF_IPCT_SHORT_RECEIVE11_ACK11_MASK = IPCT_SHORTS_RECEIVE11_ACK11_Msk, /**< Shortcut between event RECEIVE[11] and task ACK[11]. */
162 NRF_IPCT_SHORT_RECEIVE12_ACK12_MASK = IPCT_SHORTS_RECEIVE12_ACK12_Msk, /**< Shortcut between event RECEIVE[12] and task ACK[12]. */
163 NRF_IPCT_SHORT_RECEIVE13_ACK13_MASK = IPCT_SHORTS_RECEIVE13_ACK13_Msk, /**< Shortcut between event RECEIVE[13] and task ACK[13]. */
164 NRF_IPCT_SHORT_RECEIVE14_ACK14_MASK = IPCT_SHORTS_RECEIVE14_ACK14_Msk, /**< Shortcut between event RECEIVE[14] and task ACK[14]. */
165 NRF_IPCT_SHORT_RECEIVE15_ACK15_MASK = IPCT_SHORTS_RECEIVE15_ACK15_Msk, /**< Shortcut between event RECEIVE[15] and task ACK[15]. */
166 NRF_IPCT_ALL_SHORTS_MASK = NRF_IPCT_SHORT_RECEIVE0_ACK0_MASK |
167 NRF_IPCT_SHORT_RECEIVE1_ACK1_MASK |
168 NRF_IPCT_SHORT_RECEIVE2_ACK2_MASK |
169 NRF_IPCT_SHORT_RECEIVE3_ACK3_MASK |
170 NRF_IPCT_SHORT_RECEIVE4_ACK4_MASK |
171 NRF_IPCT_SHORT_RECEIVE5_ACK5_MASK |
172 NRF_IPCT_SHORT_RECEIVE6_ACK6_MASK |
173 NRF_IPCT_SHORT_RECEIVE7_ACK7_MASK |
174 NRF_IPCT_SHORT_RECEIVE8_ACK8_MASK |
175 NRF_IPCT_SHORT_RECEIVE9_ACK9_MASK |
176 NRF_IPCT_SHORT_RECEIVE10_ACK10_MASK |
177 NRF_IPCT_SHORT_RECEIVE11_ACK11_MASK |
178 NRF_IPCT_SHORT_RECEIVE12_ACK12_MASK |
179 NRF_IPCT_SHORT_RECEIVE13_ACK13_MASK |
180 NRF_IPCT_SHORT_RECEIVE14_ACK14_MASK |
181 NRF_IPCT_SHORT_RECEIVE15_ACK15_MASK, /**< All IPCT shortcuts. */
182 } nrf_ipct_short_mask_t;
183 #endif
184
185 /** @brief IPCT interrupts. */
186 typedef enum
187 {
188 NRF_IPCT_INT_RECEIVE_0 = IPCT_INTEN0_RECEIVE0_Msk, /**< Interrupt for event RECEIVE[0]. */
189 NRF_IPCT_INT_RECEIVE_1 = IPCT_INTEN0_RECEIVE1_Msk, /**< Interrupt for event RECEIVE[1]. */
190 NRF_IPCT_INT_RECEIVE_2 = IPCT_INTEN0_RECEIVE2_Msk, /**< Interrupt for event RECEIVE[2]. */
191 NRF_IPCT_INT_RECEIVE_3 = IPCT_INTEN0_RECEIVE3_Msk, /**< Interrupt for event RECEIVE[3]. */
192 #if NRF_IPCT_EVENTS_RECEIVE_COUNT > 4
193 NRF_IPCT_INT_RECEIVE_4 = IPCT_INTEN0_RECEIVE4_Msk, /**< Interrupt for event RECEIVE[4]. */
194 NRF_IPCT_INT_RECEIVE_5 = IPCT_INTEN0_RECEIVE5_Msk, /**< Interrupt for event RECEIVE[5]. */
195 NRF_IPCT_INT_RECEIVE_6 = IPCT_INTEN0_RECEIVE6_Msk, /**< Interrupt for event RECEIVE[6]. */
196 NRF_IPCT_INT_RECEIVE_7 = IPCT_INTEN0_RECEIVE7_Msk, /**< Interrupt for event RECEIVE[7]. */
197 NRF_IPCT_INT_RECEIVE_8 = IPCT_INTEN0_RECEIVE8_Msk, /**< Interrupt for event RECEIVE[8]. */
198 NRF_IPCT_INT_RECEIVE_9 = IPCT_INTEN0_RECEIVE9_Msk, /**< Interrupt for event RECEIVE[9]. */
199 NRF_IPCT_INT_RECEIVE_10 = IPCT_INTEN0_RECEIVE10_Msk, /**< Interrupt for event RECEIVE[10]. */
200 NRF_IPCT_INT_RECEIVE_11 = IPCT_INTEN0_RECEIVE11_Msk, /**< Interrupt for event RECEIVE[11]. */
201 NRF_IPCT_INT_RECEIVE_12 = IPCT_INTEN0_RECEIVE12_Msk, /**< Interrupt for event RECEIVE[12]. */
202 NRF_IPCT_INT_RECEIVE_13 = IPCT_INTEN0_RECEIVE13_Msk, /**< Interrupt for event RECEIVE[13]. */
203 NRF_IPCT_INT_RECEIVE_14 = IPCT_INTEN0_RECEIVE14_Msk, /**< Interrupt for event RECEIVE[14]. */
204 NRF_IPCT_INT_RECEIVE_15 = IPCT_INTEN0_RECEIVE15_Msk, /**< Interrupt for event RECEIVE[15]. */
205 #endif
206 #if NRF_IPCT_HAS_ACK
207 NRF_IPCT_INT_ACKED_0 = IPCT_INTEN0_ACKED0_Msk, /**< Interrupt for event ACKED[0]. */
208 NRF_IPCT_INT_ACKED_1 = IPCT_INTEN0_ACKED1_Msk, /**< Interrupt for event ACKED[1]. */
209 NRF_IPCT_INT_ACKED_2 = IPCT_INTEN0_ACKED2_Msk, /**< Interrupt for event ACKED[2]. */
210 NRF_IPCT_INT_ACKED_3 = IPCT_INTEN0_ACKED3_Msk, /**< Interrupt for event ACKED[3]. */
211 NRF_IPCT_INT_ACKED_4 = IPCT_INTEN0_ACKED4_Msk, /**< Interrupt for event ACKED[4]. */
212 NRF_IPCT_INT_ACKED_5 = IPCT_INTEN0_ACKED5_Msk, /**< Interrupt for event ACKED[5]. */
213 NRF_IPCT_INT_ACKED_6 = IPCT_INTEN0_ACKED6_Msk, /**< Interrupt for event ACKED[6]. */
214 NRF_IPCT_INT_ACKED_7 = IPCT_INTEN0_ACKED7_Msk, /**< Interrupt for event ACKED[7]. */
215 NRF_IPCT_INT_ACKED_8 = IPCT_INTEN0_ACKED8_Msk, /**< Interrupt for event ACKED[8]. */
216 NRF_IPCT_INT_ACKED_9 = IPCT_INTEN0_ACKED9_Msk, /**< Interrupt for event ACKED[9]. */
217 NRF_IPCT_INT_ACKED_10 = IPCT_INTEN0_ACKED10_Msk, /**< Interrupt for event ACKED[10]. */
218 NRF_IPCT_INT_ACKED_11 = IPCT_INTEN0_ACKED11_Msk, /**< Interrupt for event ACKED[11]. */
219 NRF_IPCT_INT_ACKED_12 = IPCT_INTEN0_ACKED12_Msk, /**< Interrupt for event ACKED[12]. */
220 NRF_IPCT_INT_ACKED_13 = IPCT_INTEN0_ACKED13_Msk, /**< Interrupt for event ACKED[13]. */
221 NRF_IPCT_INT_ACKED_14 = IPCT_INTEN0_ACKED14_Msk, /**< Interrupt for event ACKED[14]. */
222 NRF_IPCT_INT_ACKED_15 = IPCT_INTEN0_ACKED15_Msk, /**< Interrupt for event ACKED[15]. */
223 #endif
224 } nrf_ipct_int_mask_t;
225
226 /**
227 * @brief Function for triggering the specified IPCT task.
228 *
229 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
230 * @param[in] task Task to be triggered.
231 */
232 NRF_STATIC_INLINE void nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task);
233
234 /**
235 * @brief Function for getting the address of the specified IPCT task register.
236 *
237 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
238 * @param[in] task Specified task.
239 *
240 * @return Address of the specified task register.
241 */
242 NRF_STATIC_INLINE uint32_t nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,
243 nrf_ipct_task_t task);
244
245 /**
246 * @brief Function for clearing the specified IPCT event.
247 *
248 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
249 * @param[in] event Event to clear.
250 */
251 NRF_STATIC_INLINE void nrf_ipct_event_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event);
252
253 /**
254 * @brief Function for retrieving the state of the IPCT event.
255 *
256 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
257 * @param[in] event Event to be checked.
258 *
259 * @retval true The event has been generated.
260 * @retval false The event has not been generated.
261 */
262 NRF_STATIC_INLINE bool nrf_ipct_event_check(NRF_IPCT_Type const * p_reg, nrf_ipct_event_t event);
263
264 /**
265 * @brief Function for getting the address of the specified IPCT event register.
266 *
267 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
268 * @param[in] event Specified event.
269 *
270 * @return Address of the specified event register.
271 */
272 NRF_STATIC_INLINE uint32_t nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,
273 nrf_ipct_event_t event);
274
275 /**
276 * @brief Function for enabling specified interrupts.
277 *
278 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
279 * @param[in] group_idx Index of interrupt group to be enabled.
280 * @param[in] mask Mask of interrupts to be enabled.
281 * Use @ref nrf_ipct_int_mask_t values for bit masking.
282 */
283 NRF_STATIC_INLINE void nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,
284 uint8_t group_idx,
285 uint32_t mask);
286
287 /**
288 * @brief Function for disabling specified interrupts.
289 *
290 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
291 * @param[in] group_idx Index of interrupt group to be disabled.
292 * @param[in] mask Mask of interrupts to be disabled.
293 * Use @ref nrf_ipct_int_mask_t values for bit masking.
294 */
295 NRF_STATIC_INLINE void nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,
296 uint8_t group_idx,
297 uint32_t mask);
298
299 /**
300 * @brief Function for checking if the specified interrupts are enabled.
301 *
302 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
303 * @param[in] group_idx Index of interrupt group to be checked.
304 * @param[in] mask Mask of interrupts to be checked.
305 * Use @ref nrf_ipct_int_mask_t values for bit masking.
306 *
307 * @return Mask of enabled interrupts.
308 */
309 NRF_STATIC_INLINE uint32_t nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,
310 uint8_t group_idx,
311 uint32_t mask);
312
313 /**
314 * @brief Function for retrieving the state of pending interrupts.
315 *
316 * States of pending interrupt are saved as a bitmask.
317 * One set at particular position means that interrupt for event is pending.
318 *
319 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
320 * @param[in] group_idx Index of interrupt group to be retrieved.
321 *
322 * @return Bitmask with information about pending interrupts.
323 * Use @ref nrf_ipct_int_mask_t values for bit masking.
324 */
325 NRF_STATIC_INLINE uint32_t nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,
326 uint8_t group_idx);
327
328 /**
329 *
330 * @brief Function for setting the DPPI subscribe configuration for a given
331 * IPCT task.
332 *
333 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
334 * @param[in] task Task for which to set the configuration.
335 * @param[in] channel DPPI channel through which to subscribe events.
336 */
337 NRF_STATIC_INLINE void nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,
338 nrf_ipct_task_t task,
339 uint8_t channel);
340
341 /**
342 * @brief Function for clearing the DPPI subscribe configuration for a given
343 * IPCT task.
344 *
345 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
346 * @param[in] task Task for which to clear the configuration.
347 */
348 NRF_STATIC_INLINE void nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task);
349
350 /**
351 * @brief Function for setting the DPPI publish configuration for a given
352 * IPCT event.
353 *
354 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
355 * @param[in] event Event for which to set the configuration.
356 * @param[in] channel DPPI channel through which to publish the event.
357 */
358 NRF_STATIC_INLINE void nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,
359 nrf_ipct_event_t event,
360 uint8_t channel);
361
362 /**
363 * @brief Function for clearing the DPPI publish configuration for a given
364 * IPCT event.
365 *
366 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
367 * @param[in] event Event for which to clear the configuration.
368 */
369 NRF_STATIC_INLINE void nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event);
370
371 /**
372 * @brief Function for getting value of the task overflow status for SEND task.
373 *
374 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
375 * @param[in] index SEND task index to be checked.
376 *
377 * @retval true Task overflow has happened.
378 * @retval false Task overflow has not happened.
379 */
380 NRF_STATIC_INLINE bool nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg, uint8_t index);
381
382 /**
383 * @brief Function for getting SEND task by its index.
384 *
385 * @param[in] index Index of the SEND task.
386 *
387 * @return SEND task.
388 */
389 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_send_task_get(uint8_t index);
390
391 /**
392 * @brief Function for getting ACK task by its index.
393 *
394 * @param[in] index Index of the ACK task.
395 *
396 * @return ACK task.
397 */
398 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_ack_task_get(uint8_t index);
399
400 /**
401 * @brief Function for getting RECEIVE event by its index.
402 *
403 * @param[in] index Index of the RECEIVE event.
404 *
405 * @return RECEIVE event.
406 */
407 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_receive_event_get(uint8_t index);
408
409 /**
410 * @brief Function for getting ACKED event by its index.
411 *
412 * @param[in] index Index of the ACKED event.
413 *
414 * @return ACKED event.
415 */
416 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_acked_event_get(uint8_t index);
417
418 /**
419 * @brief Function for enabling the specified shortcuts.
420 *
421 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
422 * @param[in] mask Shortcuts to be enabled.
423 */
424 NRF_STATIC_INLINE void nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg, uint32_t mask);
425
426 /**
427 * @brief Function for disabling the specified shortcuts.
428 *
429 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
430 * @param[in] mask Shortcuts to be disabled.
431 */
432 NRF_STATIC_INLINE void nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg, uint32_t mask);
433
434 /**
435 * @brief Function for setting the configuration of IPCT shortcuts.
436 *
437 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
438 * @param[in] mask Shortcuts to be set.
439 */
440 NRF_STATIC_INLINE void nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg, uint32_t mask);
441
442 #ifndef NRF_DECLARE_ONLY
443
nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task)444 NRF_STATIC_INLINE void nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task)
445 {
446 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
447 }
448
nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,nrf_ipct_task_t task)449 NRF_STATIC_INLINE uint32_t nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,
450 nrf_ipct_task_t task)
451 {
452 return ((uint32_t)p_reg + (uint32_t)task);
453 }
454
nrf_ipct_event_clear(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event)455 NRF_STATIC_INLINE void nrf_ipct_event_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event)
456 {
457 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
458 }
459
nrf_ipct_event_check(NRF_IPCT_Type const * p_reg,nrf_ipct_event_t event)460 NRF_STATIC_INLINE bool nrf_ipct_event_check(NRF_IPCT_Type const * p_reg, nrf_ipct_event_t event)
461 {
462 return nrf_event_check(p_reg, event);
463 }
464
nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,nrf_ipct_event_t event)465 NRF_STATIC_INLINE uint32_t nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,
466 nrf_ipct_event_t event)
467 {
468 return ((uint32_t)p_reg + (uint32_t)event);
469 }
470
nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,uint8_t group_idx,uint32_t mask)471 NRF_STATIC_INLINE void nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,
472 uint8_t group_idx,
473 uint32_t mask)
474 {
475 switch (group_idx)
476 {
477 #if defined(IPCT_INTENSET0_ResetValue)
478 case 0:
479 p_reg->INTENSET0 = mask;
480 break;
481 #endif // IPCT_INTENSET0_ResetValue
482 #if defined(IPCT_INTENSET1_ResetValue)
483 case 1:
484 p_reg->INTENSET1 = mask;
485 break;
486 #endif // IPCT_INTENSET1_ResetValue
487 #if defined(IPCT_INTENSET2_ResetValue)
488 case 2:
489 p_reg->INTENSET2 = mask;
490 break;
491 #endif // IPCT_INTENSET2_ResetValue
492 #if defined(IPCT_INTENSET3_ResetValue)
493 case 3:
494 p_reg->INTENSET3 = mask;
495 break;
496 #endif // IPCT_INTENSET3_ResetValue
497 #if defined(IPCT_INTENSET4_ResetValue)
498 case 4:
499 p_reg->INTENSET4 = mask;
500 break;
501 #endif // IPCT_INTENSET4_ResetValue
502 #if defined(IPCT_INTENSET5_ResetValue)
503 case 5:
504 p_reg->INTENSET5 = mask;
505 break;
506 #endif // IPCT_INTENSET5_ResetValue
507 #if defined(IPCT_INTENSET6_ResetValue)
508 case 6:
509 p_reg->INTENSET6 = mask;
510 break;
511 #endif // IPCT_INTENSET6_ResetValue
512 #if defined(IPCT_INTENSET7_ResetValue)
513 case 7:
514 p_reg->INTENSET7 = mask;
515 break;
516 #endif // IPCT_INTENSET7_ResetValue
517 default:
518 NRFX_ASSERT(false);
519 break;
520 }
521 }
522
nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,uint8_t group_idx,uint32_t mask)523 NRF_STATIC_INLINE void nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,
524 uint8_t group_idx,
525 uint32_t mask)
526 {
527 switch (group_idx)
528 {
529 #if defined(IPCT_INTENCLR0_ResetValue)
530 case 0:
531 p_reg->INTENCLR0 = mask;
532 break;
533 #endif // IPCT_INTENCLR0_ResetValue
534 #if defined(IPCT_INTENCLR1_ResetValue)
535 case 1:
536 p_reg->INTENCLR1 = mask;
537 break;
538 #endif // IPCT_INTENCLR1_ResetValue
539 #if defined(IPCT_INTENCLR2_ResetValue)
540 case 2:
541 p_reg->INTENCLR2 = mask;
542 break;
543 #endif // IPCT_INTENCLR2_ResetValue
544 #if defined(IPCT_INTENCLR3_ResetValue)
545 case 3:
546 p_reg->INTENCLR3 = mask;
547 break;
548 #endif // IPCT_INTENCLR3_ResetValue
549 #if defined(IPCT_INTENCLR4_ResetValue)
550 case 4:
551 p_reg->INTENCLR4 = mask;
552 break;
553 #endif // IPCT_INTENCLR4_ResetValue
554 #if defined(IPCT_INTENCLR5_ResetValue)
555 case 5:
556 p_reg->INTENCLR5 = mask;
557 break;
558 #endif // IPCT_INTENCLR5_ResetValue
559 #if defined(IPCT_INTENCLR6_ResetValue)
560 case 6:
561 p_reg->INTENCLR6 = mask;
562 break;
563 #endif // IPCT_INTENCLR6_ResetValue
564 #if defined(IPCT_INTENCLR7_ResetValue)
565 case 7:
566 p_reg->INTENCLR7 = mask;
567 break;
568 #endif // IPCT_INTENCLR7_ResetValue
569 default:
570 NRFX_ASSERT(false);
571 break;
572 }
573 }
574
nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,uint8_t group_idx,uint32_t mask)575 NRF_STATIC_INLINE uint32_t nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,
576 uint8_t group_idx,
577 uint32_t mask)
578 {
579 switch (group_idx)
580 {
581 #if defined(IPCT_INTENSET0_ResetValue)
582 case 0:
583 return p_reg->INTENSET0 & mask;
584 #endif // IPCT_INTENSET0_ResetValue
585 #if defined(IPCT_INTENSET1_ResetValue)
586 case 1:
587 return p_reg->INTENSET1 & mask;
588 #endif // IPCT_INTENSET1_ResetValue
589 #if defined(IPCT_INTENSET2_ResetValue)
590 case 2:
591 return p_reg->INTENSET2 & mask;
592 #endif // IPCT_INTENSET2_ResetValue
593 #if defined(IPCT_INTENSET3_ResetValue)
594 case 3:
595 return p_reg->INTENSET3 & mask;
596 #endif // IPCT_INTENSET3_ResetValue
597 #if defined(IPCT_INTENSET4_ResetValue)
598 case 4:
599 return p_reg->INTENSET4 & mask;
600 #endif // IPCT_INTENSET4_ResetValue
601 #if defined(IPCT_INTENSET5_ResetValue)
602 case 5:
603 return p_reg->INTENSET5 & mask;
604 #endif // IPCT_INTENSET5_ResetValue
605 #if defined(IPCT_INTENSET6_ResetValue)
606 case 6:
607 return p_reg->INTENSET6 & mask;
608 #endif // IPCT_INTENSET6_ResetValue
609 #if defined(IPCT_INTENSET7_ResetValue)
610 case 7:
611 return p_reg->INTENSET7 & mask;
612 #endif // IPCT_INTENSET7_ResetValue
613 default:
614 NRFX_ASSERT(false);
615 return 0;
616 }
617 }
618
nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,uint8_t group_idx)619 NRF_STATIC_INLINE uint32_t nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,
620 uint8_t group_idx)
621 {
622 switch (group_idx)
623 {
624 #if defined(IPCT_INTPEND0_ResetValue)
625 case 0:
626 return p_reg->INTPEND0;
627 #endif // IPCT_INTPEND0_ResetValue
628 #if defined(IPCT_INTPEND1_ResetValue)
629 case 1:
630 return p_reg->INTPEND1;
631 #endif // IPCT_INTPEND1_ResetValue
632 #if defined(IPCT_INTPEND2_ResetValue)
633 case 2:
634 return p_reg->INTPEND2;
635 #endif // IPCT_INTPEND2_ResetValue
636 #if defined(IPCT_INTPEND3_ResetValue)
637 case 3:
638 return p_reg->INTPEND3;
639 #endif // IPCT_INTPEND3_ResetValue
640 #if defined(IPCT_INTPEND4_ResetValue)
641 case 4:
642 return p_reg->INTPEND4;
643 #endif // IPCT_INTPEND4_ResetValue
644 #if defined(IPCT_INTPEND5_ResetValue)
645 case 5:
646 return p_reg->INTPEND5;
647 #endif // IPCT_INTPEND5_ResetValue
648 #if defined(IPCT_INTPEND6_ResetValue)
649 case 6:
650 return p_reg->INTPEND6;
651 #endif // IPCT_INTPEND6_ResetValue
652 #if defined(IPCT_INTPEND7_ResetValue)
653 case 7:
654 return p_reg->INTPEND7;
655 #endif // IPCT_INTPEND7_ResetValue
656 default:
657 NRFX_ASSERT(false);
658 return 0;
659 }
660 }
661
nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task,uint8_t channel)662 NRF_STATIC_INLINE void nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,
663 nrf_ipct_task_t task,
664 uint8_t channel)
665 {
666 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) =
667 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
668 }
669
nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task)670 NRF_STATIC_INLINE void nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task)
671 {
672 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) = 0;
673 }
674
nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event,uint8_t channel)675 NRF_STATIC_INLINE void nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,
676 nrf_ipct_event_t event,
677 uint8_t channel)
678 {
679 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) =
680 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
681 }
682
nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event)683 NRF_STATIC_INLINE void nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event)
684 {
685 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) = 0;
686 }
687
nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg,uint8_t index)688 NRF_STATIC_INLINE bool nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg, uint8_t index)
689 {
690 NRFX_ASSERT(index < NRF_IPCT_TASKS_SEND_COUNT);
691 return (p_reg->OVERFLOW.SEND & (1uL << index));
692 }
693
nrf_ipct_send_task_get(uint8_t index)694 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_send_task_get(uint8_t index)
695 {
696 return (nrf_ipct_task_t)(NRFX_OFFSETOF(NRF_IPCT_Type, TASKS_SEND[index]));
697 }
698
nrf_ipct_ack_task_get(uint8_t index)699 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_ack_task_get(uint8_t index)
700 {
701 #if NRF_IPCT_HAS_ACK
702 return (nrf_ipct_task_t)(NRFX_OFFSETOF(NRF_IPCT_Type, TASKS_ACK[index]));
703 #else
704 (void)index;
705 return (nrf_ipct_task_t)0;
706 #endif
707 }
708
nrf_ipct_receive_event_get(uint8_t index)709 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_receive_event_get(uint8_t index)
710 {
711 return (nrf_ipct_event_t)(NRFX_OFFSETOF(NRF_IPCT_Type, EVENTS_RECEIVE[index]));
712 }
713
nrf_ipct_acked_event_get(uint8_t index)714 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_acked_event_get(uint8_t index)
715 {
716 #if NRF_IPCT_HAS_ACK
717 return (nrf_ipct_event_t)(NRFX_OFFSETOF(NRF_IPCT_Type, EVENTS_ACKED[index]));
718 #else
719 (void)index;
720 return (nrf_ipct_event_t)0;
721 #endif
722 }
723
nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg,uint32_t mask)724 NRF_STATIC_INLINE void nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg, uint32_t mask)
725 {
726 p_reg->SHORTS |= mask;
727 }
728
nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg,uint32_t mask)729 NRF_STATIC_INLINE void nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg, uint32_t mask)
730 {
731 p_reg->SHORTS &= ~(mask);
732 }
733
nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg,uint32_t mask)734 NRF_STATIC_INLINE void nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg, uint32_t mask)
735 {
736 p_reg->SHORTS = mask;
737 }
738
739 #endif // NRF_DECLARE_ONLY
740
741 /** @} */
742
743 #ifdef __cplusplus
744 }
745 #endif
746
747 #endif // NRF_IPCT_H__
748