Commit graph

158 commits

Author SHA1 Message Date
Magdalena Pastula d3fa931dfd modules: hal_nordic: nrfx: add nRF54L15 GRTC instance
Add GRTC instance in Nordic HAL configs.

Signed-off-by: Magdalena Pastula <magdalena.pastula@nordicsemi.no>
2024-01-30 21:00:44 +00:00
Krzysztof Chruściński 4fcf8e0630 modules: hal_nordic: nrfx: Add new UARTE options to Kconfig
Add Kconfig options to new configuration flags for nrfx_uarte.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-01-18 11:12:55 +01:00
Tomasz Moń 2dee952a95 modules: hal_nordic: nrfx: update API version to 3.3.0
Update i2s nrfx driver to pass buffer size alongside buffer pointers.
No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-01-15 13:54:13 +01:00
Andrzej Kuros c4ce235973 modules: hal_nordic: remove NRF_802154_ENERGY_DETECTED_VERSION
The macro `NRF_802154_ENERGY_DETECTED_VERSION` is no longer required
because transition of nrf 802154 API is done.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2024-01-10 20:55:05 -05:00
Jakub Zymelka ade49f081d modules: hal_nordic: nrfx: update API version to 3.2.0
Updated API version enables multi-instance GPIOTE driver.
Additionally obsolete symbol that was used to specify
API version in the past was removed.
Affected drivers have been adjusted and appropriate changes
in affected files have been made.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-01-08 11:19:37 +01:00
Jakub Zymelka dfbcc8911a dts: arm: add new gpiote instances definition
Added GPIOTE0, GPIOTE1 instances for legacy devices,
GPIOTE20, GPIOTE30 for Moonlight and GPIOTE130,
GPIOTE131 instances for Haltium.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-01-08 11:19:37 +01:00
Jędrzej Ciupis 57ee911891 modules: hal_nordic: new nrf_802154 configuration option
This commit adds a new Kconfig for the nRF 802.15.4 radio driver that
allows the user to specify the number of encryption keys the driver can
simultaneously store.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2024-01-03 10:18:56 +01:00
Jędrzej Ciupis 054353a75d modules: hal_nordic: reorganize nrf_802154 Kconfig
There are multiple Kconfig symbols that are only available when the
radio hardware is present. As a result, the nRF 802.15.4 radio driver
is more difficult to configure on multicore architectures. Also, such
solution goes against the principle of hiding the details of the
platform behind the driver's interface.

This commit moves all the Kconfig options that correspond to settings
present in common nRF 802.15.4 configuration header so that they're
available no matter if the API is serialized.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2024-01-03 10:18:56 +01:00
Adam Wojasinski a7a6b5654a modules: hal_nordic: Add possibility to specify own source of the nrfx
Introduce possibility to override `NRFX_DIR` sybol from hal_nordic's
CMakeLists.txt file that specifies source dir for the nrfx drivers.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-12-15 11:41:02 +00:00
Jędrzej Ciupis 00f7c0e445 modules: hal_nordic: nrf_802154: remove magic number
This commit replaces a magic number in the definition of serialization
ring buffer length with a macro provided by the 802.15.4 driver.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-12-13 13:57:24 +01:00
Andrzej Kuros f5337fc7a3 modules: hal_nordic: nRF 802.15.4 customizable asserts
Recent nRF 802.15.4 Radio Driver provides assert abstraction layer.
The assert abstraction layer is implemented in Zephyr in following
ways depending on the `NRF_802154_ASSERT_CHOICE` Kconfig choice.

`NRF_802154_ASSERT_ZEPHYR_MINIMAL` (default) gives ability to still
perform run-time checking of the nRF 802.15.4 Radio Driver operation
with minimum memory overhead and configurable behavior on fault
detection regardless of the `CONFIG_ASSERT` Kconfig option value.

