2018-06-19 14:39:59 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel_structs.h>
|
|
|
|
#include <cmsis_os.h>
|
2018-07-18 12:25:57 +08:00
|
|
|
#include <ksched.h>
|
|
|
|
|
|
|
|
extern const k_tid_t _main_thread;
|
2018-06-19 14:39:59 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the RTOS kernel system timer counter
|
|
|
|
*/
|
|
|
|
uint32_t osKernelSysTick(void)
|
|
|
|
{
|
|
|
|
return k_cycle_get_32();
|
|
|
|
}
|
2018-07-18 12:25:57 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize the RTOS Kernel for creating objects.
|
|
|
|
*/
|
|
|
|
osStatus osKernelInitialize(void)
|
|
|
|
{
|
|
|
|
return osOK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Start the RTOS Kernel.
|
|
|
|
*/
|
|
|
|
osStatus osKernelStart(void)
|
|
|
|
{
|
2018-11-15 17:57:13 +08:00
|
|
|
if (k_is_in_isr()) {
|
|
|
|
return osErrorISR;
|
|
|
|
}
|
|
|
|
return osOK;
|
2018-07-18 12:25:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Check if the RTOS kernel is already started.
|
|
|
|
*/
|
|
|
|
int32_t osKernelRunning(void)
|
|
|
|
{
|
2019-03-09 05:19:05 +08:00
|
|
|
return z_has_thread_started(_main_thread);
|
2018-07-18 12:25:57 +08:00
|
|
|
}
|