亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? emos_task.c

?? emos是一個新的類似于ucos的內(nèi)核
?? C
?? 第 1 頁 / 共 3 頁
字號:
/****************************************************************************
 *
 * (c) Copyright 2001,2008, EMB system, All Rights Reserved.
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF EMB SYSTEM, INC.
 * The copyright notice above does not evidence any actual or intended
 * publication of such source code. 
 *
 *  Subsystem:    EMOS 
 *  File:         emos_task.c
 *  Author:       zenf zhao
 *  Description:  EMOS task implementation
 *
 ****************************************************************************/
/*#include "emos_inc.h"
#include "emos_cfg.h"*/
#include "emos_core.h"


static void  emosDummy (void);
static void  emosDummy (void)
{
	;
}


/**********************************************************************************************************
* CHANGE PRIORITY OF A TASK
*
* Description: This function allows you to change the priority of a task dynamically.  Note that the new
*              priority MUST be available.
* Arguments  : oldp     is the old priority
*              newp     is the new priority
* Returns    : EMOS_NO_ERR        is the call was successful
*              EMOS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed 
*                                 (i.e. >= EMOS_LOWEST_PRIO)
*              EMOS_PRIO_EXIST    if the new priority already exist.
*              EMOS_PRIO_ERR      there is no task with the specified OLD priority (i.e. the OLD task does
*                                 not exist.
**********************************************************************************************************/

#if EMOS_TASK_CHANGE_PRIO_EN
uint8 emosTaskChangePrio (uint8 oldprio, uint8 newprio)
{
    EMOS_TCB_T*    ptcb;
    EMOS_EVENT_T*  pevent;
    uint8     x;
    uint8     y;
    uint8     bitx;
    uint8     bity;


    if ((oldprio >= EMOS_LOWEST_PRIO && oldprio != EMOS_PRIO_SELF)||newprio >= EMOS_LOWEST_PRIO) 
    {
        return (EMOS_PRIO_INVALID);
    }
    
    EMOS_ENTER_CRITICAL();
    if (gEmosTCBPrioTbl[newprio] != (EMOS_TCB_T *)0) 
    {   
    	/* New priority must not already exist */
        EMOS_EXIT_CRITICAL();
        return (EMOS_PRIO_EXIST);
    } 
    else 
    {
        gEmosTCBPrioTbl[newprio] = (EMOS_TCB_T *)1; /* Reserve the entry to prevent others */
        EMOS_EXIT_CRITICAL();
        y    = newprio >> 3;          /* Precompute to reduce INT. latency   */
        bity = gEmosMapTbl[y];
        x    = newprio & 0x07;
        bitx = gEmosMapTbl[x];
        EMOS_ENTER_CRITICAL();
        
        if (oldprio == EMOS_PRIO_SELF) 
        {   
        	/* See if changing self  */
            oldprio = gEmosTCBCur->osTCBPrio;  /* Yes, get priority */
        }
        
        if ((ptcb = gEmosTCBPrioTbl[oldprio]) != (EMOS_TCB_T *)0) 
        {   
        	/* Task to change must exist           */
            gEmosTCBPrioTbl[oldprio] = (EMOS_TCB_T *)0; /* Remove TCB from old priority */
            if (gEmosRdyTbl[ptcb->osTCBY] & ptcb->osTCBBitX) 
            {    
            	/* If task is ready make it not ready, &= operator and the MaskBit and set the value*/
                if ((gEmosRdyTbl[ptcb->osTCBY] &= ~ptcb->osTCBBitX) == 0) 
                {
                    gEmosRdyGrp &= ~ptcb->osTCBBitY;
                }
                gEmosRdyGrp    |= bity; /* Make new priority ready to run */
                gEmosRdyTbl[y] |= bitx;
            } 
            else 
            {
                if ((pevent = ptcb->osTCBEventPtr) != (EMOS_EVENT_T*)0) 
                { 
                	/* Remove from event wait list  */
                    if ((pevent->osEventTbl[ptcb->osTCBY] &= ~ptcb->osTCBBitX) == 0) 
                    {
                        pevent->osEventGrp &= ~ptcb->osTCBBitY;
                    }
                    pevent->osEventGrp    |= bity; /* Add new priority to wait list */
                    pevent->osEventTbl[y] |= bitx;
                }
            }
            
            gEmosTCBPrioTbl[newprio] = ptcb;   /* Place pointer to TCB @ new priority */
            ptcb->osTCBPrio       = newprio;   /* Set new task priority  */
            ptcb->osTCBY          = y;
            ptcb->osTCBX          = x;
            ptcb->osTCBBitY       = bity;
            ptcb->osTCBBitX       = bitx;
            EMOS_EXIT_CRITICAL();
            emosSched();              /* Run highest priority task ready */
            return (EMOS_NO_ERR);
        } 

        /*old ptcb is zero, task old does not exist*/
        else 
        {
            gEmosTCBPrioTbl[newprio] = (EMOS_TCB_T *)0; /* Release the reserved prio. */
            EMOS_EXIT_CRITICAL();
            return (EMOS_PRIO_ERR);                     /* Task to change didn't exist  */
        }
        
    }/*end of the NULL=gEmosTCBPrioTbl[newprio]*/

    return (EMOS_NO_ERR);
}
#endif

