1 /*
2 * Copyright (c) 2023 - 2024, 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 IPCT tasks. */
62 typedef enum
63 {
64 NRF_IPCT_TASK_SEND_0 = offsetof(NRF_IPCT_Type, TASKS_SEND[0]), /**< Send [0] task. */
65 NRF_IPCT_TASK_SEND_1 = offsetof(NRF_IPCT_Type, TASKS_SEND[1]), /**< Send [1] task. */
66 NRF_IPCT_TASK_SEND_2 = offsetof(NRF_IPCT_Type, TASKS_SEND[2]), /**< Send [2] task. */
67 NRF_IPCT_TASK_SEND_3 = offsetof(NRF_IPCT_Type, TASKS_SEND[3]), /**< Send [3] task. */
68 NRF_IPCT_TASK_SEND_4 = offsetof(NRF_IPCT_Type, TASKS_SEND[4]), /**< Send [4] task. */
69 NRF_IPCT_TASK_SEND_5 = offsetof(NRF_IPCT_Type, TASKS_SEND[5]), /**< Send [5] task. */
70 NRF_IPCT_TASK_SEND_6 = offsetof(NRF_IPCT_Type, TASKS_SEND[6]), /**< Send [6] task. */
71 NRF_IPCT_TASK_SEND_7 = offsetof(NRF_IPCT_Type, TASKS_SEND[7]), /**< Send [7] task. */
72 NRF_IPCT_TASK_SEND_8 = offsetof(NRF_IPCT_Type, TASKS_SEND[8]), /**< Send [8] task. */
73 NRF_IPCT_TASK_SEND_9 = offsetof(NRF_IPCT_Type, TASKS_SEND[9]), /**< Send [9] task. */
74 NRF_IPCT_TASK_SEND_10 = offsetof(NRF_IPCT_Type, TASKS_SEND[10]), /**< Send [10] task. */
75 NRF_IPCT_TASK_SEND_11 = offsetof(NRF_IPCT_Type, TASKS_SEND[11]), /**< Send [11] task. */
76 NRF_IPCT_TASK_SEND_12 = offsetof(NRF_IPCT_Type, TASKS_SEND[12]), /**< Send [12] task. */
77 NRF_IPCT_TASK_SEND_13 = offsetof(NRF_IPCT_Type, TASKS_SEND[13]), /**< Send [13] task. */
78 NRF_IPCT_TASK_SEND_14 = offsetof(NRF_IPCT_Type, TASKS_SEND[14]), /**< Send [14] task. */
79 NRF_IPCT_TASK_SEND_15 = offsetof(NRF_IPCT_Type, TASKS_SEND[15]), /**< Send [15] task. */
80 #if NRF_IPCT_HAS_ACK
81 NRF_IPCT_TASK_ACK_0 = offsetof(NRF_IPCT_Type, TASKS_ACK[0]), /**< Acknowledge the RECEIVE[0] task. */
82 NRF_IPCT_TASK_ACK_1 = offsetof(NRF_IPCT_Type, TASKS_ACK[1]), /**< Acknowledge the RECEIVE[1] task. */
83 NRF_IPCT_TASK_ACK_2 = offsetof(NRF_IPCT_Type, TASKS_ACK[2]), /**< Acknowledge the RECEIVE[2] task. */
84 NRF_IPCT_TASK_ACK_3 = offsetof(NRF_IPCT_Type, TASKS_ACK[3]), /**< Acknowledge the RECEIVE[3] task. */
85 NRF_IPCT_TASK_ACK_4 = offsetof(NRF_IPCT_Type, TASKS_ACK[4]), /**< Acknowledge the RECEIVE[4] task. */
86 NRF_IPCT_TASK_ACK_5 = offsetof(NRF_IPCT_Type, TASKS_ACK[5]), /**< Acknowledge the RECEIVE[5] task. */
87 NRF_IPCT_TASK_ACK_6 = offsetof(NRF_IPCT_Type, TASKS_ACK[6]), /**< Acknowledge the RECEIVE[6] task. */
88 NRF_IPCT_TASK_ACK_7 = offsetof(NRF_IPCT_Type, TASKS_ACK[7]), /**< Acknowledge the RECEIVE[7] task. */
89 NRF_IPCT_TASK_ACK_8 = offsetof(NRF_IPCT_Type, TASKS_ACK[8]), /**< Acknowledge the RECEIVE[8] task. */
90 NRF_IPCT_TASK_ACK_9 = offsetof(NRF_IPCT_Type, TASKS_ACK[9]), /**< Acknowledge the RECEIVE[9] task. */
91 NRF_IPCT_TASK_ACK_10 = offsetof(NRF_IPCT_Type, TASKS_ACK[10]), /**< Acknowledge the RECEIVE[10] task. */
92 NRF_IPCT_TASK_ACK_11 = offsetof(NRF_IPCT_Type, TASKS_ACK[11]), /**< Acknowledge the RECEIVE[11] task. */
93 NRF_IPCT_TASK_ACK_12 = offsetof(NRF_IPCT_Type, TASKS_ACK[12]), /**< Acknowledge the RECEIVE[12] task. */
94 NRF_IPCT_TASK_ACK_13 = offsetof(NRF_IPCT_Type, TASKS_ACK[13]), /**< Acknowledge the RECEIVE[13] task. */
95 NRF_IPCT_TASK_ACK_14 = offsetof(NRF_IPCT_Type, TASKS_ACK[14]), /**< Acknowledge the RECEIVE[14] task. */
96 NRF_IPCT_TASK_ACK_15 = offsetof(NRF_IPCT_Type, TASKS_ACK[15]), /**< Acknowledge the RECEIVE[15] task. */
97 #endif
98 } nrf_ipct_task_t;
99
100 /** @brief IPCT events. */
101 typedef enum
102 {
103 NRF_IPCT_EVENT_RECEIVE_0 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[0]), /**< Receive [0] event. */
104 NRF_IPCT_EVENT_RECEIVE_1 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[1]), /**< Receive [1] event. */
105 NRF_IPCT_EVENT_RECEIVE_2 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[2]), /**< Receive [2] event. */
106 NRF_IPCT_EVENT_RECEIVE_3 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[3]), /**< Receive [3] event. */
107 NRF_IPCT_EVENT_RECEIVE_4 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[4]), /**< Receive [4] event. */
108 NRF_IPCT_EVENT_RECEIVE_5 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[5]), /**< Receive [5] event. */
109 NRF_IPCT_EVENT_RECEIVE_6 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[6]), /**< Receive [6] event. */
110 NRF_IPCT_EVENT_RECEIVE_7 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[7]), /**< Receive [7] event. */
111 NRF_IPCT_EVENT_RECEIVE_8 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[8]), /**< Receive [8] event. */
112 NRF_IPCT_EVENT_RECEIVE_9 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[9]), /**< Receive [9] event. */
113 NRF_IPCT_EVENT_RECEIVE_10 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[10]), /**< Receive [10] event. */
114 NRF_IPCT_EVENT_RECEIVE_11 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[11]), /**< Receive [11] event. */
115 NRF_IPCT_EVENT_RECEIVE_12 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[12]), /**< Receive [12] event. */
116 NRF_IPCT_EVENT_RECEIVE_13 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[13]), /**< Receive [13] event. */
117 NRF_IPCT_EVENT_RECEIVE_14 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[14]), /**< Receive [14] event. */
118 NRF_IPCT_EVENT_RECEIVE_15 = offsetof(NRF_IPCT_Type, EVENTS_RECEIVE[15]), /**< Receive [15] event. */
119 #if NRF_IPCT_HAS_ACK
120 NRF_IPCT_EVENT_ACKED_0 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[0]), /**< Acknowledged event for the SEND[0] task. */
121 NRF_IPCT_EVENT_ACKED_1 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[1]), /**< Acknowledged event for the SEND[1] task. */
122 NRF_IPCT_EVENT_ACKED_2 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[2]), /**< Acknowledged event for the SEND[2] task. */
123 NRF_IPCT_EVENT_ACKED_3 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[3]), /**< Acknowledged event for the SEND[3] task. */
124 NRF_IPCT_EVENT_ACKED_4 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[4]), /**< Acknowledged event for the SEND[4] task. */
125 NRF_IPCT_EVENT_ACKED_5 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[5]), /**< Acknowledged event for the SEND[5] task. */
126 NRF_IPCT_EVENT_ACKED_6 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[6]), /**< Acknowledged event for the SEND[6] task. */
127 NRF_IPCT_EVENT_ACKED_7 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[7]), /**< Acknowledged event for the SEND[7] task. */
128 NRF_IPCT_EVENT_ACKED_8 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[8]), /**< Acknowledged event for the SEND[8] task. */
129 NRF_IPCT_EVENT_ACKED_9 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[9]), /**< Acknowledged event for the SEND[9] task. */
130 NRF_IPCT_EVENT_ACKED_10 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[10]), /**< Acknowledged event for the SEND[10] task. */
131 NRF_IPCT_EVENT_ACKED_11 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[11]), /**< Acknowledged event for the SEND[11] task. */
132 NRF_IPCT_EVENT_ACKED_12 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[12]), /**< Acknowledged event for the SEND[12] task. */
133 NRF_IPCT_EVENT_ACKED_13 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[13]), /**< Acknowledged event for the SEND[13] task. */
134 NRF_IPCT_EVENT_ACKED_14 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[14]), /**< Acknowledged event for the SEND[14] task. */
135 NRF_IPCT_EVENT_ACKED_15 = offsetof(NRF_IPCT_Type, EVENTS_ACKED[15]), /**< Acknowledged event for the SEND[15] task. */
136 #endif
137 } nrf_ipct_event_t;
138
139 #if NRF_IPCT_HAS_ACK
140 /** @brief IPCT shortcuts. */
141 typedef enum
142 {
143 NRF_IPCT_SHORT_RECEIVE0_ACK0_MASK = IPCT_SHORTS_RECEIVE0_ACK0_Msk, /**< Shortcut between event RECEIVE[0] and task ACK[0]. */
144 NRF_IPCT_SHORT_RECEIVE1_ACK1_MASK = IPCT_SHORTS_RECEIVE1_ACK1_Msk, /**< Shortcut between event RECEIVE[1] and task ACK[1]. */
145 NRF_IPCT_SHORT_RECEIVE2_ACK2_MASK = IPCT_SHORTS_RECEIVE2_ACK2_Msk, /**< Shortcut between event RECEIVE[2] and task ACK[2]. */
146 NRF_IPCT_SHORT_RECEIVE3_ACK3_MASK = IPCT_SHORTS_RECEIVE3_ACK3_Msk, /**< Shortcut between event RECEIVE[3] and task ACK[3]. */
147 NRF_IPCT_SHORT_RECEIVE4_ACK4_MASK = IPCT_SHORTS_RECEIVE4_ACK4_Msk, /**< Shortcut between event RECEIVE[4] and task ACK[4]. */
148 NRF_IPCT_SHORT_RECEIVE5_ACK5_MASK = IPCT_SHORTS_RECEIVE5_ACK5_Msk, /**< Shortcut between event RECEIVE[5] and task ACK[5]. */
149 NRF_IPCT_SHORT_RECEIVE6_ACK6_MASK = IPCT_SHORTS_RECEIVE6_ACK6_Msk, /**< Shortcut between event RECEIVE[6] and task ACK[6]. */
150 NRF_IPCT_SHORT_RECEIVE7_ACK7_MASK = IPCT_SHORTS_RECEIVE7_ACK7_Msk, /**< Shortcut between event RECEIVE[7] and task ACK[7]. */
151 NRF_IPCT_SHORT_RECEIVE8_ACK8_MASK = IPCT_SHORTS_RECEIVE8_ACK8_Msk, /**< Shortcut between event RECEIVE[8] and task ACK[8]. */
152 NRF_IPCT_SHORT_RECEIVE9_ACK9_MASK = IPCT_SHORTS_RECEIVE9_ACK9_Msk, /**< Shortcut between event RECEIVE[9] and task ACK[9]. */
153 NRF_IPCT_SHORT_RECEIVE10_ACK10_MASK = IPCT_SHORTS_RECEIVE10_ACK10_Msk, /**< Shortcut between event RECEIVE[10] and task ACK[10]. */
154 NRF_IPCT_SHORT_RECEIVE11_ACK11_MASK = IPCT_SHORTS_RECEIVE11_ACK11_Msk, /**< Shortcut between event RECEIVE[11] and task ACK[11]. */
155 NRF_IPCT_SHORT_RECEIVE12_ACK12_MASK = IPCT_SHORTS_RECEIVE12_ACK12_Msk, /**< Shortcut between event RECEIVE[12] and task ACK[12]. */
156 NRF_IPCT_SHORT_RECEIVE13_ACK13_MASK = IPCT_SHORTS_RECEIVE13_ACK13_Msk, /**< Shortcut between event RECEIVE[13] and task ACK[13]. */
157 NRF_IPCT_SHORT_RECEIVE14_ACK14_MASK = IPCT_SHORTS_RECEIVE14_ACK14_Msk, /**< Shortcut between event RECEIVE[14] and task ACK[14]. */
158 NRF_IPCT_SHORT_RECEIVE15_ACK15_MASK = IPCT_SHORTS_RECEIVE15_ACK15_Msk, /**< Shortcut between event RECEIVE[15] and task ACK[15]. */
159 NRF_IPCT_ALL_SHORTS_MASK = NRF_IPCT_SHORT_RECEIVE0_ACK0_MASK |
160 NRF_IPCT_SHORT_RECEIVE1_ACK1_MASK |
161 NRF_IPCT_SHORT_RECEIVE2_ACK2_MASK |
162 NRF_IPCT_SHORT_RECEIVE3_ACK3_MASK |
163 NRF_IPCT_SHORT_RECEIVE4_ACK4_MASK |
164 NRF_IPCT_SHORT_RECEIVE5_ACK5_MASK |
165 NRF_IPCT_SHORT_RECEIVE6_ACK6_MASK |
166 NRF_IPCT_SHORT_RECEIVE7_ACK7_MASK |
167 NRF_IPCT_SHORT_RECEIVE8_ACK8_MASK |
168 NRF_IPCT_SHORT_RECEIVE9_ACK9_MASK |
169 NRF_IPCT_SHORT_RECEIVE10_ACK10_MASK |
170 NRF_IPCT_SHORT_RECEIVE11_ACK11_MASK |
171 NRF_IPCT_SHORT_RECEIVE12_ACK12_MASK |
172 NRF_IPCT_SHORT_RECEIVE13_ACK13_MASK |
173 NRF_IPCT_SHORT_RECEIVE14_ACK14_MASK |
174 NRF_IPCT_SHORT_RECEIVE15_ACK15_MASK, /**< All IPCT shortcuts. */
175 } nrf_ipct_short_mask_t;
176 #endif
177
178 /** @brief IPCT interrupts. */
179 typedef enum
180 {
181 NRF_IPCT_INT_RECEIVE_0 = IPCT_INTEN0_RECEIVE0_Msk, /**< Interrupt for event RECEIVE[0]. */
182 NRF_IPCT_INT_RECEIVE_1 = IPCT_INTEN0_RECEIVE1_Msk, /**< Interrupt for event RECEIVE[1]. */
183 NRF_IPCT_INT_RECEIVE_2 = IPCT_INTEN0_RECEIVE2_Msk, /**< Interrupt for event RECEIVE[2]. */
184 NRF_IPCT_INT_RECEIVE_3 = IPCT_INTEN0_RECEIVE3_Msk, /**< Interrupt for event RECEIVE[3]. */
185 NRF_IPCT_INT_RECEIVE_4 = IPCT_INTEN0_RECEIVE4_Msk, /**< Interrupt for event RECEIVE[4]. */
186 NRF_IPCT_INT_RECEIVE_5 = IPCT_INTEN0_RECEIVE5_Msk, /**< Interrupt for event RECEIVE[5]. */
187 NRF_IPCT_INT_RECEIVE_6 = IPCT_INTEN0_RECEIVE6_Msk, /**< Interrupt for event RECEIVE[6]. */
188 NRF_IPCT_INT_RECEIVE_7 = IPCT_INTEN0_RECEIVE7_Msk, /**< Interrupt for event RECEIVE[7]. */
189 NRF_IPCT_INT_RECEIVE_8 = IPCT_INTEN0_RECEIVE8_Msk, /**< Interrupt for event RECEIVE[8]. */
190 NRF_IPCT_INT_RECEIVE_9 = IPCT_INTEN0_RECEIVE9_Msk, /**< Interrupt for event RECEIVE[9]. */
191 NRF_IPCT_INT_RECEIVE_10 = IPCT_INTEN0_RECEIVE10_Msk, /**< Interrupt for event RECEIVE[10]. */
192 NRF_IPCT_INT_RECEIVE_11 = IPCT_INTEN0_RECEIVE11_Msk, /**< Interrupt for event RECEIVE[11]. */
193 NRF_IPCT_INT_RECEIVE_12 = IPCT_INTEN0_RECEIVE12_Msk, /**< Interrupt for event RECEIVE[12]. */
194 NRF_IPCT_INT_RECEIVE_13 = IPCT_INTEN0_RECEIVE13_Msk, /**< Interrupt for event RECEIVE[13]. */
195 NRF_IPCT_INT_RECEIVE_14 = IPCT_INTEN0_RECEIVE14_Msk, /**< Interrupt for event RECEIVE[14]. */
196 NRF_IPCT_INT_RECEIVE_15 = IPCT_INTEN0_RECEIVE15_Msk, /**< Interrupt for event RECEIVE[15]. */
197 #if NRF_IPCT_HAS_ACK
198 NRF_IPCT_INT_ACKED_0 = IPCT_INTEN0_ACKED0_Msk, /**< Interrupt for event ACKED[0]. */
199 NRF_IPCT_INT_ACKED_1 = IPCT_INTEN0_ACKED1_Msk, /**< Interrupt for event ACKED[1]. */
200 NRF_IPCT_INT_ACKED_2 = IPCT_INTEN0_ACKED2_Msk, /**< Interrupt for event ACKED[2]. */
201 NRF_IPCT_INT_ACKED_3 = IPCT_INTEN0_ACKED3_Msk, /**< Interrupt for event ACKED[3]. */
202 NRF_IPCT_INT_ACKED_4 = IPCT_INTEN0_ACKED4_Msk, /**< Interrupt for event ACKED[4]. */
203 NRF_IPCT_INT_ACKED_5 = IPCT_INTEN0_ACKED5_Msk, /**< Interrupt for event ACKED[5]. */
204 NRF_IPCT_INT_ACKED_6 = IPCT_INTEN0_ACKED6_Msk, /**< Interrupt for event ACKED[6]. */
205 NRF_IPCT_INT_ACKED_7 = IPCT_INTEN0_ACKED7_Msk, /**< Interrupt for event ACKED[7]. */
206 NRF_IPCT_INT_ACKED_8 = IPCT_INTEN0_ACKED8_Msk, /**< Interrupt for event ACKED[8]. */
207 NRF_IPCT_INT_ACKED_9 = IPCT_INTEN0_ACKED9_Msk, /**< Interrupt for event ACKED[9]. */
208 NRF_IPCT_INT_ACKED_10 = IPCT_INTEN0_ACKED10_Msk, /**< Interrupt for event ACKED[10]. */
209 NRF_IPCT_INT_ACKED_11 = IPCT_INTEN0_ACKED11_Msk, /**< Interrupt for event ACKED[11]. */
210 NRF_IPCT_INT_ACKED_12 = IPCT_INTEN0_ACKED12_Msk, /**< Interrupt for event ACKED[12]. */
211 NRF_IPCT_INT_ACKED_13 = IPCT_INTEN0_ACKED13_Msk, /**< Interrupt for event ACKED[13]. */
212 NRF_IPCT_INT_ACKED_14 = IPCT_INTEN0_ACKED14_Msk, /**< Interrupt for event ACKED[14]. */
213 NRF_IPCT_INT_ACKED_15 = IPCT_INTEN0_ACKED15_Msk, /**< Interrupt for event ACKED[15]. */
214 #endif
215 } nrf_ipct_int_mask_t;
216
217 /**
218 * @brief Function for triggering the specified IPCT task.
219 *
220 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
221 * @param[in] task Task to be triggered.
222 */
223 NRF_STATIC_INLINE void nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task);
224
225 /**
226 * @brief Function for getting the address of the specified IPCT task register.
227 *
228 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
229 * @param[in] task Specified task.
230 *
231 * @return Address of the specified task register.
232 */
233 NRF_STATIC_INLINE uint32_t nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,
234 nrf_ipct_task_t task);
235
236 /**
237 * @brief Function for clearing the specified IPCT event.
238 *
239 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
240 * @param[in] event Event to clear.
241 */
242 NRF_STATIC_INLINE void nrf_ipct_event_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event);
243
244 /**
245 * @brief Function for retrieving the state of the IPCT event.
246 *
247 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
248 * @param[in] event Event to be checked.
249 *
250 * @retval true The event has been generated.
251 * @retval false The event has not been generated.
252 */
253 NRF_STATIC_INLINE bool nrf_ipct_event_check(NRF_IPCT_Type const * p_reg, nrf_ipct_event_t event);
254
255 /**
256 * @brief Function for getting the address of the specified IPCT event register.
257 *
258 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
259 * @param[in] event Specified event.
260 *
261 * @return Address of the specified event register.
262 */
263 NRF_STATIC_INLINE uint32_t nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,
264 nrf_ipct_event_t event);
265
266 /**
267 * @brief Function for enabling specified interrupts.
268 *
269 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
270 * @param[in] group_idx Index of interrupt group to be enabled.
271 * @param[in] mask Mask of interrupts to be enabled.
272 * Use @ref nrf_ipct_int_mask_t values for bit masking.
273 */
274 NRF_STATIC_INLINE void nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,
275 uint8_t group_idx,
276 uint32_t mask);
277
278 /**
279 * @brief Function for disabling specified interrupts.
280 *
281 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
282 * @param[in] group_idx Index of interrupt group to be disabled.
283 * @param[in] mask Mask of interrupts to be disabled.
284 * Use @ref nrf_ipct_int_mask_t values for bit masking.
285 */
286 NRF_STATIC_INLINE void nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,
287 uint8_t group_idx,
288 uint32_t mask);
289
290 /**
291 * @brief Function for checking if the specified interrupts are enabled.
292 *
293 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
294 * @param[in] group_idx Index of interrupt group to be checked.
295 * @param[in] mask Mask of interrupts to be checked.
296 * Use @ref nrf_ipct_int_mask_t values for bit masking.
297 *
298 * @return Mask of enabled interrupts.
299 */
300 NRF_STATIC_INLINE uint32_t nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,
301 uint8_t group_idx,
302 uint32_t mask);
303
304 /**
305 * @brief Function for retrieving the state of pending interrupts.
306 *
307 * States of pending interrupt are saved as a bitmask.
308 * One set at particular position means that interrupt for event is pending.
309 *
310 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
311 * @param[in] group_idx Index of interrupt group to be retrieved.
312 *
313 * @return Bitmask with information about pending interrupts.
314 * Use @ref nrf_ipct_int_mask_t values for bit masking.
315 */
316 NRF_STATIC_INLINE uint32_t nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,
317 uint8_t group_idx);
318
319 /**
320 *
321 * @brief Function for setting the DPPI subscribe configuration for a given
322 * IPCT task.
323 *
324 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
325 * @param[in] task Task for which to set the configuration.
326 * @param[in] channel DPPI channel through which to subscribe events.
327 */
328 NRF_STATIC_INLINE void nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,
329 nrf_ipct_task_t task,
330 uint8_t channel);
331
332 /**
333 * @brief Function for clearing the DPPI subscribe configuration for a given
334 * IPCT task.
335 *
336 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
337 * @param[in] task Task for which to clear the configuration.
338 */
339 NRF_STATIC_INLINE void nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task);
340
341 /**
342 * @brief Function for setting the DPPI publish configuration for a given
343 * IPCT event.
344 *
345 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
346 * @param[in] event Event for which to set the configuration.
347 * @param[in] channel DPPI channel through which to publish the event.
348 */
349 NRF_STATIC_INLINE void nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,
350 nrf_ipct_event_t event,
351 uint8_t channel);
352
353 /**
354 * @brief Function for clearing the DPPI publish configuration for a given
355 * IPCT event.
356 *
357 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
358 * @param[in] event Event for which to clear the configuration.
359 */
360 NRF_STATIC_INLINE void nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event);
361
362 /**
363 * @brief Function for getting value of the task overflow status for SEND task.
364 *
365 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
366 * @param[in] index SEND task index to be checked.
367 *
368 * @retval true Task overflow has happened.
369 * @retval false Task overflow has not happened.
370 */
371 NRF_STATIC_INLINE bool nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg, uint8_t index);
372
373 /**
374 * @brief Function for getting SEND task by its index.
375 *
376 * @param[in] index Index of the SEND task.
377 *
378 * @return SEND task.
379 */
380 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_send_task_get(uint8_t index);
381
382 /**
383 * @brief Function for getting ACK task by its index.
384 *
385 * @param[in] index Index of the ACK task.
386 *
387 * @return ACK task.
388 */
389 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_ack_task_get(uint8_t index);
390
391 /**
392 * @brief Function for getting RECEIVE event by its index.
393 *
394 * @param[in] index Index of the RECEIVE event.
395 *
396 * @return RECEIVE event.
397 */
398 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_receive_event_get(uint8_t index);
399
400 /**
401 * @brief Function for getting ACKED event by its index.
402 *
403 * @param[in] index Index of the ACKED event.
404 *
405 * @return ACKED event.
406 */
407 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_acked_event_get(uint8_t index);
408
409 /**
410 * @brief Function for enabling the specified shortcuts.
411 *
412 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
413 * @param[in] mask Shortcuts to be enabled.
414 */
415 NRF_STATIC_INLINE void nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg, uint32_t mask);
416
417 /**
418 * @brief Function for disabling the specified shortcuts.
419 *
420 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
421 * @param[in] mask Shortcuts to be disabled.
422 */
423 NRF_STATIC_INLINE void nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg, uint32_t mask);
424
425 /**
426 * @brief Function for setting the configuration of IPCT shortcuts.
427 *
428 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
429 * @param[in] mask Shortcuts to be set.
430 */
431 NRF_STATIC_INLINE void nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg, uint32_t mask);
432
433 #ifndef NRF_DECLARE_ONLY
434
nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task)435 NRF_STATIC_INLINE void nrf_ipct_task_trigger(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task)
436 {
437 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
438 }
439
nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,nrf_ipct_task_t task)440 NRF_STATIC_INLINE uint32_t nrf_ipct_task_address_get(NRF_IPCT_Type const * p_reg,
441 nrf_ipct_task_t task)
442 {
443 return ((uint32_t)p_reg + (uint32_t)task);
444 }
445
nrf_ipct_event_clear(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event)446 NRF_STATIC_INLINE void nrf_ipct_event_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event)
447 {
448 *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
449 }
450
nrf_ipct_event_check(NRF_IPCT_Type const * p_reg,nrf_ipct_event_t event)451 NRF_STATIC_INLINE bool nrf_ipct_event_check(NRF_IPCT_Type const * p_reg, nrf_ipct_event_t event)
452 {
453 return nrf_event_check(p_reg, event);
454 }
455
nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,nrf_ipct_event_t event)456 NRF_STATIC_INLINE uint32_t nrf_ipct_event_address_get(NRF_IPCT_Type const * p_reg,
457 nrf_ipct_event_t event)
458 {
459 return ((uint32_t)p_reg + (uint32_t)event);
460 }
461
nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,uint8_t group_idx,uint32_t mask)462 NRF_STATIC_INLINE void nrf_ipct_int_enable(NRF_IPCT_Type * p_reg,
463 uint8_t group_idx,
464 uint32_t mask)
465 {
466 switch (group_idx)
467 {
468 case 0:
469 p_reg->INTENSET0 = mask;
470 break;
471 case 1:
472 p_reg->INTENSET1 = mask;
473 break;
474 case 2:
475 p_reg->INTENSET2 = mask;
476 break;
477 case 3:
478 p_reg->INTENSET3 = mask;
479 break;
480 case 4:
481 p_reg->INTENSET4 = mask;
482 break;
483 case 5:
484 p_reg->INTENSET5 = mask;
485 break;
486 case 6:
487 p_reg->INTENSET6 = mask;
488 break;
489 case 7:
490 p_reg->INTENSET7 = mask;
491 break;
492 default:
493 NRFX_ASSERT(false);
494 break;
495 }
496 }
497
nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,uint8_t group_idx,uint32_t mask)498 NRF_STATIC_INLINE void nrf_ipct_int_disable(NRF_IPCT_Type * p_reg,
499 uint8_t group_idx,
500 uint32_t mask)
501 {
502 switch (group_idx)
503 {
504 case 0:
505 p_reg->INTENCLR0 = mask;
506 break;
507 case 1:
508 p_reg->INTENCLR1 = mask;
509 break;
510 case 2:
511 p_reg->INTENCLR2 = mask;
512 break;
513 case 3:
514 p_reg->INTENCLR3 = mask;
515 break;
516 case 4:
517 p_reg->INTENCLR4 = mask;
518 break;
519 case 5:
520 p_reg->INTENCLR5 = mask;
521 break;
522 case 6:
523 p_reg->INTENCLR6 = mask;
524 break;
525 case 7:
526 p_reg->INTENCLR7 = mask;
527 break;
528 default:
529 NRFX_ASSERT(false);
530 break;
531 }
532 }
533
nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,uint8_t group_idx,uint32_t mask)534 NRF_STATIC_INLINE uint32_t nrf_ipct_int_enable_check(NRF_IPCT_Type const * p_reg,
535 uint8_t group_idx,
536 uint32_t mask)
537 {
538 switch (group_idx)
539 {
540 case 0:
541 return p_reg->INTENSET0 & mask;
542 case 1:
543 return p_reg->INTENSET1 & mask;
544 case 2:
545 return p_reg->INTENSET2 & mask;
546 case 3:
547 return p_reg->INTENSET3 & mask;
548 case 4:
549 return p_reg->INTENSET4 & mask;
550 case 5:
551 return p_reg->INTENSET5 & mask;
552 case 6:
553 return p_reg->INTENSET6 & mask;
554 case 7:
555 return p_reg->INTENSET7 & mask;
556 default:
557 NRFX_ASSERT(false);
558 return 0;
559 }
560 }
561
nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,uint8_t group_idx)562 NRF_STATIC_INLINE uint32_t nrf_ipct_int_pending_get(NRF_IPCT_Type const * p_reg,
563 uint8_t group_idx)
564 {
565 switch (group_idx)
566 {
567 case 0:
568 return p_reg->INTPEND0;
569 case 1:
570 return p_reg->INTPEND1;
571 case 2:
572 return p_reg->INTPEND2;
573 case 3:
574 return p_reg->INTPEND3;
575 case 4:
576 return p_reg->INTPEND4;
577 case 5:
578 return p_reg->INTPEND5;
579 case 6:
580 return p_reg->INTPEND6;
581 case 7:
582 return p_reg->INTPEND7;
583 default:
584 NRFX_ASSERT(false);
585 return 0;
586 }
587 }
588
nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task,uint8_t channel)589 NRF_STATIC_INLINE void nrf_ipct_subscribe_set(NRF_IPCT_Type * p_reg,
590 nrf_ipct_task_t task,
591 uint8_t channel)
592 {
593 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) =
594 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
595 }
596
nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg,nrf_ipct_task_t task)597 NRF_STATIC_INLINE void nrf_ipct_subscribe_clear(NRF_IPCT_Type * p_reg, nrf_ipct_task_t task)
598 {
599 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) task + 0x80uL)) = 0;
600 }
601
nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event,uint8_t channel)602 NRF_STATIC_INLINE void nrf_ipct_publish_set(NRF_IPCT_Type * p_reg,
603 nrf_ipct_event_t event,
604 uint8_t channel)
605 {
606 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) =
607 ((uint32_t)channel | NRF_SUBSCRIBE_PUBLISH_ENABLE);
608 }
609
nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg,nrf_ipct_event_t event)610 NRF_STATIC_INLINE void nrf_ipct_publish_clear(NRF_IPCT_Type * p_reg, nrf_ipct_event_t event)
611 {
612 *((volatile uint32_t *) ((uint8_t *) p_reg + (uint32_t) event + 0x80uL)) = 0;
613 }
614
nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg,uint8_t index)615 NRF_STATIC_INLINE bool nrf_ipct_overflow_send_get(NRF_IPCT_Type const * p_reg, uint8_t index)
616 {
617 NRFX_ASSERT(index < NRF_IPCT_TASKS_SEND_COUNT);
618 return (p_reg->OVERFLOW.SEND & (1uL << index));
619 }
620
nrf_ipct_send_task_get(uint8_t index)621 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_send_task_get(uint8_t index)
622 {
623 return (nrf_ipct_task_t)(NRFX_OFFSETOF(NRF_IPCT_Type, TASKS_SEND[index]));
624 }
625
nrf_ipct_ack_task_get(uint8_t index)626 NRF_STATIC_INLINE nrf_ipct_task_t nrf_ipct_ack_task_get(uint8_t index)
627 {
628 #if NRF_IPCT_HAS_ACK
629 return (nrf_ipct_task_t)(NRFX_OFFSETOF(NRF_IPCT_Type, TASKS_ACK[index]));
630 #else
631 (void)index;
632 return (nrf_ipct_task_t)0;
633 #endif
634 }
635
nrf_ipct_receive_event_get(uint8_t index)636 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_receive_event_get(uint8_t index)
637 {
638 return (nrf_ipct_event_t)(NRFX_OFFSETOF(NRF_IPCT_Type, EVENTS_RECEIVE[index]));
639 }
640
nrf_ipct_acked_event_get(uint8_t index)641 NRF_STATIC_INLINE nrf_ipct_event_t nrf_ipct_acked_event_get(uint8_t index)
642 {
643 #if NRF_IPCT_HAS_ACK
644 return (nrf_ipct_event_t)(NRFX_OFFSETOF(NRF_IPCT_Type, EVENTS_ACKED[index]));
645 #else
646 (void)index;
647 return (nrf_ipct_event_t)0;
648 #endif
649 }
650
nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg,uint32_t mask)651 NRF_STATIC_INLINE void nrf_ipct_shorts_enable(NRF_IPCT_Type * p_reg, uint32_t mask)
652 {
653 p_reg->SHORTS |= mask;
654 }
655
nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg,uint32_t mask)656 NRF_STATIC_INLINE void nrf_ipct_shorts_disable(NRF_IPCT_Type * p_reg, uint32_t mask)
657 {
658 p_reg->SHORTS &= ~(mask);
659 }
660
nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg,uint32_t mask)661 NRF_STATIC_INLINE void nrf_ipct_shorts_set(NRF_IPCT_Type * p_reg, uint32_t mask)
662 {
663 p_reg->SHORTS = mask;
664 }
665
666 #endif // NRF_DECLARE_ONLY
667
668 /** @} */
669
670 #ifdef __cplusplus
671 }
672 #endif
673
674 #endif // NRF_IPCT_H__
675