1 /* 2 * Copyright (c) 2023 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /* Use the timer instance ID, not NRF_TIMERx directly, so that it can be checked 8 * in radio_nrf5_ppi.h by the preprocessor. 9 */ 10 #if defined(CONFIG_BT_CTLR_TIFS_HW) 11 #define EVENT_TIMER_ID 0 12 #define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID) 13 14 /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission 15 * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is 16 * received or transmitted. 17 */ 18 #define NRF_RADIO_TRX_END_EVENT EVENTS_END 19 20 /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. 21 * This is a default shortcut used to automatically disable Radio after end of PDU. 22 */ 23 #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk 24 25 #define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 26 #define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 27 28 #else /* !CONFIG_BT_CTLR_TIFS_HW */ 29 #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) 30 #define EVENT_TIMER_ID 4 31 #define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID) 32 33 #define SW_SWITCH_TIMER EVENT_TIMER 34 35 #if defined(CONFIG_BT_CTLR_PHY_CODED) 36 #define SW_SWITCH_TIMER_EVTS_COMP_BASE 3 37 #define SW_SWITCH_TIMER_EVTS_COMP_S2_BASE 5 38 39 /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission 40 * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is 41 * received or transmitted. 42 */ 43 #define NRF_RADIO_TRX_END_EVENT EVENTS_END 44 45 /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. 46 * This is a default shortcut used to automatically disable Radio after end of PDU. 47 */ 48 #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk 49 50 #define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 2 51 #define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE2 52 53 #else /* !CONFIG_BT_CTLR_PHY_CODED */ 54 #define SW_SWITCH_TIMER_EVTS_COMP_BASE 4 55 56 /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission 57 * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is 58 * received or transmitted. 59 */ 60 #define NRF_RADIO_TRX_END_EVENT EVENTS_END 61 62 /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. 63 * This is a default shortcut used to automatically disable Radio after end of PDU. 64 */ 65 #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk 66 67 #define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 68 #define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 69 #endif /* !CONFIG_BT_CTLR_PHY_CODED */ 70 71 #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ 72 #define EVENT_TIMER_ID 0 73 #define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID) 74 75 #define SW_SWITCH_TIMER NRF_TIMER1 76 #define SW_SWITCH_TIMER_EVTS_COMP_BASE 0 77 78 #if defined(CONFIG_BT_CTLR_PHY_CODED) 79 #define SW_SWITCH_TIMER_EVTS_COMP_S2_BASE 2 80 #endif /* !CONFIG_BT_CTLR_PHY_CODED */ 81 82 #if defined(CONFIG_BT_CTLR_DF) 83 84 #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) 85 /* Allocate 2 adjacent channels for PHYEND delay compensation. Use the same channels as for 86 * PHY CODED S2. The CTEINLINE may not be enabled for PHY CODED so PHYEND event is generated 87 * at the same instant as END event. Hence the channels are used interchangeably. 88 * That saves from use of another timer. 89 */ 90 #define SW_SWITCH_TIMER_EVTS_COMP_PHYEND_DELAY_COMPENSATION_BASE 2 91 #endif /* CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE */ 92 93 /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission 94 * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is 95 * received or transmitted. 96 * 97 * When direction finding is enabled a PDU may include Constant Tone Extension at its end. For PDU 98 * including CTE EVENTS_PHYEND event is generated at very end of a PDU. In case there is no CTE in 99 * a PDU the EVENTS_PHYEND event is generated in the same instant as EVENTS_END event. 100 */ 101 #define NRF_RADIO_TRX_END_EVENT EVENTS_PHYEND 102 103 /* Wrapper for RADIO_SHORTS mask connecting EVENTS_PHYEND to EVENTS_DISABLE. 104 * This is a mask for SOC that has Direction Finding Extension in a Radio peripheral. 105 * It enables shortcut for EVENTS_PHYEND event generated at very end to Radio EVENTS_DISABLE event. 106 * In case there is a CTE in a PDU then EVENTS_PHYEND event is generated after the CTE. 107 * If there is no CTE, it is generated in the same instant as EVENTS_END. 108 */ 109 #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_PHYEND_DISABLE_Msk 110 111 /* Delay of EVENTS_PHYEND event on receive PDU without CTE included when CTEINLINE is enabled */ 112 #define RADIO_EVENTS_PHYEND_DELAY_US 16 113 114 /* Delay of CCM TASKS_CRYPT start in number of bits for Radio Bit counter */ 115 #define CCM_TASKS_CRYPT_DELAY_BITS 3 116 117 #else /* !CONFIG_BT_CTLR_DF */ 118 /* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission 119 * or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is 120 * received or transmitted. 121 */ 122 #define NRF_RADIO_TRX_END_EVENT EVENTS_END 123 124 /* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE. 125 * This is a default shortcut used to automatically disable Radio after end of PDU. 126 */ 127 #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk 128 #endif /* !CONFIG_BT_CTLR_DF */ 129 130 #define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 131 #define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 132 #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ 133 #endif /* !CONFIG_BT_CTLR_TIFS_HW */ 134