/**********************************************************************************************************
* CREATE A TASK
*
* Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
*              be created prior to the start of multitasking or by a running task.  A task cannot be
*              created by an ISR.
* Arguments  : task     is a pointer to the task's code
*              pdata    is a pointer to an optional data area which can be used to pass parameters to
*                       the task when the task first executes.  Where the task is concerned it thinks
*                       it was invoked and passed the argument 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               for (;;) {
*                                   Task code;
*                               }
*                           }
*              ptos     is a pointer to the task's top of stack.  If the configuration constant 
*                       EMOS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
*                       memory to low memory).  'pstk' will thus point to the highest (valid) memory 
*                       location of the stack.  If EMOS_STK_GROWTH is set to 0, 'pstk' will point to the 
*                       lowest memory location of the stack and the stack will grow with increasing
*                       memory locations.
*              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
*                       lower the number, the higher the priority.
* Returns    : EMOS_NO_ERR        if the function was successful.
*              EMOS_PRIO_EXIT     if the task priority already exist 
*                               (each task MUST have a unique priority).
*              EMOS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed 
*                               (i.e. >= EMOS_LOWEST_PRIO)
**********************************************************************************************************/

#if EMOS_TASK_CREATE_EN
uint8 emosTaskCreate (void (*task)(void *pd), void *pdata, EMOS_STK *ptos, uint8 prio)
{
    void*   psp = NULL;
    uint8   err;

    if (prio > EMOS_LOWEST_PRIO) 
    {   
    	/* Make sure priority is within allowable range           */
        return (EMOS_PRIO_INVALID);
    }
    
    EMOS_ENTER_CRITICAL();
    if (gEmosTCBPrioTbl[prio] == (EMOS_TCB_T *)0) 
    { 
    	/* Make sure task doesn't already exist at this priority  */
        gEmosTCBPrioTbl[prio] = (EMOS_TCB_T *)1; /* Reserve the priority to prevent others from doing ...  */
                                                 /* ... the same thing until task is created. */
        EMOS_EXIT_CRITICAL();
        psp = (void *)emosTaskStkInit(task, pdata, ptos, 0); /* Initialize the task's stack */
        err = emosTCBInit(prio, (EMOS_STK *)psp, (EMOS_STK *)0, 0, 0, (void *)0, 0);         
        if (err == EMOS_NO_ERR)
        {
            EMOS_ENTER_CRITICAL();
            gEmosTaskCtr++;                                     /* Increment the #tasks counter */
            emosTaskCreateHook(gEmosTCBPrioTbl[prio]);          /* Call user defined hook */
            EMOS_EXIT_CRITICAL();
            if (gEmosRunning) 
            {   
            	/* Find highest priority task if multitasking has started */
                emosSched();
            }
        } 
        else 
        {
            EMOS_ENTER_CRITICAL();
            gEmosTCBPrioTbl[prio] = (EMOS_TCB_T *)0;/* Make this priority available to others */
            EMOS_EXIT_CRITICAL();
        }
        
        return (err);
    }

    else 
    {
        EMOS_EXIT_CRITICAL();
        return (EMOS_PRIO_EXIST);
    }
    
}
#endif

