Commit Graph

33 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
Deepika 3d5ec6626f RTOS: Add required header file and namespace element instead add all 2018-10-15 10:39:41 -05:00
Kevin Bracey 0ddd1d9af5 Make Thread methods const 2018-08-28 13:25:17 +03:00
Kevin Bracey 1330eeecd0 Add ThisThread 2018-08-28 13:25:17 +03:00
Kevin Bracey 6477b762d1 Style clean-up of Thread-related files 2018-08-27 12:30:33 +03:00
Senthil Ramakrishnan 481285a324 Fix for max_stack not returning right value when OS_STACK_WATERMARK is enabled 2018-07-18 15:05:39 -05:00
Martin Kojtal e91ab9c1a1 Thread: fix rtx thread type 2018-06-28 14:40:08 +01:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
deepikabhavnani 48002ffc39 Added description of tz_module and MBED_TZ_DEFAULT_ACCESS 2018-04-04 12:28:57 -05:00
Deepika ceb44f9cb1 Overloaded ctor for new parameter tz_module 2018-03-29 17:01:02 -05:00
Deepika 044dfb122f Trust zone module identifier added to thread class
Non-Secure threads can access secure calls only when tz_module attribute is set
as 1(OS_SECURE_CALLABLE_THREAD), while thread creation.
Hence adding tz_module as an argument to ctor.
2018-03-28 16:06:06 -05:00
Kevin Bracey 99dc805e79 Add Thread::wait_until
API is somewhat loose to cope with potential shift in the underlying
RTOS APIs.
2018-01-29 15:26:41 +02:00
Maciej Rogozinski c08e0f51ec Fixed whitespace 2017-11-27 09:54:09 +01:00
Maciej Rogozinski c721ed8966 Fatal parameter error when deleting/terminating Thread object
Call to osThreadTerminate is guarded by local_id check, to avoid parameter error fault when deleting or terminating Thread object that was not started.
2017-11-25 18:09:37 +01:00
Russ Butler d98a011749 Ensure Thread stack is 8 byte aligned
Ensure both the stack and stack size used in the Thread class are
aligned to 8 bytes. This prevents the runtime error
"Thread 0 error -11: Unknown" due to incorrect stack alignment.
2017-10-31 11:58:18 -05:00
Russ Butler b2384b1629 Remove use of internal RTX types
Make calls to cmsis-os to get thread state, stack size, and max stack
usage rather than accessing internal RTX data directly. Wrap RTX5
specific code in OS_BACKEND_RTX5.

Also refactor the code to use mbed types rather than RTX types:
os_timer_t -> mbed_rtos_storage_timer_t
os_event_flags_t -> mbed_rtos_storage_event_flags_t
osRtxMutex_t -> mbed_rtos_storage_thread_t
2017-09-04 11:26:38 -05:00
Bartek Szatkowski 4c489e686b RTOS: Thread: Fix how free stack is calculated 2017-06-29 13:01:21 +01:00
Bartek Szatkowski 505beb773f RTOS: Thread: Fix return value for signal_wait
Signal wait was always returning success even in case of error.
2017-06-29 12:58:44 +01:00
Bartek Szatkowski af1832d4c7 RTOS: Thread: Update docs; make singal_clr static as it's affects running thread 2017-06-29 12:58:44 +01:00
Russ Butler cabc1e0911 Fix Thread class synchronization
Prevent osTheadTerminate from being called on an already terminated
thread. Also make sure the thread termination process is properly
synchronized.
2017-06-02 23:50:38 -05:00
Bartek Szatkowski b01f13d1a0 Make sure all system threads and mutexes have clear names 2017-05-30 18:55:55 +01: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
Russ Butler 05403d4231 rtos: Add Inactive return to thread get state
If a thread hasn't been started return Inactive as the status when
Thread::get_state() is called.
2017-03-06 11:54:57 -06:00
Russ Butler 11ef1d10b8 rtos: Return an error when a Thread is re-used
Calling Thread::start multiple times leads to undefined behavior since
the Thread class was not designed to handle being restarted.  Return an
error code if Thread::start is called a second time to prevent this
behavior.
2017-03-06 11:54:50 -06: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