mirror of https://github.com/ARMmbed/mbed-os.git
RTX5: uVisor: Use OsEventObserver
parent
73a957997f
commit
c250369803
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
|
||||
// OS Runtime Information
|
||||
|
@ -312,7 +313,7 @@ static int32_t svcRtxKernelLock (void) {
|
|||
}
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
||||
/// Unlock the RTOS Kernel scheduler.
|
||||
/// \note API identical to osKernelUnlock
|
||||
static int32_t svcRtxKernelUnlock (void) {
|
||||
|
@ -430,7 +431,7 @@ static void svcRtxKernelResume (uint32_t sleep_ticks) {
|
|||
thread->delay = 1U;
|
||||
do {
|
||||
osRtxThreadDelayTick();
|
||||
if (delay == 0U) {
|
||||
if (delay == 0U) {
|
||||
break;
|
||||
}
|
||||
delay--;
|
||||
|
@ -578,6 +579,13 @@ osStatus_t osKernelStart (void) {
|
|||
EvrRtxKernelError((int32_t)osErrorISR);
|
||||
status = osErrorISR;
|
||||
} else {
|
||||
/* 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();
|
||||
}
|
||||
status = __svcKernelStart();
|
||||
}
|
||||
return status;
|
||||
|
@ -596,7 +604,7 @@ int32_t osKernelLock (void) {
|
|||
}
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
||||
/// Unlock the RTOS Kernel scheduler.
|
||||
int32_t osKernelUnlock (void) {
|
||||
int32_t lock;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "rtx_lib.h"
|
||||
|
||||
#include "rt_OsEventObserver.h"
|
||||
|
||||
// OS Runtime Object Memory Usage
|
||||
#if ((defined(OS_OBJ_MEM_USAGE) && (OS_OBJ_MEM_USAGE != 0)))
|
||||
|
@ -816,6 +816,13 @@ static osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const
|
|||
EvrRtxThreadError(NULL, (int32_t)osErrorNoMemory);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
if (thread != NULL) {
|
||||
osRtxThreadDispatch(thread);
|
||||
}
|
||||
|
@ -1325,6 +1332,10 @@ static osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (osEventObs && osEventObs->thread_destroy) {
|
||||
osEventObs->thread_destroy(thread->context);
|
||||
}
|
||||
|
||||
if (status == osOK) {
|
||||
// Release owned Mutexes
|
||||
osRtxMutexOwnerRelease(thread->mutex_list);
|
||||
|
|
Loading…
Reference in New Issue