/**********************************************************************************************************
* CREATE A TASK (Extended Version)
* Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
*              be created prior to the start of multitasking or by a running task.  A task cannot be
*              created by an ISR.  This function is similar to OSTaskCreate() except that it allows
*              additional information about a task to be specified.
* Arguments  : task     is a pointer to the task's code
*              pdata    is a pointer to an optional data area which can be used to pass parameters to
*                       the task when the task first executes.  Where the task is concerned it thinks
*                       it was invoked and passed the argument 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               for (;;) {
*                                   Task code;
*                               }
*                           }
*              ptos     is a pointer to the task's top of stack.  If the configuration constant 
*                       EMOS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
*                       memory to low memory).  'pstk' will thus point to the highest (valid) memory 
*                       location of the stack.  If EMOS_STK_GROWTH is set to 0, 'pstk' will point to the 
*                       lowest memory location of the stack and the stack will grow with increasing
*                       memory locations.  'pstk' MUST point to a valid 'free' data item.
*              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
*                       lower the number, the higher the priority.
*              id       is the task's ID (0..65535)
*              pbos     is a pointer to the task's bottom of stack.  If the configuration constant 
*                       EMOS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
*                       memory to low memory).  'pbos' will thus point to the LOWEST (valid) memory 
*                       location of the stack.  If EMOS_STK_GROWTH is set to 0, 'pbos' will point to the 
*                       HIGHEST memory location of the stack and the stack will grow with increasing
*                       memory locations.  'pbos' MUST point to a valid 'free' data item.
*
*              stk_size is the size of the stack in number of elements.  If EMOS_STK is set to uint8,
*                       'stk_size' corresponds to the number of bytes available.  If EMOS_STK is set to
*                       INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
*                       EMOS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
*                       available on the stack.
*              pext     is a pointer to a user supplied memory location which is used as a TCB extension.
*                       For example, this user memory can hold the contents of floating-point registers
*                       during a context switch, the time each task takes to execute, the number of times
*                       the task has been switched-in, etc. 
*              opt      contains additional information (or options) about the behavior of the task.  The 
*                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application 
*                       specific.  See EMOS_TASK_OPT_??? in uCOS-II.H.
* Returns    : EMOS_NO_ERR        if the function was successful.
*              EMOS_PRIO_EXIT     if the task priority already exist 
*                               (each task MUST have a unique priority).
*              EMOS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed 
*                               (i.e. > EMOS_LOWEST_PRIO)
*********************************************************************************************************/
#if   EMOS_TASK_CREATE_EXT_EN    
uint8 emosTaskCreateExt (void   (*task)(void *pd), 
                       void      *pdata, 
                       EMOS_STK  *ptos, 
                       uint8      prio,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆免费看片| 日韩精品最新网址| 欧美老女人第四色| 911精品产国品一二三产区| 欧美久久久久久久久中文字幕| 欧美日本一道本在线视频| 亚洲精品一区在线观看| 亚洲男人电影天堂| 九色|91porny| 国产精品自拍一区| 欧美亚洲国产一区在线观看网站| 在线播放亚洲一区| 中文一区二区完整视频在线观看| 亚洲人成在线播放网站岛国| 偷拍亚洲欧洲综合| 成人做爰69片免费看网站| 欧美日韩精品欧美日韩精品一| 欧美tk丨vk视频| 洋洋成人永久网站入口| 国产乱人伦精品一区二区在线观看 | 国产欧美精品一区二区色综合| 亚洲精品欧美激情| 国产精品99久久久久久久女警| 欧美午夜在线观看| 欧美韩日一区二区三区四区| 午夜激情综合网| 成人aaaa免费全部观看| 精品免费99久久| 一区二区三区毛片| 成a人片亚洲日本久久| 欧美tk丨vk视频| 日韩精品1区2区3区| 色丁香久综合在线久综合在线观看| 久久―日本道色综合久久| 国产精品欧美一级免费| 韩国女主播成人在线观看| 欧美日韩精品一区二区三区四区 | 欧美精品精品一区| 一区二区在线观看视频在线观看| 国产伦精品一区二区三区视频青涩| 欧美视频日韩视频在线观看| 国产精品成人网| 成人av午夜影院| 国产欧美精品一区二区色综合朱莉| 久久99精品一区二区三区三区| 欧美精品一级二级| 亚洲成人午夜影院| 在线一区二区视频| 一区二区三区久久久| 91性感美女视频| 亚洲欧美一区二区久久| 国产91精品久久久久久久网曝门| 精品粉嫩超白一线天av| 免费观看一级特黄欧美大片| 欧美老年两性高潮| 五月婷婷综合激情| 欧美日韩国产一级| 视频一区二区中文字幕| 91麻豆精品国产91久久久使用方法 | 91久久国产最好的精华液| 国产午夜精品美女毛片视频| 黄色日韩三级电影| 久久久美女艺术照精彩视频福利播放| 极品少妇一区二区三区精品视频 | 国产一区二区三区四| 精品电影一区二区三区 | 成人午夜av电影| 中文字幕制服丝袜一区二区三区| www.性欧美| 亚洲一区二区在线视频| 欧美精品丝袜中出| 蜜臂av日日欢夜夜爽一区| www国产成人| www.日韩精品| 一区二区三区蜜桃| 91精品国产综合久久精品麻豆| 日韩高清在线一区| 精品国产在天天线2019| 成人免费毛片a| 亚洲综合视频在线| 欧美色视频一区| 亚洲一区二区在线播放相泽| 欧美极品美女视频| 国产一区在线观看麻豆| 国产精品免费aⅴ片在线观看| 色猫猫国产区一区二在线视频| 中文字幕不卡在线播放| 99re热这里只有精品视频| 亚洲国产精品一区二区尤物区| 欧美日韩高清在线播放| 青青草成人在线观看| 久久亚洲影视婷婷| av午夜一区麻豆| 亚洲aⅴ怡春院| 日韩午夜小视频| 91在线一区二区三区| 免费一级片91| 亚洲视频在线一区| 久久综合成人精品亚洲另类欧美 | 亚洲一区二区三区视频在线| 精品999久久久| 欧美在线你懂的| 国产一区二区中文字幕| 亚洲综合免费观看高清在线观看| www久久精品| 欧美日韩国产综合一区二区 | 狠狠狠色丁香婷婷综合激情 | 欧美一三区三区四区免费在线看| 成人国产一区二区三区精品| 日本不卡中文字幕| 亚洲欧美日韩国产成人精品影院| 精品成人a区在线观看| 欧美在线观看视频在线| 不卡电影一区二区三区| 在线精品视频一区二区| 国产成人精品三级| 美腿丝袜亚洲色图| 午夜激情一区二区| 一区二区三区四区在线| 国产精品久久久久婷婷| 26uuu精品一区二区| 日韩一区二区三区视频| 欧美精品第一页| 欧美午夜寂寞影院| 日本丶国产丶欧美色综合| 99在线热播精品免费| 国产激情视频一区二区三区欧美| 蜜桃精品视频在线观看| 日本欧美在线观看| 日本vs亚洲vs韩国一区三区二区| 亚洲与欧洲av电影| 亚洲成人tv网| 亚洲福利视频一区二区| 亚洲不卡av一区二区三区| 一区二区在线看| 亚洲欧美日韩国产一区二区三区 | 欧美一区二区三区在| 69av一区二区三区| 91精品国产免费久久综合| 欧美高清视频一二三区| 日韩一区二区三区视频在线观看| 欧美一区二区三区在线观看| 欧美一区二区三区免费在线看| 欧美福利一区二区| 日韩一卡二卡三卡四卡| 精品精品欲导航| 欧美国产精品一区二区三区| 国产精品美女久久福利网站| 中文字幕在线不卡国产视频| 亚洲婷婷在线视频| 中文av字幕一区| 日韩伦理免费电影| 亚洲综合自拍偷拍| 午夜不卡av在线| 精品亚洲国产成人av制服丝袜| 麻豆精品在线播放| 国产福利视频一区二区三区| 91网站在线播放| 欧美一区二区三区爱爱| 精品国产人成亚洲区| 国产精品私人影院| 亚洲成人在线观看视频| 蜜臀精品一区二区三区在线观看| 国产成人精品免费视频网站| 91网站黄www| 欧美一区二区三区成人| 欧美高清在线精品一区| 亚洲国产日日夜夜| 美国av一区二区| 99re在线视频这里只有精品| 欧美精品亚洲二区| 中文一区二区在线观看| 五月天婷婷综合| 成人免费视频一区| 4438亚洲最大| 国产欧美一区二区精品忘忧草| 亚洲主播在线播放| 国产精品1024久久| 欧美日韩免费电影| 国产精品女同一区二区三区| 午夜国产精品一区| 99久久国产综合精品麻豆| 日韩欧美在线网站| 亚洲免费资源在线播放| 国产精品亚洲成人| 777亚洲妇女| 亚洲国产精品成人综合色在线婷婷| 亚洲国产日日夜夜| 国产成人av电影在线观看| 欧美精品久久久久久久久老牛影院| 国产视频一区二区在线| 五月天激情小说综合| 99久久精品情趣| 欧美成人一级视频| 同产精品九九九| 粉嫩13p一区二区三区| 88在线观看91蜜桃国自产| 中文字幕免费观看一区| 久久成人av少妇免费| 欧美性生活影院|