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 "rtx_lib.h"
|
||||||
|
#include "rt_OsEventObserver.h"
|
||||||
|
|
||||||
|
|
||||||
// OS Runtime Information
|
// OS Runtime Information
|
||||||
|
@ -541,6 +542,15 @@ osStatus_t osKernelStart (void) {
|
||||||
EvrRtxKernelError(osErrorISR);
|
EvrRtxKernelError(osErrorISR);
|
||||||
return 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();
|
return __svcKernelStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtx_lib.h"
|
#include "rtx_lib.h"
|
||||||
|
#include "rt_OsEventObserver.h"
|
||||||
|
|
||||||
|
|
||||||
// ==== Helper functions ====
|
// ==== Helper functions ====
|
||||||
|
@ -425,6 +426,10 @@ void osRtxThreadSwitch (os_thread_t *thread) {
|
||||||
osRtxInfo.thread.run.next = thread;
|
osRtxInfo.thread.run.next = thread;
|
||||||
osRtxThreadStackCheck();
|
osRtxThreadStackCheck();
|
||||||
EvrRtxThreadSwitch(thread);
|
EvrRtxThreadSwitch(thread);
|
||||||
|
|
||||||
|
if (osEventObs && osEventObs->thread_switch) {
|
||||||
|
osEventObs->thread_switch(thread->context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dispatch specified Thread or Ready Thread with Highest Priority.
|
/// 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);
|
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);
|
osRtxThreadDispatch(thread);
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
|
@ -1215,6 +1227,10 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
|
||||||
return osErrorResource;
|
return osErrorResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (osEventObs && osEventObs->thread_destroy) {
|
||||||
|
osEventObs->thread_destroy(thread->context);
|
||||||
|
}
|
||||||
|
|
||||||
// Release owned Mutexes
|
// Release owned Mutexes
|
||||||
osRtxMutexOwnerRelease(thread->mutex_list);
|
osRtxMutexOwnerRelease(thread->mutex_list);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue