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