Commit Graph

12 Commits (e1124668dbbaf376467207822e4a891d1a26180c)

Author SHA1 Message Date
Kevin Bracey ed4bf5220e rtos: NULL -> nullptr
Some build errors seen with NULL not being defined. Rather than
add cstddef includes, switch to C++11 nullptr.
2019-07-15 10:13:50 +03:00
Kevin Bracey 83b329cb71 RTOS API for bare metal
Provide partial RTOS API for bare metal builds - things that
can be done in a single threaded environment.

Allows more code to work in both RTOS and bare metal builds without
change, and in particular gives easy access to the ability to
efficiently wait for something occurring in interrupt.

Available in bare-metal:
* ThisThread
* osThreadFlagsSet to set flags on main thread (can be set from IRQ)
* EventFlags (can be set from IRQ)
* Semaphores (can be released from IRQ)
* Mutex (dummy implementation)

Not useful:
* ConditionVariable (could only be signalled from 2nd thread)
* RtosTimer (calls in a second thread context)
* Thread

Unimplemented:
* Mail, Queue, MemoryPool

Possible future work:
* ConditionVariableCS to act as IRQ signalled ConditionVariable
2019-07-15 10:13:50 +03:00
Kevin Bracey 2fbbd9d2ca Introduce Semaphore::acquire methods
Deprecate wait() in favour of acquire(), try_acquire(),
try_acquire_for() and try_acquire_until().

Brings Semaphore more into line with CMSIS-RTOS 2 (which uses "acquire"),
itself (as it has "release"), and other classes having "try", "try for"
and "try until".

Also steps away from vague "wait" term - the primary operation here is
to acquire the semaphore, and this will of course sleep.
2019-05-28 17:02:06 +03:00
Kevin Bracey b7171d1bbf RTOS API: minor tidies
Remove unneeded memsets and an unneeded cast.

Add missing initialisation of EventFlags attributes - no all fields were
being initialised.
2019-03-18 17:27:07 +02:00
Martin Kojtal e7acdc4cc8 rtos: fix astyle 2018-10-25 09:58:16 +01:00
Brendan McDonnell 0dbfcb13a2 remove unused variable / resolve compiler warning 2018-02-15 12:45:39 -05:00
Kevin Bracey 2b77caa32c Add Semaphore::wait_until
Given the 64-bit timebase, add wait_until to Semaphore.

Naming is based on Thread::wait_until.

pthreads uses "timedwait", but that's not a good fit against our
existing wait() - pthreads only has an absolute-time wait, not relative.
2018-01-29 15:26:41 +02:00
Kevin Bracey 130fffaf8b Shrink RTOS classes
Various RTOS classes were storing their CMSIS-RTOS creation attribute
structure as a member, when it's not required after construction. Reduce
memory by eliminating this member.
2017-11-03 15:22:22 +02:00
Christopher Haster 6b02ceab5d rtos: Unbreak semaphore, trade assert for saturation with original limit
Before rtx 5, the max count on semaphores was UINT16_MAX, aftewards it
was decreased to 1024 with an assert on overflow.

This is especially problematic for semaphores used for signaling, since
there is no replacement currently available in C++.
2017-06-16 17:18:40 -05:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +01:00
Sam Grove 301b77c4b2 For drivers, events, hal, platform, rtos and mbed.h add one level of path to make sure specific and unique includes files are found. 2016-10-01 02:11:36 -05:00
Christopher Haster 2dd90bbe3c restructure - Restructured rtos directory 2016-09-30 19:18:09 -05:00