mirror of https://github.com/ARMmbed/mbed-os.git
RTX5: uVisor: Use OsEventObserver
parent
24c60f6cc7
commit
7ae2e6e9ec
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
|
||||
// OS Runtime Information
|
||||
|
@ -541,6 +542,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,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
|
||||
// ==== Helper functions ====
|
||||
|
@ -425,6 +426,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.
|
||||
|
@ -769,6 +774,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;
|
||||
|
@ -1215,6 +1227,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