Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/rtos/Kernel.h@9:d58e77ebd769, 2018-03-02 (annotated)
- Committer:
- Nathan Yonkee
- Date:
- Fri Mar 02 07:12:37 2018 -0700
- Revision:
- 9:d58e77ebd769
add mbed-os library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Nathan Yonkee |
9:d58e77ebd769 | 1 | /* mbed Microcontroller Library |
| Nathan Yonkee |
9:d58e77ebd769 | 2 | * Copyright (c) 2017 ARM Limited |
| Nathan Yonkee |
9:d58e77ebd769 | 3 | * |
| Nathan Yonkee |
9:d58e77ebd769 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| Nathan Yonkee |
9:d58e77ebd769 | 5 | * of this software and associated documentation files (the "Software"), to deal |
| Nathan Yonkee |
9:d58e77ebd769 | 6 | * in the Software without restriction, including without limitation the rights |
| Nathan Yonkee |
9:d58e77ebd769 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| Nathan Yonkee |
9:d58e77ebd769 | 8 | * copies of the Software, and to permit persons to whom the Software is |
| Nathan Yonkee |
9:d58e77ebd769 | 9 | * furnished to do so, subject to the following conditions: |
| Nathan Yonkee |
9:d58e77ebd769 | 10 | * |
| Nathan Yonkee |
9:d58e77ebd769 | 11 | * The above copyright notice and this permission notice shall be included in |
| Nathan Yonkee |
9:d58e77ebd769 | 12 | * all copies or substantial portions of the Software. |
| Nathan Yonkee |
9:d58e77ebd769 | 13 | * |
| Nathan Yonkee |
9:d58e77ebd769 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| Nathan Yonkee |
9:d58e77ebd769 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| Nathan Yonkee |
9:d58e77ebd769 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| Nathan Yonkee |
9:d58e77ebd769 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| Nathan Yonkee |
9:d58e77ebd769 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| Nathan Yonkee |
9:d58e77ebd769 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| Nathan Yonkee |
9:d58e77ebd769 | 20 | * SOFTWARE. |
| Nathan Yonkee |
9:d58e77ebd769 | 21 | */ |
| Nathan Yonkee |
9:d58e77ebd769 | 22 | #ifndef KERNEL_H |
| Nathan Yonkee |
9:d58e77ebd769 | 23 | #define KERNEL_H |
| Nathan Yonkee |
9:d58e77ebd769 | 24 | |
| Nathan Yonkee |
9:d58e77ebd769 | 25 | #include <stdint.h> |
| Nathan Yonkee |
9:d58e77ebd769 | 26 | |
| Nathan Yonkee |
9:d58e77ebd769 | 27 | namespace rtos { |
| Nathan Yonkee |
9:d58e77ebd769 | 28 | /** \addtogroup rtos */ |
| Nathan Yonkee |
9:d58e77ebd769 | 29 | /** @{*/ |
| Nathan Yonkee |
9:d58e77ebd769 | 30 | |
| Nathan Yonkee |
9:d58e77ebd769 | 31 | /** Functions in the Kernel namespace control RTOS kernel information. */ |
| Nathan Yonkee |
9:d58e77ebd769 | 32 | namespace Kernel { |
| Nathan Yonkee |
9:d58e77ebd769 | 33 | |
| Nathan Yonkee |
9:d58e77ebd769 | 34 | /** Read the current RTOS kernel millisecond tick count. |
| Nathan Yonkee |
9:d58e77ebd769 | 35 | The tick count corresponds to the tick count used by the RTOS for timing |
| Nathan Yonkee |
9:d58e77ebd769 | 36 | purposes. It increments monotonically from 0 at boot, hence effectively |
| Nathan Yonkee |
9:d58e77ebd769 | 37 | never wraps. If the underlying RTOS only provides a 32-bit tick count, |
| Nathan Yonkee |
9:d58e77ebd769 | 38 | this method expands it to 64 bits. |
| Nathan Yonkee |
9:d58e77ebd769 | 39 | @return RTOS kernel current tick count |
| Nathan Yonkee |
9:d58e77ebd769 | 40 | @note mbed OS always uses millisecond RTOS ticks, and this could only wrap |
| Nathan Yonkee |
9:d58e77ebd769 | 41 | after half a billion years |
| Nathan Yonkee |
9:d58e77ebd769 | 42 | @note You cannot call this function from ISR context. |
| Nathan Yonkee |
9:d58e77ebd769 | 43 | */ |
| Nathan Yonkee |
9:d58e77ebd769 | 44 | uint64_t get_ms_count(); |
| Nathan Yonkee |
9:d58e77ebd769 | 45 | |
| Nathan Yonkee |
9:d58e77ebd769 | 46 | } // namespace Kernel |
| Nathan Yonkee |
9:d58e77ebd769 | 47 | |
| Nathan Yonkee |
9:d58e77ebd769 | 48 | } // namespace rtos |
| Nathan Yonkee |
9:d58e77ebd769 | 49 | #endif |
| Nathan Yonkee |
9:d58e77ebd769 | 50 | |
| Nathan Yonkee |
9:d58e77ebd769 | 51 | /** @}*/ |