1 /*
2  * Copyright (c) 2022 - 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 NRFX_INTERCONNECT_IPCT_H__
35 #define NRFX_INTERCONNECT_IPCT_H__
36 
37 #include <nrfx.h>
38 #include <hal/nrf_ipct.h>
39 #include <soc/interconnect/apb/nrfx_interconnect_apb.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @defgroup nrfx_interconnect_ipct IPCT support
47  * @{
48  * @ingroup nrfx
49  * @brief   Support for IPCT interconnection services.
50  */
51 
52 /** @brief IPCT properties structure. */
53 typedef struct {
54     NRF_IPCT_Type * p_ipct;                 ///< Pointer to IPCT instance
55     nrfx_atomic_t * p_ipct_channels;        ///< Pointer to the mask of available IPCT channels.
56     uint32_t        ipct_pub_channels_mask; ///< Mask of configurable IPCT publish channels.
57     uint32_t        ipct_sub_channels_mask; ///< Mask of configurable IPCT subscribe channels.
58 } nrfx_interconnect_ipct_t;
59 
60 /**
61  * @brief Function for getting the domain to which the specified IPCT belongs.
62  *
63  * @param[in] p_ipct_prop Pointer to IPCT properties structure.
64  *
65  * @return Domain that includes the specified IPCT.
66  */
67 nrf_domain_t nrfx_interconnect_ipct_domain_get(nrfx_interconnect_ipct_t const * p_ipct_prop);
68 
69 /**
70  * @brief Function for getting IPCT properties structure by pointer to APB bus properties
71  *        structure to which this particular IPCT belongs.
72  *
73  * @param[in] p_apb_prop Pointer to APB properties structure.
74  *
75  * @return Pointer to the IPCT properties structure that belongs to the specified APB bus.
76  */
77 nrfx_interconnect_ipct_t const * nrfx_interconnect_ipct_get(nrfx_interconnect_apb_t const * p_apb_prop);
78 
79 /**
80  * @brief Function for getting number entries for global domain in IPCT peripheral properties
81  *        array.
82  *
83  * @return Number of entries in global IPCT peripheral properties array.
84  */
85 size_t nrfx_interconnect_ipct_global_num_of_get(void);
86 
87 /**
88  * @brief Function for getting IPCT properties structure by index of IPCT peripheral properties
89  *        array.
90  *
91  * @param[in] idx Index of entry in IPCT peripheral properties array.
92  *
93  * @return Pointer to the properties structure that represents IPCT assigned to given index.
94  */
95 nrfx_interconnect_ipct_t const * nrfx_interconnect_ipct_global_by_idx_get(uint8_t idx);
96 
97 /** @} */
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif // NRFX_INTERCONNECT_IPCT_H__
104