keil/include/components/wsf/sources/port/baremetal/wsf_os.c
@@ -29,11 +29,12 @@
#include "wsf_os.h"
#include "wsf_assert.h"
#include "wsf_trace.h"
#include "wsf_timer.h"
#include "mk_timer_list.h"
#include "wsf_queue.h"
#include "wsf_buf.h"
#include "wsf_msg.h"
#include "wsf_cs.h"
#include "mk_power.h"
#if defined(RTOS_CMSIS_RTX) && (RTOS_CMSIS_RTX == 1)
#include "cmsis_os2.h"
@@ -110,26 +111,6 @@
/*************************************************************************************************/
/*!
 *  \brief  Lock task scheduling.
 */
/*************************************************************************************************/
uint32_t WsfTaskLock(void)
{
    return PalEnterCs();
}
/*************************************************************************************************/
/*!
 *  \brief  Unock task scheduling.
 */
/*************************************************************************************************/
void WsfTaskUnlock(uint32_t lock)
{
    PalExitCs(lock);
}
/*************************************************************************************************/
/*!
 *  \brief  Set an event for an event handler.
 *
 *  \param  handlerId   Handler ID.
@@ -147,6 +128,7 @@
    uint32_t lock = WSF_CS_ENTER();
    wsfOs.task.handlerEventMask[WSF_HANDLER_FROM_ID(handlerId)] |= event;
    wsfOs.task.taskEventMask |= WSF_HANDLER_EVENT;
    power_mode_request(POWER_UNIT_OS, POWER_MODE_ACTIVE);
    WSF_CS_EXIT(lock);
    /* set event in OS */
@@ -169,6 +151,7 @@
    uint32_t lock = WSF_CS_ENTER();
    wsfOs.task.taskEventMask |= event;
    power_mode_request(POWER_UNIT_OS, POWER_MODE_ACTIVE);
    WSF_CS_EXIT(lock);
    /* set event in OS */
@@ -250,7 +233,7 @@
{
    wsfOsTask_t *pTask;
    void *pMsg;
    wsfTimer_t *pTimer;
    mk_timer_t *timer_ptr;
    wsfEventMask_t eventMask;
    wsfTaskEvent_t taskEventMask;
    wsfHandlerId_t handlerId;
@@ -264,6 +247,7 @@
    uint32_t lock = WSF_CS_ENTER();
    taskEventMask = pTask->taskEventMask;
    pTask->taskEventMask = 0;
    power_mode_clear(POWER_UNIT_OS);
    WSF_CS_EXIT(lock);
    if (taskEventMask & WSF_MSG_QUEUE_EVENT)
@@ -281,11 +265,12 @@
    if (taskEventMask & WSF_TIMER_EVENT)
    {
        /* service timers */
        while ((pTimer = WsfTimerServiceExpired(0)) != NULL)
        while ((timer_ptr = mk_timer_list_pick_expired()) != NULL)
        {
            WSF_ASSERT(pTimer->handlerId < WSF_MAX_HANDLERS);
            WSF_OS_SET_ACTIVE_HANDLER_ID(pTimer->handlerId);
            (*pTask->handler[pTimer->handlerId])(0, &pTimer->msg);
            WSF_ASSERT(timer_ptr->handlerId < WSF_MAX_HANDLERS);
            WSF_OS_SET_ACTIVE_HANDLER_ID(timer_ptr->handlerId);
            if (timer_ptr->fast_cb == NULL)
                (*pTask->handler[timer_ptr->handlerId])(0, &timer_ptr->msg);
        }
    }