mirror of https://github.com/ARMmbed/mbed-os.git
RTX5: uVisor: Use OsEventObserver
parent
12a47f0031
commit
474f6c63ba
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
|
||||
// OS Runtime Information
|
||||
|
|
@ -543,6 +544,15 @@ osStatus_t osKernelStart (void) {
|
|||
EvrRtxKernelError(osErrorISR);
|
||||
return osErrorISR;
|
||||
}
|
||||
|
||||
/* Call the pre-start event (from unprivileged mode) if the handler exists
|
||||
* and the kernel is not running. */
|
||||
/* FIXME osEventObs needs to be readable but not writable from unprivileged
|
||||
* code. */
|
||||
if (osKernelGetState() != osKernelRunning && osEventObs && osEventObs->pre_start) {
|
||||
osEventObs->pre_start();
|
||||
}
|
||||
|
||||
return __svcKernelStart();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
// ==== Helper functions ====
|
||||
|
||||
|
|
@ -413,6 +413,10 @@ void osRtxThreadSwitch (os_thread_t *thread) {
|
|||
osRtxInfo.thread.run.next = thread;
|
||||
osRtxThreadStackCheck();
|
||||
EvrRtxThreadSwitch(thread);
|
||||
|
||||
if (osEventObs && osEventObs->thread_switch) {
|
||||
osEventObs->thread_switch(thread->context);
|
||||
}
|
||||
}
|
||||
|
||||
/// Dispatch specified Thread or Ready Thread with Highest Priority.
|
||||
|
|
@ -766,6 +770,13 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
|
|||
|
||||
EvrRtxThreadCreated(thread);
|
||||
|
||||
/* Notify the OS event observer of a new thread. */
|
||||
if (osEventObs && osEventObs->thread_create) {
|
||||
thread->context = osEventObs->thread_create((int)thread, context);
|
||||
} else {
|
||||
thread->context = context;
|
||||
}
|
||||
|
||||
osRtxThreadDispatch(thread);
|
||||
|
||||
return thread;
|
||||
|
|
@ -1212,6 +1223,10 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
|
|||
return osErrorResource;
|
||||
}
|
||||
|
||||
if (osEventObs && osEventObs->thread_destroy) {
|
||||
osEventObs->thread_destroy(thread->context);
|
||||
}
|
||||
|
||||
// Release owned Mutexes
|
||||
osRtxMutexOwnerRelease(thread->mutex_list);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue