1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

pkg: add nrfx as package

This commit is contained in:
Hauke Petersen 2022-03-22 08:53:37 +01:00
parent 5430c145f8
commit 068c4f1c3b
8 changed files with 414 additions and 3 deletions

View File

@ -19,8 +19,8 @@
* @author Koen Zandberg <koen@bergzand.net>
*/
#ifndef NRFX_H
#define NRFX_H
#ifndef NRFX_RIOT_H
#define NRFX_RIOT_H
#include "kernel_defines.h"
#include "cpu_conf.h"
@ -63,5 +63,5 @@ static inline void nrfx_dcdc_init(void)
}
#endif
#endif /* NRFX_H */
#endif /* NRFX_RIOT_H */
/** @} */

View File

@ -168,6 +168,7 @@ PSEUDOMODULES += nimble_phy_2mbit
PSEUDOMODULES += nimble_rpble_ext
PSEUDOMODULES += nimble_statconn_ext
PSEUDOMODULES += nimble_autoadv_shell
PSEUDOMODULES += nrfx
PSEUDOMODULES += newlib
PSEUDOMODULES += newlib_gnu_source
PSEUDOMODULES += newlib_nano

10
pkg/nrfx/Kconfig Normal file
View File

@ -0,0 +1,10 @@
# Copyright (c) 2022 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
config PACKAGE_NRFX
bool "Nordic nrfx HAL"
depends on TEST_KCONFIG

8
pkg/nrfx/Makefile Normal file
View File

@ -0,0 +1,8 @@
PKG_NAME=nrfx
PKG_URL=https://github.com/NordicSemiconductor/nrfx
PKG_VERSION=3521c97df0b9549daecf867fb588f62819c317b4 # Release 2.7.0
PKG_LICENSE=BSD-3-Clause
include $(RIOTBASE)/pkg/pkg.mk
all:

28
pkg/nrfx/Makefile.include Normal file
View File

