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

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

?? os_task.c

?? ucosII2.8,最新版本強(qiáng)烈推薦不要客氣共同學(xué)習(xí)
?? C
?? 第 1 頁 / 共 4 頁
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.80
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
//#include <ucos_ii.h>
#include "ucos_ii.h"
#endif

/*
*********************************************************************************************************
*                                        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    : OS_NO_ERR          is the call was successful
*              OS_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                 (i.e. >= OS_LOWEST_PRIO)
*              OS_PRIO_EXIST      if the new priority already exist.
*              OS_PRIO_ERR        there is no task with the specified OLD priority (i.e. the OLD task does
*                                 not exist.
*              OS_TASK_NOT_EXIST  if the task is assigned to a Mutex PIP.
*********************************************************************************************************
*/

#if OS_TASK_CHANGE_PRIO_EN > 0
INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
#if OS_EVENT_EN
    OS_EVENT    *pevent;
#endif
    OS_TCB      *ptcb;
    INT8U        x;
    INT8U        y;
#if OS_LOWEST_PRIO <= 63
    INT8U        bitx;
    INT8U        bity;
#else
    INT16U       bitx;
    INT16U       bity;
#endif
    INT8U        y_old;
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR    cpu_sr = 0;                                    /* Storage for CPU status register     */
#endif



#if OS_ARG_CHK_EN > 0
    if (oldprio >= OS_LOWEST_PRIO) {
	    if (oldprio != OS_PRIO_SELF) {
            return (OS_PRIO_INVALID);
		}
	}
    if (newprio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {                 /* New priority must not already exist */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_EXIST);
    }
    if (oldprio == OS_PRIO_SELF) {                              /* See if changing self                */
        oldprio = OSTCBCur->OSTCBPrio;                          /* Yes, get priority                   */
    }
    ptcb = OSTCBPrioTbl[oldprio];
    if (ptcb == (OS_TCB *)0) {                                  /* Does task to change exist?          */
        OS_EXIT_CRITICAL();                                     /* No, can't change its priority!      */
        return (OS_PRIO_ERR);
    }
    if (ptcb == (OS_TCB *)1) {                                  /* Is task assigned to Mutex           */
        OS_EXIT_CRITICAL();                                     /* No, can't change its priority!      */
        return (OS_TASK_NOT_EXIST);
    }
#if OS_LOWEST_PRIO <= 63
    y                     = newprio >> 3;                       /* Yes, compute new TCB fields         */
    x                     = newprio & 0x07;
#else
    y                     = (newprio >> 4) & 0xFF;
    x                     =  newprio & 0x0F;
#endif

    bity                  = 1 << y;
    bitx                  = 1 << x;
    OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                        /* Remove TCB from old priority        */
    OSTCBPrioTbl[newprio] = ptcb;                               /* Place pointer to TCB @ new priority */
    y_old                 = ptcb->OSTCBY;
    if ((OSRdyTbl[y_old] & ptcb->OSTCBBitX) != 0) {             /* If task is ready make it not        */
        OSRdyTbl[y_old] &= ~ptcb->OSTCBBitX;
        if (OSRdyTbl[y_old] == 0) {
            OSRdyGrp &= ~ptcb->OSTCBBitY;
        }
        OSRdyGrp    |= bity;                                    /* Make new priority ready to run      */
        OSRdyTbl[y] |= bitx;
#if OS_EVENT_EN
    } else {                                                    /* Task was not ready ...              */
        pevent = ptcb->OSTCBEventPtr;
        if (pevent != (OS_EVENT *)0) {                          /* ... remove from event wait list     */
            pevent->OSEventTbl[y_old] &= ~ptcb->OSTCBBitX;
            if (pevent->OSEventTbl[y_old] == 0) {
                pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
            }
            pevent->OSEventGrp    |= bity;                      /* Add new priority to wait list       */
            pevent->OSEventTbl[y] |= bitx;
        }
#endif
    }
    ptcb->OSTCBPrio = newprio;                                  /* Set new task priority               */
    ptcb->OSTCBY    = y;
    ptcb->OSTCBX    = x;
    ptcb->OSTCBBitY = bity;
    ptcb->OSTCBBitX = bitx;
    OS_EXIT_CRITICAL();
    OS_Sched();                                                 /* Run highest priority task ready     */
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            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
*
*              p_arg    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 'p_arg' as follows:
*
*                           void Task (void *p_arg)
*                           {
*                               for (;;) {
*                                   Task code;
*                               }
*                           }
*
*              ptos     is a pointer to the task's top of stack.  If the configuration constant
*                       OS_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 OS_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    : OS_NO_ERR               if the function was successful.
*              OS_PRIO_EXIT            if the task priority already exist
*                                      (each task MUST have a unique priority).
*              OS_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.
*********************************************************************************************************
*/

