1 /* 2 * Copyright (c) 2018-2022 Nordic Semiconductor ASA 3 * Copyright (c) 2018 Ioannis Glaropoulos 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 /* HAL header files for nRF5x SoCs. 9 * These has to come before the radio_*.h include below. 10 */ 11 #include <hal/nrf_radio.h> 12 13 /* Common radio resources */ 14 #include "radio_nrf5_resources.h" 15 16 /* Helpers for radio timing conversions. 17 * These has to come before the radio_*.h include below. 18 */ 19 #define HAL_RADIO_NS2US_CEIL(ns) ((ns + 999)/1000) 20 #define HAL_RADIO_NS2US_ROUND(ns) ((ns + 500)/1000) 21 22 /* SoC specific defines */ 23 #if defined(CONFIG_SOC_SERIES_NRF51X) 24 #include "radio_nrf51.h" 25 #elif defined(CONFIG_SOC_NRF52805) 26 #include "radio_nrf52805.h" 27 #elif defined(CONFIG_SOC_NRF52810) 28 #include "radio_nrf52810.h" 29 #elif defined(CONFIG_SOC_NRF52811) 30 #include "radio_nrf52811.h" 31 #elif defined(CONFIG_SOC_NRF52820) 32 #include "radio_nrf52820.h" 33 #elif defined(CONFIG_SOC_NRF52832) 34 #include "radio_nrf52832.h" 35 #elif defined(CONFIG_SOC_NRF52833) 36 #include "radio_nrf52833.h" 37 #elif defined(CONFIG_SOC_NRF52840) 38 #include "radio_nrf52840.h" 39 #elif defined(CONFIG_SOC_NRF5340_CPUNET) 40 #include <hal/nrf_vreqctrl.h> 41 #include "radio_nrf5340.h" 42 #elif defined(CONFIG_SOC_SERIES_NRF54LX) 43 #include "radio_nrf54lx.h" 44 #elif defined(CONFIG_BOARD_NRF52_BSIM) 45 #include "radio_sim_nrf52.h" 46 #elif defined(CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUNET) 47 #include <hal/nrf_vreqctrl.h> 48 #include "radio_sim_nrf5340.h" 49 #elif defined(CONFIG_BOARD_NRF54L15BSIM_NRF54L15_CPUAPP) 50 #include "radio_sim_nrf54l.h" 51 #else 52 #error "Unsupported SoC." 53 #endif 54 55 #if defined(CONFIG_BT_CTLR_NRF_GRTC) 56 #include <hal/nrf_grtc.h> 57 #include <hal/nrf_ppib.h> 58 #else /* !CONFIG_BT_CTLR_NRF_GRTC */ 59 #include <hal/nrf_rtc.h> 60 #endif /* !CONFIG_BT_CTLR_NRF_GRTC */ 61 62 #include <hal/nrf_timer.h> 63 64 #if defined(CONFIG_BT_CTLR_LE_ENC) || defined(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) 65 #include <hal/nrf_ccm.h> 66 #include <hal/nrf_aar.h> 67 #endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */ 68 69 /* Define to reset PPI registration. 70 * This has to come before the ppi/dppi includes below. 71 */ 72 #define NRF_PPI_NONE 0 73 74 /* This has to come before the ppi/dppi includes below. */ 75 #include "radio_nrf5_fem.h" 76 77 /* Include RTC/GRTC Compare Index used to Trigger Radio TXEN/RXEN */ 78 #include "hal/cntr.h" 79 80 #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_COMPATIBLE_NRF52X) 81 #include <hal/nrf_ppi.h> 82 #include "radio_nrf5_ppi_resources.h" 83 #include "radio_nrf5_ppi.h" 84 #else 85 #include <hal/nrf_dppi.h> 86 #include "radio_nrf5_dppi_resources.h" 87 #include "radio_nrf5_dppi.h" 88 #endif 89 90 #include "radio_nrf5_txp.h" 91 92 /* Common NRF_RADIO power-on reset value. Refer to Product Specification, 93 * RADIO Registers section for the documented reset values. 94 * 95 * NOTE: Only implementation used values defined here. 96 * In the future if MDK or nRFx header include these, use them instead. 97 */ 98 #define HAL_RADIO_RESET_VALUE_PCNF1 0x00000000UL 99 100 /* SoC specific Radio PDU length field maximum value */ 101 #if defined(CONFIG_SOC_SERIES_NRF51X) 102 #define HAL_RADIO_PDU_LEN_MAX (BIT(5) - 1) 103 #else 104 #define HAL_RADIO_PDU_LEN_MAX (BIT(8) - 1) 105 #endif 106 107 /* This is delay between PPI task START and timer actual start counting. */ 108 #if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX) 109 #define HAL_RADIO_TMR_START_DELAY_US 1U 110 #else /* For simulated targets there is no delay for the PPI task -> TIMER start */ 111 #define HAL_RADIO_TMR_START_DELAY_US 0U 112 #endif 113 114 /* This is the minimum prepare duration required to setup radio for deferred transmission */ 115 #define HAL_RADIO_TMR_DEFERRED_TX_DELAY_US 50U 116