2022-03-22 03:37:21 +08:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
|
|
|
* Copyright(c) 2022 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Jyri Sarha <jyri.sarha@intel.com>
|
|
|
|
*/
|
|
|
|
|
2022-08-19 21:10:56 +08:00
|
|
|
#ifndef __XTOS_RTOS_KERNEL_H__
|
|
|
|
#define __XTOS_RTOS_KERNEL_H__
|
2022-03-22 03:37:21 +08:00
|
|
|
|
2022-09-01 05:19:35 +08:00
|
|
|
#include <rtos/wait.h>
|
2022-03-22 03:37:21 +08:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-05-12 04:19:10 +08:00
|
|
|
#ifdef __ZEPHYR__
|
|
|
|
#error "This file should only be included in XTOS builds."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef uint32_t k_ticks_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
k_ticks_t ticks;
|
|
|
|
} k_timeout_t;
|
|
|
|
|
|
|
|
#define Z_TIMEOUT_TICKS(t) ((k_timeout_t) { .ticks = (t) })
|
|
|
|
|
2022-06-03 18:20:05 +08:00
|
|
|
#define Z_TIMEOUT_US(t) ((k_timeout_t) { .ticks = clock_us_to_ticks(PLATFORM_DEFAULT_CLOCK, t) })
|
|
|
|
|
2022-05-12 04:19:10 +08:00
|
|
|
static inline void k_sleep(k_timeout_t timeout)
|
|
|
|
{
|
|
|
|
wait_delay(timeout.ticks);
|
|
|
|
}
|
|
|
|
|
2022-03-22 03:37:21 +08:00
|
|
|
static inline void k_msleep(int32_t ms)
|
|
|
|
{
|
|
|
|
wait_delay_ms(ms);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void k_usleep(int32_t us)
|
|
|
|
{
|
|
|
|
wait_delay_us(us);
|
|
|
|
}
|
|
|
|
|
2022-08-19 21:10:56 +08:00
|
|
|
#endif /* __XTOS_RTOS_KERNEL_H__ */
|