LiteOS创建任务的一个BUG

在任务创建的时候,参数无法传递,第二个参数本来是用来做参数传递的,但是却没用到,很尴尬啊,缺少了这个功能,很多无法写了?

osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
{
    UNUSED(argument);

    UINT32 uwTid;
    UINT32 uwRet;
    LOS_TASK_CB *pstTaskCB = NULL;
    TSK_INIT_PARAM_S stTskInitParam;

    if (OS_INT_ACTIVE)
    {
        return NULL;
    }

    if ((attr == NULL) ||
        (func == NULL) ||
        (attr->priority < osPriorityLow1) ||
        (attr->priority > osPriorityAboveNormal6))
    {
        return (osThreadId_t)NULL;
    }

    memset(&stTskInitParam, 0, sizeof(TSK_INIT_PARAM_S));
    stTskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)func;
    stTskInitParam.uwStackSize  = attr->stack_size*4;
    stTskInitParam.pcName       = (CHAR *)attr->name;
    stTskInitParam.usTaskPrio   = OS_TASK_PRIORITY_LOWEST - ((UINT16)(attr->priority) - LOS_PRIORITY_WIN); /*0~31*/
    stTskInitParam.uwResved     = LOS_TASK_STATUS_DETACHED; /*the cmsis task is detached,the task can deleteself*/

    uwRet = LOS_TaskCreate(&uwTid, &stTskInitParam);

    if (LOS_OK != uwRet)
    {
        return (osThreadId_t)NULL;
    }

    pstTaskCB = OS_TCB_FROM_TID(uwTid);

    return (osThreadId_t)pstTaskCB;
}

 

posted @ 2018-07-27 17:35  429512065  阅读(791)  评论(0编辑  收藏  举报