1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2022 Intel Corporation. All rights reserved. 4 * 5 * Author: Jyri Sarha <jyri.sarha@intel.com> 6 */ 7 8 #ifndef __XTOS_RTOS_KERNEL_H__ 9 #define __XTOS_RTOS_KERNEL_H__ 10 11 #include <rtos/wait.h> 12 13 #include <stdint.h> 14 15 #ifdef __ZEPHYR__ 16 #error "This file should only be included in XTOS builds." 17 #endif 18 19 typedef uint32_t k_ticks_t; 20 21 typedef struct { 22 k_ticks_t ticks; 23 } k_timeout_t; 24 25 #define Z_TIMEOUT_TICKS(t) ((k_timeout_t) { .ticks = (t) }) 26 27 #define Z_TIMEOUT_US(t) ((k_timeout_t) { .ticks = clock_us_to_ticks(PLATFORM_DEFAULT_CLOCK, t) }) 28 k_sleep(k_timeout_t timeout)29static inline void k_sleep(k_timeout_t timeout) 30 { 31 wait_delay(timeout.ticks); 32 } 33 k_msleep(int32_t ms)34static inline void k_msleep(int32_t ms) 35 { 36 wait_delay_ms(ms); 37 } 38 k_usleep(int32_t us)39static inline void k_usleep(int32_t us) 40 { 41 wait_delay_us(us); 42 } 43 44 #endif /* __XTOS_RTOS_KERNEL_H__ */ 45