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_BOARD_NRF52_BSIM) 24 #include "radio_sim_nrf52.h" 25 #elif defined(CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUNET) 26 #include "radio_sim_nrf5340.h" 27 #elif defined(CONFIG_SOC_SERIES_NRF51X) 28 #include "radio_nrf51.h" 29 #elif defined(CONFIG_SOC_NRF52805) 30 #include "radio_nrf52805.h" 31 #elif defined(CONFIG_SOC_NRF52810) 32 #include "radio_nrf52810.h" 33 #elif defined(CONFIG_SOC_NRF52811) 34 #include "radio_nrf52811.h" 35 #elif defined(CONFIG_SOC_NRF52820) 36 #include "radio_nrf52820.h" 37 #elif defined(CONFIG_SOC_NRF52832) 38 #include "radio_nrf52832.h" 39 #elif defined(CONFIG_SOC_NRF52833) 40 #include "radio_nrf52833.h" 41 #elif defined(CONFIG_SOC_NRF52840) 42 #include "radio_nrf52840.h" 43 #elif defined(CONFIG_SOC_NRF5340_CPUNET) 44 #include <hal/nrf_vreqctrl.h> 45 #include "radio_nrf5340.h" 46 #elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX) 47 #include "radio_nrf54lx.h" 48 #else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */ 49 #error "Unsupported SoC." 50 #endif 51 52 #include <hal/nrf_rtc.h> 53 #include <hal/nrf_timer.h> 54 55 #if defined(CONFIG_BT_CTLR_LE_ENC) || defined(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) 56 #include <hal/nrf_ccm.h> 57 #include <hal/nrf_aar.h> 58 #endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */ 59 60 /* Define to reset PPI registration. 61 * This has to come before the ppi/dppi includes below. 62 */ 63 #define NRF_PPI_NONE 0 64 65 /* This has to come before the ppi/dppi includes below. */ 66 #include "radio_nrf5_fem.h" 67 68 #if defined(PPI_PRESENT) 69 #include <hal/nrf_ppi.h> 70 #include "radio_nrf5_ppi_resources.h" 71 #include "radio_nrf5_ppi.h" 72 #elif defined(DPPI_PRESENT) 73 #include <hal/nrf_dppi.h> 74 #include "radio_nrf5_dppi_resources.h" 75 #include "radio_nrf5_dppi.h" 76 #else 77 #error "PPI or DPPI abstractions missing." 78 #endif 79 80 #include "radio_nrf5_txp.h" 81 82 /* Common NRF_RADIO power-on reset value. Refer to Product Specification, 83 * RADIO Registers section for the documented reset values. 84 * 85 * NOTE: Only implementation used values defined here. 86 * In the future if MDK or nRFx header include these, use them instead. 87 */ 88 #define HAL_RADIO_RESET_VALUE_PCNF1 0x00000000UL 89 90 /* SoC specific Radio PDU length field maximum value */ 91 #if defined(CONFIG_SOC_SERIES_NRF51X) 92 #define HAL_RADIO_PDU_LEN_MAX (BIT(5) - 1) 93 #else 94 #define HAL_RADIO_PDU_LEN_MAX (BIT(8) - 1) 95 #endif 96 97 /* This is delay between PPI task START and timer actual start counting. */ 98 #if !defined(CONFIG_SOC_SERIES_BSIM_NRFXX) 99 #define HAL_RADIO_TMR_START_DELAY_US 1U 100 #else /* For simulated targets there is no delay for the PPI task -> TIMER start */ 101 #define HAL_RADIO_TMR_START_DELAY_US 0U 102 #endif 103