@ -0,0 +1,28 @@
ifneq (,$(filter nrf51,$(CPU_FAM)))
CFLAGS += -DNRF51
endif
ifneq (,$(filter nrf52805xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52805_XXAA
endif
ifneq (,$(filter nrf52810xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52810_XXAA
endif
ifneq (,$(filter nrf52811xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52811_XXAA
endif
ifneq (,$(filter nrf52820xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52820_XXAA
endif
ifneq (,$(filter nrf52832xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52832_XXAA
endif
ifneq (,$(filter nrf52833xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52833_XXAA
endif
ifneq (,$(filter nrf52840xxaa,$(CPU_MODEL)))
CFLAGS += -DNRF52840_XXAA
endif
INCLUDES += -I$(PKGDIRBASE)/nrfx
INCLUDES += -I$(PKGDIRBASE)/nrfx/mdk
INCLUDES += -I$(RIOTPKG)/nrfx/include

20
pkg/nrfx/doc.txt Normal file
View File

@ -0,0 +1,20 @@
/**
* @defgroup pkg_nrfx Nordic nrfx HAL
* @ingroup pkg
* @brief Provides the Nordic nrfx HAL
*
* # Introduction
*
* "nrfx is a standalone set of drivers for peripherals present in Nordic Semiconductor's SoCs. It
* originated as an extract from the nRF5 SDK. The intention was to provide drivers that can be
* used in various environments without the necessity to integrate other parts of the SDK into them.
* For the user's convenience, the drivers come with the MDK package. This package contains
* definitions of register structures and bitfields for all supported SoCs, as well as startup and
* initialization files for them."
*
* # License
*
* Licensed under BSD-3-Clause.
*
* @see https://github.com/NordicSemiconductor/nrfx
*/

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2019 - 2021, Nordic Semiconductor ASA
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @ingroup pkg_nrfx
* @{
*
* @file
* @brief Config header for the nrfx BSP package
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NRFX_CONFIG_H
#define NRFX_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
/* as of now we are only using the plain headers of the nrfx package and there
* is nothing to configure for this */
#ifdef __cplusplus
}
#endif
#endif /* NRFX_CONFIG_H */
/** @} **/

View File

@ -0,0 +1,285 @@
/*
* Copyright (c) 2017 - 2021, Nordic Semiconductor ASA
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @ingroup pkg_nrfx
* @{
*
* @file
* @brief This file contains macros that should be implemented according
* to the needs of the host environment into which nrfx is
* integrated.
*
* @author Nordic Semiconductor ASA
*/
#ifndef NRFX_GLUE_H
#define NRFX_GLUE_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Macro for placing a runtime assertion.
*
* @param expression Expression to be evaluated.
*/
#define NRFX_ASSERT(expression)
/**
* @brief Macro for placing a compile time assertion.
*
* @param expression Expression to be evaluated.
*/
#define NRFX_STATIC_ASSERT(expression)
/**
* @brief Macro for setting the priority of a specific IRQ.
*
* @param irq_number IRQ number.
* @param priority Priority to be set.
*/
#define NRFX_IRQ_PRIORITY_SET(irq_number, priority)
/**
* @brief Macro for enabling a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_ENABLE(irq_number)
/**
* @brief Macro for checking if a specific IRQ is enabled.
*
* @param irq_number IRQ number.
*
* @retval true If the IRQ is enabled.
* @retval false Otherwise.
*/
#define NRFX_IRQ_IS_ENABLED(irq_number)
/**
* @brief Macro for disabling a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_DISABLE(irq_number)
/**
* @brief Macro for setting a specific IRQ as pending.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_PENDING_SET(irq_number)
/**
* @brief Macro for clearing the pending status of a specific IRQ.
*
* @param irq_number IRQ number.
*/
#define NRFX_IRQ_PENDING_CLEAR(irq_number)
/**
* @brief Macro for checking the pending status of a specific IRQ.
*
* @retval true If the IRQ is pending.
* @retval false Otherwise.
*/
#define NRFX_IRQ_IS_PENDING(irq_number)
/** @brief Macro for entering into a critical section. */
#define NRFX_CRITICAL_SECTION_ENTER()
/** @brief Macro for exiting from a critical section. */
#define NRFX_CRITICAL_SECTION_EXIT()
/**
* @brief When set to a non-zero value, this macro specifies that
* nrfx_coredep_delay_us uses a precise DWT-based solution.
* A compilation error is generated if the DWT unit is not present
* in the SoC used.
*/
#define NRFX_DELAY_DWT_BASED 0
/**
* @brief Macro for delaying the code execution for at least the specified time.
*
* @param us_time Number of microseconds to wait.
*/
#define NRFX_DELAY_US(us_time)
/** @brief Atomic 32-bit unsigned type. */
#define nrfx_atomic_t
/**
* @brief Macro for storing a value to an atomic object and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value to store.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_STORE(p_data, value)
/**
* @brief Macro for running a bitwise OR operation on an atomic object and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the OR operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_OR(p_data, value)
/**
* @brief Macro for running a bitwise AND operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the AND operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_AND(p_data, value)
/**
* @brief Macro for running a bitwise XOR operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the XOR operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_XOR(p_data, value)
/**
* @brief Macro for running an addition operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the ADD operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_ADD(p_data, value)
/**
* @brief Macro for running a subtraction operation on an atomic object
* and returning its previous value.
*
* @param[in] p_data Atomic memory pointer.
* @param[in] value Value of the second operand in the SUB operation.
*
* @return Previous value of the atomic object.
*/
#define NRFX_ATOMIC_FETCH_SUB(p_data, value)
/**
* @brief Macro for running compare and swap on an atomic object.
*
* Value is updated to the new value only if it previously equaled old value.
*
* @param[in,out] p_data Atomic memory pointer.
* @param[in] old_value Expected old value.
* @param[in] new_value New value.
*
* @retval true If value was updated.
* @retval false If value was not updated because location was not equal to @p old_value.
*/
#define NRFX_ATOMIC_CAS(p_data, old_value, new_value)
/**
* @brief Macro for counting leading zeros.
*
* @param[in] value A word value.
*
* @return Number of leading 0-bits in @p value, starting at the most significant bit position.
* If x is 0, the result is undefined.
*/
#define NRFX_CLZ(value)
/**
* @brief Macro for counting trailing zeros.
*
* @param[in] value A word value.
*
* @return Number of trailing 0-bits in @p value, starting at the least significant bit position.
* If x is 0, the result is undefined.
*/
#define NRFX_CTZ(value)
/**
* @brief When set to a non-zero value, this macro specifies that the
* nrfx_error_codes and the nrfx_err_t type itself are defined
* in a customized way and the default definitions from @c <nrfx_error.h>
* should not be used.
*/
#define NRFX_CUSTOM_ERROR_CODES 0
/**
* @brief When set to a non-zero value, this macro specifies that inside HALs
* the event registers are read back after clearing, on devices that
* otherwise could defer the actual register modification.
*/
#define NRFX_EVENT_READBACK_ENABLED 1
/** @brief Bitmask that defines DPPI channels that are reserved for use outside of the nrfx library. */
#define NRFX_DPPI_CHANNELS_USED 0
/** @brief Bitmask that defines DPPI groups that are reserved for use outside of the nrfx library. */
#define NRFX_DPPI_GROUPS_USED 0
/** @brief Bitmask that defines PPI channels that are reserved for use outside of the nrfx library. */
#define NRFX_PPI_CHANNELS_USED 0
/** @brief Bitmask that defines PPI groups that are reserved for use outside of the nrfx library. */
#define NRFX_PPI_GROUPS_USED 0
/** @brief Bitmask that defines GPIOTE channels that are reserved for use outside of the nrfx library. */
#define NRFX_GPIOTE_CHANNELS_USED 0
/** @brief Bitmask that defines EGU instances that are reserved for use outside of the nrfx library. */
#define NRFX_EGUS_USED 0
/** @brief Bitmask that defines TIMER instances that are reserved for use outside of the nrfx library. */
#define NRFX_TIMERS_USED 0
#ifdef __cplusplus
}
#endif
#endif /* NRFX_GLUE_H */
/** @} */