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