1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 #include <ksched.h>
9 #include <cmsis_os.h>
10 #include <kernel_internal.h>
11 
12 /**
13  * @brief Get the RTOS kernel system timer counter
14  */
osKernelSysTick(void)15 uint32_t osKernelSysTick(void)
16 {
17 	return k_cycle_get_32();
18 }
19 
20 /**
21  * @brief Initialize the RTOS Kernel for creating objects.
22  */
osKernelInitialize(void)23 osStatus osKernelInitialize(void)
24 {
25 	return osOK;
26 }
27 
28 /**
29  * @brief Start the RTOS Kernel.
30  */
osKernelStart(void)31 osStatus osKernelStart(void)
32 {
33 	if (k_is_in_isr()) {
34 		return osErrorISR;
35 	}
36 	return osOK;
37 }
38 
39 /**
40  * @brief Check if the RTOS kernel is already started.
41  */
osKernelRunning(void)42 int32_t osKernelRunning(void)
43 {
44 	return z_has_thread_started(&z_main_thread);
45 }
46