2018-06-19 14:39:59 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2019-10-24 23:08:21 +08:00
|
|
|
#include <kernel.h>
|
2018-07-18 12:25:57 +08:00
|
|
|
#include <ksched.h>
|
2019-10-24 23:08:21 +08:00
|
|
|
#include <cmsis_os.h>
|
2019-09-22 08:54:37 +08:00
|
|
|
#include <kernel_internal.h>
|
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-09-22 08:54:37 +08:00
|
|
|
return z_has_thread_started(&z_main_thread);
|
2018-07-18 12:25:57 +08:00
|
|
|
}
|