Skip to content

Commit

Permalink
lib/cmsis_rtos_v1: Implement support for osDelay
Browse files Browse the repository at this point in the history
This API is used to specify delay in ms. This is analogous
to k_sleep in the kernel.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
  • Loading branch information
rgundi authored and nashif committed Aug 13, 2018
1 parent ccd1c21 commit 2d7619e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/cmsis_rtos_v1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ add_library(CMSIS INTERFACE)
target_include_directories(CMSIS INTERFACE ${PROJECT_SOURCE_DIR}/include/cmsis_rtos_v1)

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_thread.c)
zephyr_library_sources_ifdef(
CONFIG_CMSIS_RTOS_V1
cmsis_thread.c
cmsis_wait.c
)

zephyr_library_link_libraries(CMSIS)
target_link_libraries(CMSIS INTERFACE zephyr_interface)
21 changes: 21 additions & 0 deletions lib/cmsis_rtos_v1/cmsis_wait.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <cmsis_os.h>

/**
* @brief Wait for Timeout (Time Delay in ms).
*/
osStatus osDelay(uint32_t delay_ms)
{
if (_is_in_isr()) {
return osErrorISR;
}

k_sleep(delay_ms);
return osEventTimeout;
}

0 comments on commit 2d7619e

Please sign in to comment.