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 NRFX_INTERCONNECT_DPPIC_PPIB_H__ 35 #define NRFX_INTERCONNECT_DPPIC_PPIB_H__ 36 37 #include <nrfx_dppi.h> 38 #include <nrfx_ppib.h> 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /** 45 * @defgroup nrfx_interconnect_dppic_ppib DPPIC and PPIB interconnect support 46 * @{ 47 * @ingroup nrfx 48 * @brief Support for DPPIC and PPIB interconnect services. 49 */ 50 51 /** @brief PPIB interconnect properties structure. */ 52 typedef struct 53 { 54 nrfx_ppib_interconnect_t ppib; ///< Interconnect instance. 55 uint8_t allocate_flag[PPIB_CHANNEL_MAX_COUNT]; ///< Virtual channels assigned to each of PPIB channels. 56 } nrfx_interconnect_ppib_t; 57 58 /** @brief DPPIC and PPIB interconnect properties structure. */ 59 typedef struct 60 { 61 NRF_DPPIC_Type * dppic; ///< DPPIC peripheral. 62 NRF_PPIB_Type * ppib; ///< PPIB peripheral. 63 } nrfx_interconnect_dppic_ppib_t; 64 65 /** @brief DPPIC properties structure. */ 66 typedef struct 67 { 68 uint8_t apb_index; ///< APB index to which DPPIC belongs. 69 #if NRFX_API_VER_AT_LEAST(3, 8, 0) || defined(__NRFX_DOXYGEN__) 70 nrfx_dppi_t dppic; ///< DPPIC peripheral that belongs to a given domain. 71 #else 72 NRF_DPPIC_Type * dppic; ///< DPPIC peripheral that belongs to a given domain. 73 nrfx_atomic_t channels_mask; ///< Mask of configurable DPPIC channels. 74 #endif 75 uint8_t allocate_flag[NRF_DPPI_CH_NUM_MAX]; ///< Virtual channels assigned to each of DPPIC channels. 76 uint32_t apb_size; ///< Size of APB. 77 } nrfx_interconnect_dppic_t; 78 79 /** @brief DPPIC to DPPIC connection structure. */ 80 typedef struct 81 { 82 nrfx_interconnect_dppic_t * src_dppic; ///< Pointer to the source of DPPIC interconnect instance. 83 nrfx_interconnect_dppic_t * dst_dppic; ///< Pointer to the destination of DPPIC interconnect instance. 84 nrfx_interconnect_ppib_t * ppib; ///< Pointer to the PPIB interconnect instance between @p src_dppic and @p dst_dppic. 85 bool ppib_inverted; ///< True if PPIB connection goes from second to first PPIB peripherial instance, false otherwise. 86 } nrfx_interconnect_dppic_to_dppic_path_t; 87 88 /** 89 * @brief Function for getting DPPIC interconnect object under a specific index from connection map. 90 * 91 * @param[in] index Index of expected @ref nrfx_interconnect_dppic_t object. 92 * 93 * @return Pointer to @ref nrfx_interconnect_dppic_t. 94 */ 95 nrfx_interconnect_dppic_t * nrfx_interconnect_dppic_at_index_get(uint8_t index); 96 97 /** 98 * @brief Function for getting DPPIC interconnect object with a specific domain. 99 * 100 * @param[in] apb_index APB index that belongs to DPPIC interconnect. 101 * 102 * @return Pointer to @ref nrfx_interconnect_dppic_t. 103 */ 104 nrfx_interconnect_dppic_t * nrfx_interconnect_dppic_get(uint8_t apb_index); 105 106 /** 107 * @brief Function for getting main DPPIC interconnect object. 108 * 109 * @return Pointer to @ref nrfx_interconnect_dppic_t. 110 */ 111 nrfx_interconnect_dppic_t * nrfx_interconnect_dppic_main_get(void); 112 113 /** 114 * @brief Function for getting PPIB interconnect object at specified index from connection map. 115 * 116 * @param[in] index Index of expected @ref nrfx_interconnect_ppib_t object. 117 * 118 * @return Pointer to @ref nrfx_interconnect_ppib_t. 119 */ 120 nrfx_interconnect_ppib_t * nrfx_interconnect_ppib_at_index_get(uint8_t index); 121 122 /** 123 * @brief Function for checking if path from source DPPIC to destination DPPIC exists. 124 * 125 * @param[in] p_path Pointer to path from source DPPIC to destination DPPIC. 126 * When path exists, @p p_path is filled with PPIB information. 127 * 128 * @return True if direct connection exists, false otherwise. 129 */ 130 bool nrfx_interconnect_direct_connection_check(nrfx_interconnect_dppic_to_dppic_path_t * p_path); 131 132 /** 133 * @brief Function for getting @p nrf_apb_index_t from memory address. 134 * 135 * @param[in] addr Memory address. 136 * 137 * @return APB index. 138 */ 139 nrf_apb_index_t nrfx_interconnect_apb_index_get(uint32_t addr); 140 141 /** @} */ 142 143 #ifdef __cplusplus 144 } 145 #endif 146 147 #endif // NRFX_INTERCONNECT_DPPIC_PPIB_H__ 148