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

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

?? os_task.c

?? ucos-ii在msp430f149上的移植
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
*                        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 OS_TASK_OPT_??? in uCOS-II.H.  Current choices are:
*
*                        OS_TASK_OPT_STK_CHK      Stack checking to be allowed for the task
*                        OS_TASK_OPT_STK_CLR      Clear the stack when the task is created
*                        OS_TASK_OPT_SAVE_FP      If the CPU has floating-point registers, save them
*                                                 during a context switch.
*
* Returns    : OS_ERR_NONE             if the function was successful.
*              OS_PRIO_EXIT            if the task priority already exist
*                                      (each task MUST have a unique priority).
*              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
*                                      (i.e. > OS_LOWEST_PRIO)
*              OS_ERR_TASK_CREATE_ISR  if you tried to create a task from an ISR.
*********************************************************************************************************
*/
/*$PAGE*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskCreateExt (void   (*task)(void *p_arg),
                        void    *p_arg,
                        OS_STK  *ptos,
                        INT8U    prio,
                        INT16U   id,
                        OS_STK  *pbos,
                        INT32U   stk_size,
                        void    *pext,
                        INT16U   opt)
{
    OS_STK    *psp;
    INT8U      err;
#if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSIntNesting > 0) {                  /* Make sure we don't create the task from within an ISR  */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_CREATE_ISR);
    }
    if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
        OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();

#if (OS_TASK_STAT_STK_CHK_EN > 0)
        OS_TaskStkClr(pbos, stk_size, opt);                    /* Clear the task stack (if needed)     */
#endif

        psp = OSTaskStkInit(task, p_arg, ptos, opt);           /* Initialize the task's stack          */
        err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
        if (err == OS_ERR_NONE) {
            if (OSRunning == OS_TRUE) {                        /* Find HPT if multitasking has started */
                OS_Sched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;                  /* Make this priority avail. to others  */
            OS_EXIT_CRITICAL();
        }
        return (err);
    }
    OS_EXIT_CRITICAL();
    return (OS_ERR_PRIO_EXIST);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            DELETE A TASK
*
* Description: This function allows you to delete a task.  The calling task can delete itself by
*              its own priority number.  The deleted task is returned to the dormant state and can be
*              re-activated by creating the deleted task again.
*
* Arguments  : prio    is the priority of the task to delete.  Note that you can explicitely delete
*                      the current task without knowing its priority level by setting 'prio' to
*                      OS_PRIO_SELF.
*
* Returns    : OS_ERR_NONE             if the call is successful
*              OS_ERR_TASK_DEL_IDLE    if you attempted to delete uC/OS-II's idle task
*              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
*                                      (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_ERR_TASK_DEL         if the task is assigned to a Mutex PIP.   
*              OS_ERR_TASK_NOT_EXIST   if the task you want to delete does not exist.
*              OS_ERR_TASK_DEL_ISR     if you tried to delete a task from an ISR
*
* Notes      : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
*                    a) by making it not ready
*                    b) by removing it from any wait lists
*                    c) by preventing OSTimeTick() from making the task ready to run.
*                 The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
*              2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most processors,
*                 the next instruction following the enable interrupt instruction is ignored.
*              3) An ISR cannot delete a task.
*              4) The lock nesting counter is incremented because, for a brief instant, if the current
*                 task is being deleted, the current task would not be able to be rescheduled because it
*                 is removed from the ready list.  Incrementing the nesting counter prevents another task
*                 from being schedule.  This means that an ISR would return to the current task which is
*                 being deleted.  The rest of the deletion would thus be able to be completed.
*********************************************************************************************************
*/

#if OS_TASK_DEL_EN > 0
INT8U  OSTaskDel (INT8U prio)
{
#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    OS_FLAG_NODE *pnode;
#endif
    OS_TCB       *ptcb;
#if OS_CRITICAL_METHOD == 3                             /* Allocate storage for CPU status register    */
    OS_CPU_SR     cpu_sr = 0;
#endif



    if (OSIntNesting > 0) {                             /* See if trying to delete from ISR            */
        return (OS_ERR_TASK_DEL_ISR);
    }
    if (prio == OS_TASK_IDLE_PRIO) {                    /* Not allowed to delete idle task             */
        return (OS_ERR_TASK_DEL_IDLE);
    }
#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {                       /* Task priority valid ?                       */
        if (prio != OS_PRIO_SELF) {
            return (OS_ERR_PRIO_INVALID);
        }
    }
#endif

