1 /* 2 * Copyright (c) 2021-2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include "../radio/radio_nrf5_resources.h" 8 #include "../radio/radio_nrf5_fem.h" 9 10 /* NOTE: BT_CTLR_USED_PPI_CHANNELS is defined based on PPI defines being 11 * defined in the below PPI/DPPI resources header file. Take care to 12 * conditionally compile them based on feature Kconfig defines in those 13 * resources header file. 14 */ 15 #ifdef DPPI_PRESENT 16 #include "../radio/radio_nrf5_dppi_resources.h" 17 #else 18 #include "../radio/radio_nrf5_ppi_resources.h" 19 #endif 20 21 /* Mask with all (D)PPI channels used by the bluetooth controller. */ 22 #define BT_CTLR_USED_PPI_CHANNELS \ 23 (BIT(HAL_RADIO_ENABLE_TX_ON_TICK_PPI) | \ 24 BIT(HAL_RADIO_ENABLE_RX_ON_TICK_PPI) | \ 25 BIT(HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI) | \ 26 BIT(HAL_RADIO_DISABLE_ON_HCTO_PPI) | \ 27 BIT(HAL_RADIO_END_TIME_CAPTURE_PPI) | \ 28 BIT(HAL_EVENT_TIMER_START_PPI) | \ 29 BIT(HAL_RADIO_READY_TIME_CAPTURE_PPI) | \ 30 BIT(HAL_TRIGGER_CRYPT_PPI) | \ 31 BIT(HAL_TRIGGER_AAR_PPI) | \ 32 BT_CTLR_USED_PPI_CHANNELS_2 | BT_CTLR_USED_PPI_CHANNELS_3 | \ 33 BT_CTLR_USED_PPI_CHANNELS_4 | BT_CTLR_USED_PPI_CHANNELS_5 | \ 34 BT_CTLR_USED_PPI_CHANNELS_6 | HAL_USED_PPI_CHANNELS_7) 35 36 #if defined(HAL_TRIGGER_RATEOVERRIDE_PPI) 37 #define BT_CTLR_USED_PPI_CHANNELS_2 \ 38 BIT(HAL_TRIGGER_RATEOVERRIDE_PPI) 39 #else 40 #define BT_CTLR_USED_PPI_CHANNELS_2 0 41 #endif 42 43 #if defined(HAL_ENABLE_PALNA_PPI) 44 #define BT_CTLR_USED_PPI_CHANNELS_3 \ 45 (BIT(HAL_ENABLE_PALNA_PPI) | \ 46 BIT(HAL_DISABLE_PALNA_PPI)) 47 #else 48 #define BT_CTLR_USED_PPI_CHANNELS_3 0 49 #endif 50 51 #if defined(HAL_SW_SWITCH_TIMER_CLEAR_PPI) 52 #define BT_CTLR_USED_PPI_CHANNELS_4 \ 53 (BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) | \ 54 BIT(HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI_BASE) | \ 55 BIT(HAL_SW_SWITCH_GROUP_TASK_DISABLE_PPI_BASE + 1) | \ 56 BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI) | \ 57 BIT(HAL_SW_SWITCH_RADIO_ENABLE_PPI_BASE) | \ 58 BIT(HAL_SW_SWITCH_RADIO_ENABLE_PPI_BASE + 1)) 59 #else 60 #define BT_CTLR_USED_PPI_CHANNELS_4 0 61 #endif 62 63 #if defined(HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE) 64 #define BT_CTLR_USED_PPI_CHANNELS_5 \ 65 (BIT(HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE) | \ 66 BIT(HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE + 1) | \ 67 BIT(HAL_SW_SWITCH_TIMER_S8_DISABLE_PPI)) 68 #else 69 #define BT_CTLR_USED_PPI_CHANNELS_5 0 70 #endif 71 72 #if defined(HAL_ENABLE_FEM_PPI) 73 #define BT_CTLR_USED_PPI_CHANNELS_6 \ 74 (BIT(HAL_ENABLE_FEM_PPI) | \ 75 BIT(HAL_DISABLE_FEM_PPI)) 76 #else 77 #define BT_CTLR_USED_PPI_CHANNELS_6 0 78 #endif 79 80 #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) 81 #ifdef DPPI_PRESENT 82 #define HAL_USED_PPI_CHANNELS_7 \ 83 (BIT(HAL_SW_SWITCH_TIMER_PHYEND_DELAY_COMPENSATION_DISABLE_PPI)) 84 #else 85 #define HAL_USED_PPI_CHANNELS_7 \ 86 (BIT(HAL_SW_SWITCH_RADIO_ENABLE_PHYEND_DELAY_COMPENSATION_PPI_BASE) | \ 87 BIT(HAL_SW_SWITCH_RADIO_ENABLE_PHYEND_DELAY_COMPENSATION_PPI_BASE + 1) | \ 88 BIT(HAL_SW_SWITCH_TIMER_PHYEND_DELAY_COMPENSATION_DISABLE_PPI)) 89 #endif /* DPPI_PRESENT */ 90 #else 91 #define HAL_USED_PPI_CHANNELS_7 0 92 #endif /* CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE */ 93 94 #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) 95 #define HAL_USED_PPI_CHANNELS_8 \ 96 BIT(HAL_TRIGGER_CRYPT_DELAY_PPI) 97 #else 98 #define HAL_USED_PPI_CHANNELS_8 0 99 #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */ 100 101 /* Mask with all (D)PPI groups used by the bluetooth controller. */ 102 #if defined(SW_SWITCH_TIMER_TASK_GROUP_BASE) 103 #define BT_CTLR_USED_PPI_GROUPS \ 104 (BIT(SW_SWITCH_TIMER_TASK_GROUP_BASE) | \ 105 BIT(SW_SWITCH_TIMER_TASK_GROUP_BASE + 1)) 106 #else 107 #define BT_CTLR_USED_PPI_GROUPS 0 108 #endif 109