nrf52_bsim: Add replacement for nrfx's nrfx_coredep_delay_us()

Provide a replacement for this board for the nordic HAL nrfx
nrfx_coredep_delay_us()
This function is a busy wait, which in the HAL relies on
the ARM DWT or assembler, but which in this board can just
utilize the same busy_wait mechanism provided for k_busy_wait()

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-03-08 09:39:21 +01:00 committed by Carles Cufí
parent 032b3d121d
commit 4b50281fca
2 changed files with 24 additions and 0 deletions

View file

@ -30,6 +30,7 @@ zephyr_library_sources(
time_machine.c
trace_hook.c
cmsis.c
soc/nrfx_coredep.c
)
zephyr_library_include_directories(

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <kernel_internal.h>
/*
* Replacement for the nrfx nrfx_coredep_delay_us()
* which busy waits for the given number of microseconds.
*
* This function will replace at *link* time the
* nrfx one which had been marked as weak.
*/
void nrfx_coredep_delay_us(uint32_t time_us)
{
if (time_us == 0) {
return;
}
arch_busy_wait(time_us);
}