/*$PAGE*/
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                         /* See if requesting to delete self            */
        prio = OSTCBCur->OSTCBPrio;                     /* Set priority to delete to current           */
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                          /* Task to delete must exist                   */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_NOT_EXIST);
    }
    if (ptcb == OS_TCB_RESERVED) {                      /* Must not be assigned to Mutex               */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_DEL);
    }

    OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX;
    if (OSRdyTbl[ptcb->OSTCBY] == 0) {                  /* Make task not ready                         */
        OSRdyGrp           &= ~ptcb->OSTCBBitY;
    }
    
#if (OS_EVENT_EN)
    if (ptcb->OSTCBEventPtr != (OS_EVENT *)0) {
        OS_EventTaskRemove(ptcb, ptcb->OSTCBEventPtr);  /* Remove this task from any event   wait list */
    }
#if (OS_EVENT_MULTI_EN > 0)
    if (ptcb->OSTCBEventMultiPtr != (OS_EVENT **)0) {   /* Remove this task from any events' wait lists*/
        OS_EventTaskRemoveMulti(ptcb, ptcb->OSTCBEventMultiPtr);
    }
#endif
#endif

#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    pnode = ptcb->OSTCBFlagNode;
    if (pnode != (OS_FLAG_NODE *)0) {                   /* If task is waiting on event flag            */
        OS_FlagUnlink(pnode);                           /* Remove from wait list                       */
    }
#endif

    ptcb->OSTCBDly      = 0;                            /* Prevent OSTimeTick() from updating          */
    ptcb->OSTCBStat     = OS_STAT_RDY;                  /* Prevent task from being resumed             */
    ptcb->OSTCBStatPend = OS_STAT_PEND_OK;
    if (OSLockNesting < 255u) {                         /* Make sure we don't context switch           */
        OSLockNesting++;
    }
    OS_EXIT_CRITICAL();                                 /* Enabling INT. ignores next instruc.         */
    OS_Dummy();                                         /* ... Dummy ensures that INTs will be         */
    OS_ENTER_CRITICAL();                                /* ... disabled HERE!                          */
    if (OSLockNesting > 0) {                            /* Remove context switch lock                  */
        OSLockNesting--;
    }
    OSTaskDelHook(ptcb);                                /* Call user defined hook                      */
    OSTaskCtr--;                                        /* One less task being managed                 */
    OSTCBPrioTbl[prio] = (OS_TCB *)0;                   /* Clear old priority entry                    */
    if (ptcb->OSTCBPrev == (OS_TCB *)0) {               /* Remove from TCB chain                       */
        ptcb->OSTCBNext->OSTCBPrev = (OS_TCB *)0;
        OSTCBList                  = ptcb->OSTCBNext;
    } else {
        ptcb->OSTCBPrev->OSTCBNext = ptcb->OSTCBNext;
        ptcb->OSTCBNext->OSTCBPrev = ptcb->OSTCBPrev;
    }
    ptcb->OSTCBNext   = OSTCBFreeList;                  /* Return TCB to free TCB list                 */
    OSTCBFreeList     = ptcb;
#if OS_TASK_NAME_SIZE > 1
    ptcb->OSTCBTaskName[0] = '?';                       /* Unknown name                                */
    ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
#endif
    OS_EXIT_CRITICAL();
    if (OSRunning == OS_TRUE) {
        OS_Sched();                                     /* Find new highest priority task              */
    }
    return (OS_ERR_NONE);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                    REQUEST THAT A TASK DELETE ITSELF