`NRF_802154_ASSERT_ZEPHYR` gives ability to use asserts provided and
configurable by Zephyr including the ability to turn off the run-time
checking of the nRF 802.15.4 Radio Driver operation.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-12-11 10:50:27 +01:00
Adam Wojasinski 38739368dd modules: hal_nordic: watchdog: Add Kconfig symbols for new WDT instances
This commit is a part of introduction of new WTD instances.
It adds new Kconfig symbols that can be used in WDT shim and
nrfx driver.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-29 13:12:42 +01:00
Jędrzej Ciupis 29d027a47b modules: hal_nordic: nrf_802154: lengthen serialization ring buffer
This commit increases the length of ring buffer that holds serialized
nRF 802.15.4 API calls so that it can simultaneously store all
notifications the driver is capable of issuing. Currently that's not the
case, which creates a possibility of the serialization buffers running
out while the driver is issuing notifications.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-11-29 10:09:05 +01:00
Marek Pieta 00d8263a93 soc: arm: nrf52: Configurable EGU instance for anomaly 109 workaround
Change makes EGU instance used for anomaly 109 workaround configurable.
The default EGU instance (5) may be used for other purpose.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2023-11-28 14:23:49 +00:00
Adam Wojasinski cac170d2b9 modules: hal_nordic: Add I2S Kconfig symbols and translation to nrfx
Add Kconfig symbols for I2S 20 instance and translation symbols
used in nrfx drivers.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-20 09:24:05 +01:00
Natalia Pluta f5658254e8 modules: hal_nordic: Add QDEC Kconfig symbols and translation to nrfx
Add Kconfig symbols for QDEC instances (20, 21, 130, 131) and
translation symbols used in nrfx drivers.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-11-20 09:19:45 +01:00
Patryk Lipinski 14827aad65 modules: hal_nordic: nrfx_glue: Changes in the macro statements
Changes in the macro statements that allows to build
with -Wudef flag enebaled, without errors.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
2023-11-15 09:59:56 +01:00
Tomasz Moń 8db6919695 nrfx_usbd: Rename to nrf_usbd_common
Rename local usbd copy from nrfx_usbd to nrf_usbd_common and use it in
both USB stacks. Renaming header to nrf_usbd_common.h allows breaking
changes in exposed interface. Mark all doxygen comments as internal
because local usbd copy should not be treated as public interface
because we are under refactoring process that aims to arrive at native
driver and therefore drop nrf_usbd_common in the future.

Use Zephyr constructs directly instead of nrfx glue macros.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 2010d4d599 nrfx_usbd: Copy nrfx usbd code to Zephyr
Copy nrfx_usbd code from zephyrproject-rtos/hal_nordic git revision
d054a315eb888ba70e09e5f6decd4097b0276d1f. This enables us to refactor
the code towards a native driver in a step by step manner where the
smallest changes that bring biggest performance improvements are done
early on.

The code is not a vanilla copy from zephyrproject-rtos/hal_nordic.
The code was reformated with clang-format to match project style.
Manual modifications were done to change comments formatting, place
constant comparisons on the right and add blank lines to pass Zephyr
compliance check.

Relicense to Apache 2.0.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Nikodem Kastelik 70db8cd12a modules: hal_nordic: nrfx: enable NRFX_GPIOTE1 for non-secure builds
Now it is needed to explicitly use NRF_GPIOTE1 instance
in nrfx_gpiote driver for non-secure builds.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2023-10-24 11:13:53 +02:00
Adam Wojasinski 5685af0923 modules: hal_nordic: Add support for new TWIM instances
Add Kconfig and symbols for twim: 20-22, 30, 121, 130-137 instances

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:04:10 +02:00
Adam Wojasinski 5c1daef5ab drivers: spi: nrfx: Add SPIM Kconfig symbols for new instances
Add support for upcomming SPIM instances.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:03:17 +02:00
Andrzej Głąbek 5e38471e71 modules: hal_nordic: cmake: Fix checking if uicr DT node is accessible
According to cmake documentation, in the `if(<string>)` expression
the string evaluates to false unless its value is one of the true
constants. Thus, the commands under `if(${uicr_path})` are never
executed. Use `if(DEFINED uicr_path)` instead, since `uicr_path`
is returned by `dt_nodelabel()` and it will be undefined if such
node does not exist.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-10-13 21:23:17 +03:00
Alberto Escolar Piedras 6afe7cf216 hal nordic: cmake: Add support for nrf53_bsim boards
Also set the HAL variant appropriately when building for
the new nrf53_bsim boards.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-20 08:56:49 +02:00
Gerard Marull-Paretas 4d7d5ce226 modules: hal_nordic: nrfx: add support for 'gpio-as-nreset'
So that the HAL's system init function configures the reset GPIO as
nRESET if requested by the user.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-18 13:14:08 +02:00
Gerard Marull-Paretas e43c2f3eb5 modules: hal_nordic: inject CONFIG_NFCT_PINS_AS_GPIOS
If the users configures this option in devicetree, ie,

