Skip to content

Commit f1f5a27

Browse files
committed
Update to RTOS page and Kernel namespace documentation
1 parent c01ac3e commit f1f5a27

File tree

5 files changed

+41
-39
lines changed

5 files changed

+41
-39
lines changed

docs/reference/api/rtos/EventFlags.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<span class="images">![](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/classrtos_1_1_event_flags.png)<span>EventFlags class hierarchy</span></span>
44

5-
The EventFlags class is a C++ wrapper over the Keil RTX EventFlags functionality. The EventFlags class provides a mechanism for setting and waiting for flags. It provides a generic way of notifying other threads about conditions or events. You can think of each instance of the EventFlags class as an event channel. There are 31 different flags available for each event. For more information and implementation details, see [the Keil CMSIS-RTOS documentation](http://arm-software.github.io/CMSIS_5/RTOS2/html/group__CMSIS__RTOS__EventFlags.html).
5+
The EventFlags class provides a mechanism for setting and waiting for specific conditions. It provides a generic way of notifying other threads about conditions or events. You can think of each instance of the EventFlags class as an event channel. There are 31 different flags available for each event.
66

77
### EventFlag class reference
88

@@ -40,7 +40,3 @@ int main()
4040
}
4141
}
4242
```
43-
44-
### Related content
45-
46-
- [The Keil CMSIS-RTOS](http://arm-software.github.io/CMSIS_5/RTOS2/html/group__CMSIS__RTOS__EventFlags.html) documentation.

docs/reference/api/rtos/Kernel.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Kernel Interface functions
2+
3+
Kernel namespace implements functions to read RTOS information. Currently it implements one function to read the current RTOS kernel millisecond tick count.
4+
5+
### Kernel namespace reference
6+
7+
[![View code](https://www.mbed.com/embed/?type=library)](http://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/namespacertos_1_1Kernel.html)
8+
9+
### get_ms_count() example
10+
Currently kernel implements one function named get_ms_count() to read the current RTOS kernel millisecond tick count.
11+
The below code snippet demonstrates usage of get_ms_count() function to calculate the elapsed time.
12+
13+
```
14+
void send_data()
15+
{
16+
// 64-bit time doesn't wrap for half a billion years, at least
17+
uint64_t now = Kernel::get_ms_count();
18+
//do some operations
19+
// ...
20+
21+
uint64_t later = Kernel::get_ms_count();
22+
23+
//calculate millisecs elapsed
24+
uint64_t elapsed_ms = later - now;
25+
}
26+
```

docs/reference/api/rtos/MessagePipe.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/reference/api/rtos/RtosTimer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Use the RtosTimer class to create and control timer functions in the system. A timer function is called when a time period expires, so both one-shot and periodic timers are possible. You can start, restart or stop a timer.
88

9-
The thread `osTimerThread` handles timers. Callback functions run under the control of this thread and may use CMSIS-RTOS API calls.
9+
The thread `osTimerThread` handles timers. Callback functions run under the control of this thread and may use underlying RTOS API calls.
1010

1111
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/rtos_timer.png)</span>
1212

docs/reference/api/rtos/rtos.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<h2 id="rtos-api">RTOS overview</h2>
22

3-
The Arm Mbed RTOS is a C++ wrapper over the Keil RTX code. For more information about Keil RTX, check [the Keil CMSIS-RTOS tutorial](https://github.com/ARM-software/CMSIS/raw/master/CMSIS/Documentation/RTX/CMSIS_RTOS_Tutorial.pdf) and [the element14 introduction to Keil RTX](https://www.element14.com/community/docs/DOC-46650/l/arm-keil-rtx-real-time-operating-system-overview). You can use these resources as a general introduction to RTOS principles; it is important to be familiar with the concepts behind an RTOS in order to understand this guide.
3+
The Arm Mbed RTOS APIs provides C++ APIs to manage RTOS objects like thread, synchronization objects and timer. It also provides interfaces for attaching application
4+
specific idle hook function and to read the tick count from OS. The Arm Mbed RTOS layer also handles RTOS errors and report them into Mbed-OS error handling system.
45

56
The code of the Mbed RTOS can be found in the [`mbed-os`](https://github.com/ARMmbed/mbed-os) repository, in the [RTOS subdirectory](https://github.com/ARMmbed/mbed-os/tree/master/rtos). See [the Doxygen](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/group__rtos.html) for more information.
67

7-
#### SysTick
8+
#### RTOS Ticker
9+
Platforms using RTOS, including Mbed OS, need a mechanism for counting the time and scheduling tasks. This is usually done by a timer which generates periodic interrupts and is called system tick timer.
10+
Under Mbed OS, we call this mechanism RTOS ticker.
811

9-
System tick timer (SysTick) is a standard timer available on most Cortex-M cores. Its main purpose is to raise an interrupt with set frequency (usually 1ms). You can use it to perform any task in the system, but for platforms using RTOS, including Mbed OS, it provides an interval for the OS for counting the time and scheduling tasks.
12+
SysTick is a standard timer available on most Cortex-M cores. Its main purpose is to raise an interrupt with set frequency (usually 1ms). In addition, many Mbed OS platforms
13+
implement timers as part of peripherals. Mbed OS supports using SysTick or the peripheral timers as RTOS ticker.
1014

11-
Mbed OS uses default SysTick source for most targets, but you can override that using the [Tick API](http://arm-software.github.io/CMSIS_5/RTOS2/html/group__CMSIS__RTOS__TickAPI.html) that CMSIS-RTOS2 provides. In which case you'll need to provide your own source of the interrupts.
15+
Mbed OS platforms uses SysTick as the default RTOS ticker, but if you want to use one of the peripheral timers as your RTOS ticker you can do so by overriding the default SysTick timer. For example, see [Low Power Ticker](/docs/development/reference/low-power-ticker.html) on how to use external low power timer to perform power efficient timing operations that only requires millisecond accuracy.
1216

1317
#### RTOS APIs
1418

@@ -23,6 +27,8 @@ The RTOS APIs handle creation and destruction of threads in Arm Mbed OS 5, as we
2327
- [RtosTimer](/docs/development/reference/rtostimer.html): A deprecated class used to control timer functions in the system.
2428
- [EventFlags](/docs/development/reference/eventflags.html): An event channel that provides a generic way of notifying other threads about conditions or events.
2529
- [Event](/docs/development/reference/event.html): The queue to store events, extract them and excute them later.
30+
- [ConditionVariable](/docs/development/reference/conditionvariable.html): The ConditionVariable class provides a mechanism to safely wait for or signal state changes.
31+
- [Kernel](/docs/development/reference/kernel.html): Kernel namespace implements functions to control or read RTOS information like tick count.
2632

2733
##### Default timeouts
2834

@@ -51,21 +57,6 @@ Each `Thread` can wait for signals and be notified of events:
5157

5258
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/rtos_signals/)](https://os.mbed.com/teams/mbed_example/code/rtos_signals/file/476186ff82cf/main.cpp)
5359

54-
##### Status and error codes
55-
56-
The CMSIS-RTOS functions will return the following statuses:
57-
58-
- `osOK`: function completed; no event occurred.
59-
- `osEventSignal`: function completed; signal event occurred.
60-
- `osEventMessage`: function completed; message event occurred.
61-
- `osEventMail`: function completed; mail event occurred.
62-
- `osEventTimeout`: function completed; timeout occurred.
63-
- `osErrorParameter`: a mandatory parameter was missing or specified an incorrect object.
64-
- `osErrorResource`: a specified resource was not available.
65-
- `osErrorTimeoutResource`: a specified resource was not available within the timeout period.
66-
- `osErrorISR`: the function cannot be called from interrupt service routines (ISR).
67-
- `osErrorISRRecursive`: function called multiple times from ISR with same object.
68-
- `osErrorPriority`: system cannot determine priority or thread has illegal priority.
69-
- `osErrorNoMemory`: system is out of memory; it was impossible to allocate or reserve memory for the operation.
70-
- `osErrorValue`: value of a parameter is out of range.
71-
- `osErrorOS`: unspecified RTOS error - runtime error but no other error message fits.
60+
##### Status and Error codes
61+
The Arm Mbed RTOS layer handles RTOS errors and report them using Mbed-OS error handling system. See the list of error codes in [Error Handling](/docs/development/reference/error-handling.html)
62+
for more information on RTOS errors reported.

0 commit comments

Comments
 (0)