*
* Description: This function is used to:
*                   a) notify a task to delete itself.
*                   b) to see if a task requested that the current task delete itself.
*              This function is a little tricky to understand.  Basically, you have a task that needs
*              to be deleted however, this task has resources that it has allocated (memory buffers,
*              semaphores, mailboxes, queues etc.).  The task cannot be deleted otherwise these
*              resources would not be freed.  The requesting task calls OSTaskDelReq() to indicate that
*              the task needs to be deleted.  Deleting of the task is however, deferred to the task to
*              be deleted.  For example, suppose that task #10 needs to be deleted.  The requesting task
*              example, task #5, would call OSTaskDelReq(10).  When task #10 gets to execute, it calls
*              this function by specifying OS_PRIO_SELF and monitors the returned value.  If the return
*              value is OS_ERR_TASK_DEL_REQ, another task requested a task delete.  Task #10 would look like
*              this:
*
*                   void Task(void *p_arg)
*                   {
*                       .
*                       .
*                       while (1) {
*                           OSTimeDly(1);
*                           if (OSTaskDelReq(OS_PRIO_SELF) == OS_ERR_TASK_DEL_REQ) {
*                               Release any owned resources;
*                               De-allocate any dynamic memory;
*                               OSTaskDel(OS_PRIO_SELF);
*                           }
*                       }
*                   }
*
* Arguments  : prio    is the priority of the task to request the delete from
*
* Returns    : OS_ERR_NONE            if the task exist and the request has been registered
*              OS_ERR_TASK_NOT_EXIST  if the task has been deleted.  This allows the caller to know whether
*                                     the request has been executed.
*              OS_ERR_TASK_DEL        if the task is assigned to a Mutex.
*              OS_ERR_TASK_DEL_IDLE   if you requested to delete uC/OS-II's idle task
*              OS_ERR_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                     (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_ERR_TASK_DEL_REQ    if a task (possibly another task) requested that the running task be
*                                     deleted.
*********************************************************************************************************
*/
/*$PAGE*/
#if OS_TASK_DEL_EN > 0
INT8U  OSTaskDelReq (INT8U prio)
{
    INT8U      stat;
    OS_TCB    *ptcb;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    if (prio == OS_TASK_IDLE_PRIO) {                            /* Not allowed to delete idle task     */
        return (OS_ERR_TASK_DEL_IDLE);
    }
#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
        if (prio != OS_PRIO_SELF) {
            return (OS_ERR_PRIO_INVALID);
        }
    }
#endif
    if (prio == OS_PRIO_SELF) {                                 /* See if a task is requesting to ...  */
        OS_ENTER_CRITICAL();                                    /* ... this task to delete itself      */
        stat = OSTCBCur->OSTCBDelReq;                           /* Return request status to caller     */
        OS_EXIT_CRITICAL();
        return (stat);
    }
    OS_ENTER_CRITICAL();
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                                  /* Task to delete must exist           */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_NOT_EXIST);                         /* Task must already be deleted        */
    }
    if (ptcb == OS_TCB_RESERVED) {                              /* Must NOT be assigned to a Mutex     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_DEL);
    }
    ptcb->OSTCBDelReq = OS_ERR_TASK_DEL_REQ;                    /* Set flag indicating task to be DEL. */
    OS_EXIT_CRITICAL();
    return (OS_ERR_NONE);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        GET THE NAME OF A TASK
*

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧日韩精品视频| 日韩一区二区三免费高清| 欧美日韩一区小说| 久久久不卡网国产精品一区| 亚洲柠檬福利资源导航| 久久se精品一区精品二区| 在线视频你懂得一区二区三区| 国产偷v国产偷v亚洲高清| 亚洲高清视频中文字幕| 国产不卡视频在线观看| 欧美日产在线观看| 玉米视频成人免费看| 国内精品写真在线观看| 99久久精品国产麻豆演员表| 久久亚洲一区二区三区明星换脸| 亚洲国产精品久久人人爱蜜臀| 国内一区二区视频| 日韩欧美亚洲一区二区| 偷拍日韩校园综合在线| 91蜜桃传媒精品久久久一区二区| 欧美经典一区二区| 麻豆精品久久精品色综合| 在线一区二区三区| 一区二区在线看| 成人午夜视频网站| 久久久不卡网国产精品二区| 久久精品国产网站| 日韩手机在线导航| 伦理电影国产精品| 日韩一级大片在线观看| 捆绑变态av一区二区三区| 91麻豆精品国产91久久久| 日韩电影一二三区| 制服丝袜av成人在线看| 热久久免费视频| 日韩欧美一级二级三级久久久| 日韩精品每日更新| 欧美刺激午夜性久久久久久久| 青青草国产精品97视觉盛宴| 91精品一区二区三区在线观看| 青娱乐精品视频| 精品日韩在线一区| 国产精品亚洲第一区在线暖暖韩国| 欧美tickling网站挠脚心| 国产一区二区三区四区五区入口 | 婷婷国产在线综合| 欧美日韩国产免费| 日本成人在线电影网| 精品国产乱码久久久久久浪潮| 国产一级精品在线| 中文字幕中文在线不卡住| 91女神在线视频| 视频在线观看一区二区三区| 日韩精品一区二区三区视频播放 | 中文在线一区二区| 91麻豆国产精品久久| 香蕉乱码成人久久天堂爱免费| 欧美一级欧美三级在线观看| 国产一区二区三区国产| 中文字幕一区二区三区在线播放| 在线一区二区三区做爰视频网站| 日韩精品午夜视频| 国产精品国产精品国产专区不蜜 | 亚洲第一成年网| 欧美va亚洲va香蕉在线| 99国产欧美另类久久久精品| 日韩制服丝袜av| 国产色婷婷亚洲99精品小说| 欧美综合亚洲图片综合区| 久久精品国产亚洲一区二区三区| 国产精品超碰97尤物18| 欧美精品久久一区| av中文字幕不卡| 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品久久久一区麻豆最新章节| 在线视频一区二区三| 国产精品自拍网站| 亚洲成人在线免费| 中文字幕av在线一区二区三区| 欧美日韩在线免费视频| 成人免费av在线| 美女精品一区二区| 亚洲一二三区在线观看| 国产精品无圣光一区二区| 91精品国产综合久久精品app| 成人动漫一区二区在线| 麻豆精品在线视频| 亚洲国产aⅴ成人精品无吗| √…a在线天堂一区| 国产亚洲一区二区在线观看| 911国产精品| 欧美色倩网站大全免费| 成人免费视频app| 国产在线精品免费av| 男女激情视频一区| 午夜一区二区三区视频| 亚洲乱码日产精品bd| 欧美国产日韩一二三区| 久久蜜桃av一区精品变态类天堂 | 欧美一区二区在线播放| 91黄色免费看| 91原创在线视频| 成人在线视频一区| 黑人精品欧美一区二区蜜桃| 日本一道高清亚洲日美韩| 亚洲国产综合在线| 一区二区欧美国产| 亚洲美腿欧美偷拍| 国产精品国产馆在线真实露脸| 国产欧美日产一区| 久久精品视频网| 久久伊人蜜桃av一区二区| 精品国产免费人成电影在线观看四季| 欧美日本一区二区三区四区 | 91欧美激情一区二区三区成人| www.亚洲人| 91小视频免费观看| 91成人网在线| 欧美视频一区二区三区四区| 欧美视频精品在线观看| 欧美日韩黄色一区二区| 欧美一区二区三区思思人| 欧美一区二区视频观看视频| 欧美一级黄色大片| 日韩欧美视频在线| 久久噜噜亚洲综合| 中文字幕欧美日韩一区| 中文字幕日韩一区| 亚洲国产视频a| 蜜臀91精品一区二区三区| 国产一区二区三区国产| zzijzzij亚洲日本少妇熟睡| 一本久道中文字幕精品亚洲嫩| 色婷婷精品大在线视频| 欧美丰满少妇xxxbbb| 欧美成人精精品一区二区频| 国产视频一区在线观看| 亚洲视频在线观看三级| 亚洲一区二区av电影| 美女被吸乳得到大胸91| 国产大陆精品国产| 在线看国产一区| 日韩一卡二卡三卡| 欧美高清在线一区| 亚洲电影在线播放| 国模无码大尺度一区二区三区| 风流少妇一区二区| 欧美色手机在线观看| 精品久久久久香蕉网| 亚洲欧美自拍偷拍色图| 日本不卡一区二区三区| 成人毛片在线观看| 欧美另类z0zxhd电影| 日本一区二区在线不卡| 偷偷要91色婷婷| 国产精品456| 欧美丰满嫩嫩电影| 国产精品国产三级国产专播品爱网| 午夜久久久久久电影| 丁香亚洲综合激情啪啪综合| 欧美精品久久一区二区三区| 国产精品乱码人人做人人爱| 日韩和的一区二区| 91视视频在线观看入口直接观看www | 99免费精品在线| 欧美刺激脚交jootjob| 亚洲一区二区三区四区在线观看| 国产主播一区二区| 56国语精品自产拍在线观看| 国产精品久久精品日日| 久久精品国产一区二区三 | 国产欧美日韩激情| 另类小说综合欧美亚洲| 欧洲人成人精品| 中文字幕不卡一区| 黑人巨大精品欧美黑白配亚洲| 欧美日韩国产免费一区二区| 国产精品第一页第二页第三页| 蜜臀av性久久久久蜜臀aⅴ四虎| 色综合天天视频在线观看| 国产日韩欧美不卡| 国产一区在线精品| 精品日产卡一卡二卡麻豆| 午夜精品福利久久久| 欧美视频在线观看一区| 成人免费在线视频观看| 成人a免费在线看| 国产三级三级三级精品8ⅰ区| 看电视剧不卡顿的网站| 欧美一区二区视频在线观看2020 | 亚洲国产美女搞黄色| 91小视频在线| 亚洲精选免费视频| 一本到一区二区三区| 亚洲天堂2016| 色嗨嗨av一区二区三区| 亚洲综合一二三区| 欧美日韩在线免费视频| 亚洲成av人片在www色猫咪| 欧美日韩免费观看一区三区|