```
&uicr {
    nfct-pins-as-gpios;
};
```

CMake will inject the HAL-specific CONFIG_NFCT_PINS_AS_GPIOS definition,
so that the necessary operations are performed during system init.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:05:28 +02:00
Jordan Yates 1e06ba2328 soc: arm: nordic: handle nRF52832 anomaly 109
Enable workaround for anomaly 109 by default when affected peripherals
are enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-13 12:05:27 +02:00
Gerard Marull-Paretas 432609ec8e modules: hal_nordic: nrf_802154: add missing init.h
File was using SYS_INIT without including init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 16:13:08 +01:00
Alberto Escolar Piedras 65cd717152 modules: hal_nordic: Make module directory avaliable to others
Make the nrfx module directory avaliable to other
cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-24 15:40:00 +02:00
Jędrzej Ciupis a41475507a modules: hal_nordic: remove 802.15.4 gpiote platform
This commit removes deprecated GPIOTE platform abstraction for nRF IEEE
802.15.4 radio driver.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-08-22 11:39:33 +02:00
Andrzej Kuros 04d3dcb116 drivers: ieee802154_nrf5: energy_detected api change adjust
The prototype of `nrf_802154_energy_detected` callout has changed.
This commit adjusts to this change.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-08-20 19:31:21 +02:00
Natalia Pluta 76bb1d7453 modules: hal_nordic: Add nrfx specific drivers logging Kconfig
This commit introduces Kconfig symbols for enabling logging
for each nrfx drivers in Zephyr.

Example Usage:
To enable logging for the NRFX ADC driver, add the following
line to the project's configuration file (prj.conf):
CONFIG_NRFX_ADC_LOG=y

The purpose of this change is to enable selective logging
in Zephyr for specific nrfx drivers.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-08-08 12:34:19 +00:00
Natalia Pluta 764466a6da modules: hal_nordic: nrfx: Add zephyr to nrfx logging symbols mapping
A Kconfig symbol mapping is necessary to enable logging for specific
nrfx drivers in Zephyr, allowing the association of these symbols with
their corresponding nrfx-specific symbols.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-08-08 12:34:19 +00:00
Tomasz Moń 440af3ecc8 modules: hal_nordic: nrfx: Make ISO IN ZLP configurable
nRF USBD ISOINCONFIG register controls USBD behavior after receiving IN
token addressed to ISO IN endpoint when the endpoint was not armed with
data. The options are:
  * NoResp, in which case there is no response (i.e. bus timeout)
  * ZeroData, in which case device responds with ZLP

This commit both makes the ISOINCONFIG value configurable and changes
the default from NoResp to ZeroData. For reference, DWC_otg controller
will always send ZLP in such case and does not have NoResp equivalent.

Automatically sending ZLP when ISO IN endpoint is not armed resolves
periodic audio dropouts observed on Mac OS with USB Audio headset
sample. Apple USB Audio class driver will attempt recovery (abort all
pending URBs, switch to alternate config 0, switch to active alternate
config and submit new URBs) every time it sees kIOReturnNotResponding
status code. During recovery no audio data can be transferred and
therefore there are gaps in the audio stream.

