Mistake on this page?
Report an issue in GitHub or email us
Kernel.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-2019 ARM Limited
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20  * SOFTWARE.
21  */
22 #ifndef KERNEL_H
23 #define KERNEL_H
24 
25 #include <stdint.h>
26 #include "rtos/mbed_rtos_types.h"
27 
28 namespace rtos {
29 /** \addtogroup rtos-public-api */
30 /** @{*/
31 
32 /** Functions in the Kernel namespace control RTOS kernel information. */
33 namespace Kernel {
34 
35 /** Read the current RTOS kernel millisecond tick count.
36  The tick count corresponds to the tick count the RTOS uses for timing
37  purposes. It increments monotonically from 0 at boot, so it effectively
38  never wraps. If the underlying RTOS only provides a 32-bit tick count,
39  this method expands it to 64 bits.
40  @return RTOS kernel current tick count
41  @note Mbed OS always uses millisecond RTOS ticks, and this could only wrap
42  after half a billion years.
43  @note You cannot call this function from ISR context.
44  */
45 uint64_t get_ms_count();
46 
47 /** Attach a function to be called by the RTOS idle task.
48  @param fptr pointer to the function to be called
49 
50  @note You may call this function from ISR context.
51 */
52 void attach_idle_hook(void (*fptr)(void));
53 
54 /** Attach a function to be called when a thread terminates.
55  @param fptr pointer to the function to be called
56 
57  @note You may call this function from ISR context.
58 */
59 void attach_thread_terminate_hook(void (*fptr)(osThreadId_t id));
60 
61 } // namespace Kernel
62 
63 /** @}*/
64 
65 } // namespace rtos
66 #endif
void attach_idle_hook(void(*fptr)(void))
Attach a function to be called by the RTOS idle task.
uint64_t get_ms_count()
Read the current RTOS kernel millisecond tick count.
void attach_thread_terminate_hook(void(*fptr)(osThreadId_t id))
Attach a function to be called when a thread terminates.
Definition: TaskBase.h:25
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.