#if OS_TASK_CREATE_EN > 0
INT8U  OSTaskCreate (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio)
{
    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_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 *)1;    /* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();
        psp = OSTaskStkInit(task, p_arg, ptos, 0);              /* Initialize the task's stack         */
        err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
        if (err == OS_NO_ERR) {
            if (OSRunning == TRUE) {         /* Find highest priority task if multitasking has started */
                OS_Sched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
            OS_EXIT_CRITICAL();
        }
        return (err);
    }
    OS_EXIT_CRITICAL();
    return (OS_PRIO_EXIST);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                     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
*
*              p_arg     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 'p_arg' as follows:
*
*                            void Task (void *p_arg)
*                            {
*                                for (;;) {
*                                    Task code;
*                                }
*                            }
*
*              ptos      is a pointer to the task's top of stack.  If the configuration constant
*                        OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
*                        memory to low memory).  'ptos' will thus point to the highest (valid) memory
*                        location of the stack.  If OS_STK_GROWTH is set to 0, 'ptos' will point to the
*                        lowest memory location of the stack and the stack will grow with increasing
*                        memory locations.  'ptos' 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
*                        OS_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 OS_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 OS_STK is set to INT8U,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品女人毛片| 极品瑜伽女神91| 国产成人av福利| 欧美一级在线免费| 亚洲3atv精品一区二区三区| 99国产欧美久久久精品| 国产精品污污网站在线观看| 国产成人啪免费观看软件| 日韩免费视频线观看| 美国av一区二区| 日韩视频免费观看高清完整版| 日本午夜精品一区二区三区电影| 在线视频亚洲一区| 亚洲mv大片欧洲mv大片精品| 欧美日韩国产另类一区| 日日夜夜精品视频免费| 日韩欧美高清dvd碟片| 一卡二卡三卡日韩欧美| 99久久伊人久久99| 又紧又大又爽精品一区二区| 在线观看亚洲精品视频| 同产精品九九九| 久久综合精品国产一区二区三区| 久久精品99久久久| 中文子幕无线码一区tr| 91久久精品一区二区二区| 日本欧美韩国一区三区| 国产日产欧美一区| 欧美日韩一区不卡| 九九热在线视频观看这里只有精品 | 欧美午夜电影网| 国产乱人伦精品一区二区在线观看| 国产午夜亚洲精品午夜鲁丝片 | 欧美日韩国产综合一区二区三区 | 91精品婷婷国产综合久久竹菊| 日本强好片久久久久久aaa| 国产精品视频免费看| 欧美另类久久久品| 99在线热播精品免费| 男人的天堂亚洲一区| 一区二区三区日韩精品| 激情综合色丁香一区二区| 欧美午夜在线观看| 久久成人久久鬼色| 一区二区三区四区在线免费观看 | 美女看a上一区| 国产精品久久久久毛片软件| 欧美片网站yy| 欧美在线免费视屏| 99re这里都是精品| 成人综合婷婷国产精品久久| 精品系列免费在线观看| 日韩高清不卡一区二区三区| 亚洲一区自拍偷拍| 亚洲一区二区在线视频| 欧美精品一区男女天堂| 日韩欧美不卡一区| 日韩女优制服丝袜电影| 91精品国产欧美一区二区| 欧美一区二区三区四区久久| 欧美一区日韩一区| 精品乱码亚洲一区二区不卡| 精品处破学生在线二十三| 国产亚洲欧美日韩在线一区| 国产精品乱码妇女bbbb| 亚洲免费观看视频| 偷窥少妇高潮呻吟av久久免费| 无码av中文一区二区三区桃花岛| 亚洲bdsm女犯bdsm网站| 国产原创一区二区| 91在线精品一区二区三区| 欧美亚洲一区二区三区四区| 久久久精品天堂| 亚洲一区二区综合| 蜜桃视频在线一区| 成人综合在线观看| 欧美精品一二三| 26uuu精品一区二区| 亚洲视频在线观看一区| 国产精品美女久久久久久2018 | 7777精品伊人久久久大香线蕉的 | 一色桃子久久精品亚洲| 五月婷婷综合激情| 99re视频这里只有精品| 欧美巨大另类极品videosbest| 日韩美女主播在线视频一区二区三区| 久久久五月婷婷| 青青青爽久久午夜综合久久午夜| 亚洲a一区二区| 色综合色狠狠天天综合色| 欧美不卡一区二区| 亚洲一区二区高清| 国产精品羞羞答答xxdd| 欧美日韩精品免费观看视频| 欧美精品一区二区三区蜜桃| 日韩精品一二三区| 欧美亚洲一区二区在线观看| 亚洲欧美电影院| 国产精一品亚洲二区在线视频| 91免费版在线| 国产精品久久久久久久久免费丝袜| 国产一区二区美女| 欧美大片在线观看| 奇米888四色在线精品| 日韩欧美在线网站| 激情文学综合网| 久久这里只有精品视频网| 国产呦萝稀缺另类资源| 久久精品一区八戒影视| 国产成人免费9x9x人网站视频| 精品美女在线观看| 国产精品亚洲一区二区三区在线| 国产亚洲一二三区| 99久久夜色精品国产网站| 亚洲精品亚洲人成人网在线播放| 91美女片黄在线观看| 无码av中文一区二区三区桃花岛| 欧美一区二区三区免费在线看| 精品一二线国产| 国产精品福利影院| 欧美丝袜自拍制服另类| 美女性感视频久久| 18欧美亚洲精品| 欧美一区二区网站| 色综合色狠狠综合色| 日本系列欧美系列| 精品国产一区二区三区忘忧草 | 亚洲h在线观看| 中文字幕久久午夜不卡| 欧美日韩另类国产亚洲欧美一级| 国内欧美视频一区二区| 一区二区三区蜜桃网| 久久无码av三级| 欧洲一区二区三区免费视频| 国产91对白在线观看九色| 午夜精品一区在线观看| 亚洲精品综合在线| 中文字幕乱码亚洲精品一区| 欧美一级日韩一级| 欧美日韩在线直播| 波多野结衣欧美| 国产精品18久久久久久久久久久久 | 美女视频网站黄色亚洲| 亚洲地区一二三色| 亚洲一区二区3| 亚洲综合色丁香婷婷六月图片| 国产欧美日韩卡一| 欧美白人最猛性xxxxx69交| 欧美伊人精品成人久久综合97| 天天影视网天天综合色在线播放| 成人欧美一区二区三区黑人麻豆 | 欧美日韩在线综合| 欧美日韩精品福利| 欧美男男青年gay1069videost| 欧美亚洲自拍偷拍| 7777精品伊人久久久大香线蕉完整版 | 亚洲狠狠丁香婷婷综合久久久| 亚洲欧洲三级电影| 亚洲欧美一区二区三区孕妇| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 国产欧美综合在线| 中文字幕日本不卡| 亚洲精品乱码久久久久久| 亚洲成av人在线观看| 蜜桃av一区二区在线观看| 麻豆91小视频| 高清不卡在线观看| 国产.欧美.日韩| 99v久久综合狠狠综合久久| 一本到不卡精品视频在线观看| 欧美在线视频全部完| 欧美一区二区福利在线| 久久婷婷国产综合国色天香| 国产精品情趣视频| 日韩av一二三| 97精品视频在线观看自产线路二| 欧美精品丝袜中出| 欧美国产视频在线| 亚洲第一狼人社区| 99久久伊人精品| 亚洲精品一区二区三区99| 亚洲电影一区二区三区| 国产成人精品一区二区三区网站观看| 一本久久精品一区二区| 久久久久综合网| 久久精品国产在热久久| 欧美日韩一区精品| 国产精品久久久久久久久动漫 | 国产99久久精品| 日韩三级在线观看| 亚洲国产一区二区在线播放| 国产jizzjizz一区二区| 久久一区二区三区四区| 日韩电影免费一区| 欧美一区二区三区在线看| 中文字幕一区视频| 国产电影一区在线| 国产精品色一区二区三区| 国产专区综合网| 国产色产综合产在线视频|