Apple USB Audio driver sees kIOReturnNotResponding when there is bus
timeout (i.e. IN token was sent to nRF when the endpoint was not armed
and NoResp option was active). Activating ZeroData option results in
perfectly fine (albeit short) packet that does not trigger interface
recovery and thus fixes the USB Audio issues on Mac OS.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-07-14 09:37:04 +02:00
Adam Wojasinski 9aeb497321 modules: hal_nordic: nrfx_config: Align to updates in nrfx 3.1.0
Align config files to templates introduced with nrfx 3.1.0 release

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-07-13 13:21:41 +02:00
Jamie McCrae ac95e57bbe modules: hal_nordic: nrf_802154: Make paths relative
Makes the files listed in the cmake file relative as they do not
need to be absolute paths.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-06-30 16:07:05 +02:00
Adam Wojasinski 09fa46ee4e drivers: sensor: qdec_nrfx: Add multi-instance support for QDEC SHIM
Reworked QDEC SHIM to suppor multi-instance peripheral. Patch includes
Kconfig alignment for proper instance handling.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski e3b3d0eea4 modules: hal_nordic: CMakeLists: Add source files for GPPI helper
nrfx 3.0.0 splits implementation of GPPI helper functions into
periph-specific source files.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 39b32a4f68 modules: hal_nordic: nrfx_glue: Add cache auxiliary macros
Add cache auxiliary macros needed nrfy layer in nrfx drivers SW stack.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 1535e0f8ad modules: hal_nordic: nrfx_config: Update nrfx_config files to nrfx 3.0
Update config files to recently released with new nrfx 3.0

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Andrzej Głąbek 7a54aed015 modules: hal_nordic: nrfx: Handle properly I2S0 instance
Although existing nRF SoCs have only one I2S instance, the nrfx_i2s
driver has now multi-instance API and the related nrfx configuration
symbols need to be used appropriately.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Andrzej Głąbek 2a4373ce0d soc: nordic_nrf: nrf91: Add support for nRF9161 SiP / nRF9120 SoC
The nRF9161 is technically a SiP (System-in-Package) that consists of
the nRF9120 SoC and additional components like PMIC, FEM, and XTAL,
so for nrfx/MDK the nRF9120 SoC is to be selected as the build target,
but since the nRF9161 is what a user can actually see on a board, using
only nRF9120 in the Zephyr build infrastructure might be confusing.
That's why in the top level of SoC definitions (for user-configurable
options in Kconfig, for example) the nRF9161 term is used and nRF9120
underneath.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-17 09:30:12 -07:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Nikodem Kastelik 6bd52d553f modules: hal_nordic: nrfx: add NRF9120_XXAA support in nrfx_config
There is a single config file for nRF9120 and nRF9160.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2023-04-11 14:39:59 +02:00
Francois Gervais ada6881d47 modules: hal_nordic: check if gpio1 is enabled
The build will fail if `gpio1` is disabled in an overlay.

For example:
```
&gpio1 {
	status = "disabled";
};
```

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2023-03-21 09:39:02 +01:00
Krzysztof Chruscinski 369ffb4929 hal_nordic: Add protection against resource conflict (take 2)
Commit will be squeezed once agreement is reached.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:59:40 +01:00
Krzysztof Chruscinski 5af49c1e35 hal_nordic: Add protection against resource conflict
Add check in CMake files to prevent resource overlap for
TIMER0, TIMER1, RTC0.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:59:40 +01:00
Krzysztof Chruscinski 9a73b9c80d hal_nordic: Change scheme for RTC and TIMER reservation
In general, RTC and TIMER driver implements counter API but there
are exception when those peripherals are used in a custom way
(e.g. for system timer or bluetooth). In that case, system must
prevent using counter based on a reserved instance. Previously,
it was managed by Kconfig options but that cannot be maintained
when switching to devicetree configuration of the counter driver.

