mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-18 06:21:57 +00:00
git grep -l 'u\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g" git grep -l 's\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g" Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
30 lines
741 B
C
30 lines
741 B
C
/*
|
|
* Copyright (c) 2017 Oticon A/S
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include "zephyr/types.h"
|
|
#include "fake_timer.h"
|
|
#include "time_machine.h"
|
|
#include <arch/posix/posix_soc_if.h>
|
|
|
|
#if defined(CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT)
|
|
/**
|
|
* Replacement to the kernel k_busy_wait()
|
|
* Will block this thread (and therefore the whole zephyr) during usec_to_wait
|
|
*
|
|
* Note that interrupts may be received in the meanwhile and that therefore this
|
|
* thread may lose context
|
|
*/
|
|
void arch_busy_wait(uint32_t usec_to_wait)
|
|
{
|
|
bs_time_t time_end = tm_get_hw_time() + usec_to_wait;
|
|
|
|
while (tm_get_hw_time() < time_end) {
|
|
/*There may be wakes due to other interrupts*/
|
|
fake_timer_wake_in_time(time_end);
|
|
posix_halt_cpu();
|
|
}
|
|
}
|
|
#endif
|