Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_thread.h Source File

mbed_thread.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef MBED_THREAD_H
00018 #define MBED_THREAD_H
00019 #include <stdint.h>
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /**
00026  * \defgroup mbed_thread Mbed Thread
00027  * \ingroup platform-public-api
00028  * @{
00029  */
00030 
00031 /** Generic thread functions.
00032  *
00033  * These are C versions of functions provided in C++ via rtos::Thread and rtos::ThisThread
00034  */
00035 
00036 /** Read the current RTOS kernel millisecond tick count.
00037      The tick count corresponds to the tick count the RTOS uses for timing
00038      purposes. It increments monotonically from 0 at boot, so it effectively
00039      never wraps. If the underlying RTOS only provides a 32-bit tick count,
00040      this method expands it to 64 bits.
00041      @return  RTOS kernel current tick count
00042      @note Mbed OS always uses millisecond RTOS ticks, and this could only wrap
00043            after half a billion years.
00044      @note In a non-RTOS build, this computes an equivalent time in milliseconds,
00045            based on a HAL timer. The time may be referenced as 0 on first call.
00046      @note You cannot call this function from ISR context.
00047     @note The equivalent functionality is accessible in C++ via rtos::Kernel::get_ms_count.
00048  */
00049 uint64_t get_ms_count(void);
00050 
00051 /** Sleep for a specified time period in millisec:
00052   @param   millisec  time delay value
00053   @note You cannot call this function from ISR context.
00054   @note The equivalent functionality is accessible in C++ via rtos::ThisThread::sleep_for.
00055 */
00056 void thread_sleep_for(uint32_t millisec);
00057 
00058 /** Sleep until a specified time in millisec
00059   The specified time is according to Kernel::get_ms_count().
00060   @param   millisec absolute time in millisec
00061   @note You cannot call this function from ISR context.
00062   @note if millisec is equal to or lower than the current tick count, this
00063         returns immediately.
00064   @note The equivalent functionality is accessible in C++ via ThisThread::sleep_until.
00065 */
00066 void thread_sleep_until(uint64_t millisec);
00067 
00068 /** @}*/
00069 
00070 #ifdef __cplusplus
00071 }
00072 #endif
00073 
00074 
00075 #endif //MBED_THREAD_H