A new approach removes Kconfig options and instead adds static
asserts in the files which are using direct peripherals. Those
asserts check if given node is not enabled in the device tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:59:40 +01:00
Artur Hadasz 5ec29589c4 modules: hal_nordic: 802.15.4 carrier functions made optional
Added an option to disable and enable the continuous and optional
carrier functions in the nordic 802.15.4 driver.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2023-02-22 16:46:15 +01:00
Alberto Escolar Piedras 8a5273525e nrf52_bsim: Convert from a nRF52832 to a nRF52833
The nRF HW models have been updated to correspond to a 52833 instead
of a 52832. Let's follow them.

The motivation for the change is to enable proper BIS encryption support
(for BT LE Audio ISO).

Changes:

* Point in manifest to latest HW models

* SOC_COMPATIBLE_NRF52832 has been removed, and SOC_COMPATIBLE_NRF52833
added in its place (with no uses at this point)

* Where SOC_COMPATIBLE_NRF52832 was used to set encryption like for a 52832
(to avoid using the MAXPACKETLENGHT), we set the condition to just
SOC_NRF52832.
Note: The MAXPACKETLENGHT register exists in the new simulated nrf52833,
thought it does nothing.

* In the BLE ctrl LLL radio HAL, all macros are renamed accordingly
(timings are NOT changed).

* Board dts definition now refers to the 52833 soc definition. New 52833
features set as not supported by now.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-26 09:29:18 +01:00
Artur Hadasz 4400540d15 modules: hal_nordic: nrf_802154: RNG xor-shift algorithm
The LCG method used earlier in the random number generator was problematic,
as the lowest bits repeated periodically (for example, the generated number
always resulted in an odd-even-odd-even-.. sequence, or the last three bits
formed an cycle of the length 8). This is because the LCG was done module
2^32. Any LCG using a power of 2 as the modulus will cause the same issue.
The used RNG method was changed to Marsaglia's xor shift-algorithm,
which does not have this issue.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2023-01-04 11:44:07 +00:00
Reto Schneider cb7791baf1 soc: nrf52: Kconfig option for nRF52840 anomaly 198
Enabling by default (if SPI3 used) because it affects all revisions
since "Engineering B", including the most recent one as of today
(revision 3).

Size changes when enabled:
 - -Og: flash +160 bytes (+0.02%), RAM +8 bytes (+0.01%)
 - -Os: flash +144 bytes (+0.02%), no change to RAM usage

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-12-27 15:32:22 +01:00
Nikodem Kastelik 67718641bf modules: hal_nordic: nrfx: switch to 2.10 API
Switch to use newest 2.10 API version in nrfx by default.
It changes signature of user callback in the nrfx_ipc driver.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2022-11-08 10:48:38 +01:00
Rafał Kuźnia fe4ed1b871 boards: nrf5340dk_nrf5340: Add chosen node for nrf-802154 spinel
Currently, the nrf-802154-spinel IPC service requires that the IPC
service node has a specific name (ipc0). This makes it impossible to
overwrite the IPC service node to be used by the Spinel serialization
without completely redefining the ipc0 node. Create a `chosen` property
called nordic,802154-spinel-ipc that can be reassigned with any IPC
service node.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-11-05 19:57:25 +01:00
Adam Wojasinski f762aa9aa2 modules: hal_nordic: Add API version symbol to nrfx_config.h
This commit adds API version symbols. The symbol is used in nrfx
drivers, where new API-breaking changes are introduced. Symbol
guards conflicting API.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-11-03 11:39:01 +01:00
Artur Hadasz 2314d971e7 modules: hal_nordic: nrf_802154 serialization race condition fix
Fixed a race condition resulting in a serialization error.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-09-19 10:31:50 +00:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas e0125d04af devices: constify statically initialized device pointers
It is frequent to find variable definitions like this:

```c
static const struct device *dev = DEVICE_DT_GET(...)
```

That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Kumar Gala 5fa1909141 modules: hal_nordic: Remove Kconfig.dt
Remove modules/hal_nordic/Kconfig.dt as we now autogenerate the
contents of this file based on the dts bindings in tree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-17 08:06:55 +00:00
Gerard Marull-Paretas 2cfb5012db drivers: spi: nrfx_spim: move rx delay to DT
Move the RX (MISO) delaying capability information to Devicetree. It is
done using 2 properties:

- rx-delay-supported: enabled on SPI nodes that support delaying RX.
  This property can be used by the driver to determine if this
  capability is supported or not on a given instance.
- rx-delay: the actual RX delay value

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Kumar Gala b296abd605 modules: hal_nordic: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET_ONE instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 10:18:24 +02:00
Filip Zajdel fb8c86c59a modules: hal_nordic: Don't get DT Node when temp update is disabled
Avoid getting DT Node of temperature sensor when temperature update
is disabled.

Signed-off-by: Filip Zajdel <filip.zajdel@nordicsemi.no>
2022-06-29 10:26:36 +02:00
Andrzej Głąbek c08442c85a modules: hal_nordic: Adapt nrfx_busy_wait() for !SYS_CLOCK_EXISTS case
When the SYS_CLOCK_EXISTS Kconfig option is not enabled, k_busy_wait()
has no implementation, so in such case, call nrfx_coredep_delay_us()
directly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-15 17:04:30 -05:00
Gerard Marull-Paretas 5f5a905784 modules: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all modules code to the
new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:57:47 +02:00
Andrzej Głąbek 451a6ed6ab modules: hal_nordic: Refactor nrfx related Kconfig options
Change dependencies of the Kconfig options that enable particular nrfx
drivers so that the drivers and their instances are available when
a devicetree node with a corresponding compatible property exists,
no matter if it is enabled or not.
Change the options that enable compilation of multi-instance drivers
to be promptless helpers only (not directly configurable for users),
as they need to be enabled only together with some options that enable
particular instances of a given driver, and those options select them
as needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Emil Obalski d877e1dded ipc_service: Automatically include source files for backends
The purpose of this change is to allow to enable more than one
backend at once by removing choice from ipc-service backend Kconfig
and depending backend Kconfig option on existing of correct compatible.

Overwriting IPC_SERVICE_BACKEND option in some places is removes
as no longer needed.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2022-03-29 12:30:50 -07:00
Artur Hadasz 9f5c159c7c modules: hal_nordic: fixed wrong 802.15.4 NET core init level
The intialization level of 802.15.4 on NET core was set to APPLICATION,
which caused some applications to break during initialization. Changed
it to POST_KERNEL. CONFIG_NRF_802154_SER_RADIO_INIT_PRIO default value
was adjusted.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-03-22 12:29:01 +01:00
Andrzej Głąbek 222d42c22a modules: hal_nordic: Improve reservation of resources for BT_CTLR
Instead of including from nrfx_glue.h a specific Zephyr Bluetooth
controller header file that defines PPI and GPIOTE resources to be
reserved for exclusive use by the controller, include a file with
only a fixed name and expect the chosen Bluetooth controller to
provide the location of this file in include paths. This way, when
a different Bluetooth controller implementation is used downstream,
a different file can be easily pointed to.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 14:59:35 +01:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Gerard Marull-Paretas b2001388b7 modules: hal_nordic: obtain entropy device using DEVICE_DT_GET
The entropy device can be obtained at compile time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-11 15:27:05 -08:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Rafał Kuźnia a8dd5bfe3a modules: hal_nordic: Select RPMSG backend by default
The nrf_802154 module should use the IPC_SERVICE_BACKEND_RPMSG
backend by default.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-03-07 10:55:16 +01:00
Artur Hadasz 5451c8b70f modules: hal_nordic: 802.15.4 make possible to disable CSMA-CA
Currently if an attempt to disable CSMA-CA in by setting an
appropriate flag in another (for example application)
CmakeLists.txt it caused lots of warnings. This fix allows
higher level CMakeLists.txt to disable CSMA-CA without
warnings.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-03-07 10:51:21 +01:00
Kamil Piszczek 3e5812cc5f modules: hal_nordic: Port nrf_802154 to ipc_service
The nrf_802154 Spinel serialization was ported to multi-instance
ipc_service.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-03-02 17:03:01 +01:00
Rafał Kuźnia 4635c0866f modules: hal_nordic: Remove nrf_802154_lp_timer platform
The nrf_802154_lp_timer_zephyr.c platform file is unused in the
opensource SL library variant.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-02-24 14:05:09 -08:00
Andrzej Kuros 7ce93ebfed modules: hal_nordic: nrf_802154_irq ZLI support
Parameter `prio` of `nrf_802154_irq_init` is now allowed to have
negative value what means use of ZLI priority or highest possible
priority if ZLIs are disabled.

Signed-off-by: Andrzej Kuros <andrzej.kuros@nordicsemi.no>
2022-02-23 11:18:17 +01:00
Paweł Kwiek 2c387c6a50 modules: hal_nordic: align & extend lp_timer platform
This commit aligns nrf_802154_lp_timer_zephyr platform to new API of
nrf_rtc_timer. Moreover, it implements lp_timer synchronization
functions using the new nrf_rtc_timer API.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2022-01-04 17:44:32 +01:00
Krzysztof Chruscinski 3457ebc667 modules: hal_nordic: Add NRFX_GPIOTE_NUM_OF_EVT_HANDLERS option
Add option to specifiy number of nrfx_gpiote user handlers in Kconfig.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-04 09:50:02 +01:00
Carles Cufi c7ec3db5e5 Revert "modules: hal_nordic: align & extend lp_timer platform"
This reverts commit 9cdd8cd168.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 21:04:26 +01:00
Paweł Kwiek 9cdd8cd168 modules: hal_nordic: align & extend lp_timer platform
This commit aligns nrf_802154_lp_timer_zephyr platform to new API of
nrf_rtc_timer. Moreover, it implements lp_timer synchronization
functions using the new nrf_rtc_timer API.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-20 16:25:49 +01:00
Paweł Kwiek f3fea0e6f1 modules: hal_nordic: Add CCA macros when nRF Radio Driver is enabled
This patch restricts access of CCA configuration related macros to
builds for which nRF 802.15.4 Radio Driver is enabled. This reduces
clutter and prevents misuse of CCA macros.

Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-16 10:12:36 +01:00
Krzysztof Chruscinski 5ef63d8313 Bluetooth: Controller: nordic: Rework hw resources files
Move all defines that specifies (D)PPI resources which are used
to dedicated files which have no include dependencies. This allow
to use them in nrfx_glue.h to specify fixed (D)PPI channels used
by the bluetooth.

Additionally, added mask with GPIOTE channels used by the bluetooth
controller. It was previously not defined which could lead to
conflicts since same channels could be allocated by the nrfx_gpiote
user

Updated nrfx_glue.h to use new approach.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Krzysztof Chruscinski 1345b2ddd4 modules: hal_nordic: nrfx: Set NRF_SKIP_FICR_NS_COPY_TO_RAM
Set NRF_SKIP_FICR_NS_COPY_TO_RAM for nrf53 and nrf91 until corresponding
memory region is excluded from use.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Krzysztof Chruscinski 7e0f1d08e4 modules: hal_nordic: Update nrfx to version 2.6.0
Update the hal_nordic module revision, to switch to nrfx v2.6.0.

nrfx 2.6.0 includes extended API in nrfx_gpiote which can be
used by the zephyr shim.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Krzysztof Chruscinski 9886bdc0c8 drivers: pwm: pwm_nrf5_sw: Use runtime resources allocation
Use nrfx_gpiote and nrfx_ppi allocators to allocate channels
at runtime instead of fixed, device-tree based allocation which
is harder to maintain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-26 09:31:54 +01:00
Gregers Gram Rygg d47bd60933 soc: nordic_nrf: Add Kconfig option for enabling trace port
Add Kconfig option to enable the hardware trace port in the SystemInit()
function.

Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
2021-09-28 20:11:40 -04:00
Joakim Andersson fb90113dc8 modules: hal_nordic: Add nrf51 MDK defines needed to apply nrf51 erratas
Add nrf51 MDK defines needed to correctly select the nrf51 erratas
needed on the specific SoCs. The nrf51_erratas.h header file only uses
these defines to check which erratas should be applied.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-30 15:48:19 +02:00
Andrzej Głąbek 72e3bfe1c0 soc: nordic_nrf: Add Kconfig options for APPROTECT handling
Add Kconfig options that allow users to select the way the APPROTECT
mechanism is handled in the SystemInit() function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-24 07:27:12 -04:00
Paweł Kwiek da8f9d77c4 modules: hal_nordic: Increase number of serialization buffers
This commit increases number of available serialization buffers to
account for possible delays caused by serialization itself and
processing on the application core.

Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-08-11 11:47:10 +02:00
Paweł Kwiek b7bd1be622 hal_nordic: Rework nRF IEEE 802.15.4 temperature update module
This commit reworks nRF IEEE 802.15.4 temperature update module to save
resources, otherwise used to create thread, by using work queue.

Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-08-09 17:52:58 +02:00
Przemyslaw Bida 082efb4e9d hal_nordic: Adjust temperature sensor stack size.
This commit extends size of stack used by IEEE 802.15.4 radio
temperature sensor. This commit fixes stack overflow issue in
echo_server sample for OpenThread.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2021-07-31 14:57:19 -04:00
Pawel Kwiek b2487e3c88 manifest: Update hal_nordic
This commit adds temperature platform used by the IEEE 802.15.4 Radio
Driver. The new platform requires an enabled temperature sensor.
The new hal_nordic revision updates the nRF 802.15.4 component.

Signed-off-by: Pawel Kwiek <pawel.kwiek@nordicsemi.no>
2021-07-23 15:54:59 -04:00
Lukasz Maciejonczyk 4185e8e515 modules: hal_nordic: add Kconfig option for frame auth and encryption
New option enables/disables frame encryption module, security writer
module and IE writer module.

The new hal_nordic revision updates the nRF 802.15.4 component.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-22 08:22:02 -04:00
Aurelien Jarno cbb2a9be77 logging: Enable SWO support for nRF SOCs
The nRF SOCs declare support for SWO using the HAS_SWO define. In
addition, the SWO pin has to be configured at runtime, which is done
through the Nordic HAL by defining ENABLE_SWO.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-05-18 12:28:25 -05:00
Jedrzej Ciupis 0a75e0551f modules: hal_nordic: nrf_802154: Fix RADIO IRQ handling configuration
This commit fixes nRF 802.15.4 radio driver IRQ management
configuration.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-04-07 14:17:22 +02:00
Rafał Kuźnia 9638876bde modules: hal_nordic: change the SL type prompt
The SL type choice option prompt was renamed to be short and concise.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-04-01 14:08:08 +02:00
Rafał Kuźnia 859952f590 modules: hal_nordic: add new nrf-802154 glue cmake
Update revision of hal_nordic which introduces new radio driver
integration scheme.

The glue cmake has been updated to use the new integration scheme
for the nrf-802154 component.

Added config option to exclude radio driver in hal_nordic from the
build process. This allows the radio driver to be supplied from
other sources.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-04-01 14:08:08 +02:00
Rafał Kuźnia 88b1d1f047 modules: hal_nordic: Remove default from SL type choice
The default value is not needed because there is only one choice.
This allows the default choice to be set in a different module.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-04-01 14:08:08 +02:00
Krzysztof Chruscinski ab49673bc8 drivers: timer: nrf_rtc_timer: Change type of channel argument
There was an inconsistency in the API as z_nrf_rtc_timer_chan_alloc
returned int but other function were using uint32_t for channel
argument. Updated api to use int32_t everywhere.

Update nrf_802154 driver which was using this api to use int32_t.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-25 15:54:49 +01:00