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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? os_task.c

?? 大家快來下載。這是目前最新管方版本了,Micrium-uCOS-II-V284.zip
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.84
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
*********************************************************************************************************
*/

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

/*$PAGE*/
/*
*********************************************************************************************************
*                                        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_ERR_NONE            is the call was successful
*              OS_ERR_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                     (i.e. >= OS_LOWEST_PRIO)
*              OS_ERR_PRIO_EXIST      if the new priority already exist.
*              OS_ERR_PRIO            there is no task with the specified OLD priority (i.e. the OLD task does
*                                     not exist.
*              OS_ERR_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_ERR_PRIO_INVALID);
        }
    }
    if (newprio >= OS_LOWEST_PRIO) {
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {                 /* New priority must not already exist */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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_ERR_PRIO);
    }
    if (ptcb == (OS_TCB *)1) {                                  /* Is task assigned to Mutex           */
        OS_EXIT_CRITICAL();                                     /* No, can't change its priority!      */
        return (OS_ERR_TASK_NOT_EXIST);
    }
#if OS_LOWEST_PRIO <= 63
    y                     = (INT8U)(newprio >> 3);              /* Yes, compute new TCB fields         */
    x                     = (INT8U)(newprio & 0x07);
    bity                  = (INT8U)(1 << y);
    bitx                  = (INT8U)(1 << x);
#else
    y                     = (INT8U)((newprio >> 4) & 0x0F);
    x                     = (INT8U)( newprio & 0x0F);
    bity                  = (INT16U)(1 << y);
    bitx                  = (INT16U)(1 << x);
#endif

    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
    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();
    if (OSRunning == OS_TRUE) {
        OS_Sched();                                             /* Find new highest priority task      */
    }
    return (OS_ERR_NONE);
}
#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_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.
*********************************************************************************************************
*/

#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_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 *)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_ERR_NONE) {
            if (OSRunning == OS_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_ERR_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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区性视频| 狠狠狠色丁香婷婷综合久久五月| 精品区一区二区| 欧美日韩的一区二区| 91福利社在线观看| 在线视频中文字幕一区二区| av不卡免费电影| 99久久伊人网影院| 成人h动漫精品一区二区| 处破女av一区二区| 丰满放荡岳乱妇91ww| 高清日韩电视剧大全免费| 成人视屏免费看| 99国产精品国产精品久久| 成人国产视频在线观看| 99久久99精品久久久久久| 在线这里只有精品| 欧美日韩一级大片网址| 国产日韩欧美综合在线| 国产色产综合色产在线视频| 日本一二三四高清不卡| 亚洲桃色在线一区| 亚洲电影视频在线| 激情综合亚洲精品| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 国产精品色哟哟网站| 国产精品乱码一区二三区小蝌蚪| √…a在线天堂一区| 亚洲综合激情另类小说区| 日一区二区三区| 国产成人一级电影| 一本到不卡免费一区二区| 91精品国产欧美一区二区| 国产日韩精品久久久| 亚洲综合小说图片| 国产资源在线一区| 色综合天天性综合| 欧美一区二区三区精品| 国产精品狼人久久影院观看方式| 亚洲综合在线五月| 激情综合色综合久久| 91在线无精精品入口| 日韩欧美中文字幕一区| 亚洲欧洲精品天堂一级 | 奇米一区二区三区| 大陆成人av片| 欧美肥妇毛茸茸| 国产精品系列在线| 日韩国产精品久久久久久亚洲| 国产精品一卡二| 在线不卡中文字幕| 中文字幕在线视频一区| 九色|91porny| 欧美手机在线视频| 国产精品国产a级| 久久精品久久综合| 欧美视频精品在线| 中文字幕视频一区二区三区久| 麻豆国产精品一区二区三区| 一本色道a无线码一区v| 久久久亚洲国产美女国产盗摄 | 性久久久久久久久久久久| 国产精品资源网| 日韩三级中文字幕| 亚洲午夜av在线| 色综合久久中文综合久久牛| 国产亚洲综合在线| 久久国产精品99精品国产| 欧美另类一区二区三区| 一区二区日韩av| 91啦中文在线观看| 国产精品久久精品日日| 国产精品亚洲综合一区在线观看| 日韩欧美在线1卡| 美女视频网站久久| 日韩一区二区三区免费观看| 亚洲一卡二卡三卡四卡| 欧美这里有精品| 亚洲精品高清在线观看| 一本色道a无线码一区v| 亚洲另类春色校园小说| 91视频在线看| 亚洲激情第一区| 91国模大尺度私拍在线视频| 亚洲欧洲精品一区二区精品久久久 | 国产一区二区主播在线| 日韩亚洲欧美综合| 久久精品国产在热久久| 欧美tickling挠脚心丨vk| 精油按摩中文字幕久久| 欧美精品一区二区久久久| 国产一区二区三区免费| 日本一区二区三区免费乱视频| 国产69精品久久777的优势| 亚洲国产精品国自产拍av| 成人综合婷婷国产精品久久免费| 国产精品久久久久桃色tv| 99re66热这里只有精品3直播| 亚洲精品中文字幕乱码三区| 欧美亚洲日本一区| 久久国内精品自在自线400部| 精品国偷自产国产一区| 国产白丝网站精品污在线入口| 中文字幕av一区 二区| 色综合一区二区| 亚洲第一在线综合网站| www国产亚洲精品久久麻豆| 国产91精品一区二区麻豆网站| 亚洲天堂2016| 日韩西西人体444www| 粉嫩一区二区三区在线看| 亚洲欧美激情在线| 日韩午夜激情电影| www.激情成人| 日本亚洲一区二区| 欧美激情一二三区| 在线精品视频一区二区| 极品瑜伽女神91| 亚洲精品中文在线| 久久综合狠狠综合久久激情| 99国产一区二区三精品乱码| 免费成人在线播放| 国产精品国产三级国产专播品爱网| 欧美三日本三级三级在线播放| 国模套图日韩精品一区二区 | 成人欧美一区二区三区在线播放| 欧美日韩精品综合在线| 国产91精品露脸国语对白| 三级欧美在线一区| 亚洲色图欧美激情| 久久综合丝袜日本网| 欧美视频在线一区二区三区| 国产米奇在线777精品观看| 亚洲成av人在线观看| 国产精品你懂的在线欣赏| 日韩欧美国产1| 欧美影院精品一区| 91色在线porny| 国产老女人精品毛片久久| 亚洲福利电影网| 伊人婷婷欧美激情| 国产精品拍天天在线| 精品少妇一区二区| 欧美一区二区视频在线观看2020 | 亚洲一区二区在线观看视频| 久久精品网站免费观看| 日韩色在线观看| 欧美日韩色一区| 欧美自拍丝袜亚洲| 99久久亚洲一区二区三区青草| 国产在线精品视频| 激情文学综合网| 免费成人av资源网| 日韩成人精品在线| 午夜国产精品一区| 午夜视频在线观看一区二区三区| 亚洲日本丝袜连裤袜办公室| 国产精品久线观看视频| 亚洲大片精品永久免费| 成人欧美一区二区三区在线播放| 中日韩av电影| 亚洲色图一区二区三区| 中文字幕不卡的av| 亚洲特黄一级片| 亚洲激情网站免费观看| 夜夜夜精品看看| 亚洲第一久久影院| 三级在线观看一区二区| 麻豆国产精品视频| 国产电影一区二区三区| 国产不卡高清在线观看视频| hitomi一区二区三区精品| 91在线精品一区二区三区| 一本到一区二区三区| 欧美综合一区二区| 欧美一区二区三区啪啪| 欧美电影免费观看高清完整版在线 | 青青草精品视频| 精品亚洲aⅴ乱码一区二区三区| 国精产品一区一区三区mba桃花| 国产精品一级在线| 91久久免费观看| 欧美高清hd18日本| 精品福利视频一区二区三区| 久久精品人人做人人爽人人| 中文字幕欧美一| 七七婷婷婷婷精品国产| 国产精品1区二区.| 欧美中文字幕一区| 精品久久国产老人久久综合| 国产精品乱码人人做人人爱| 亚洲成人av一区二区三区| 久久国产综合精品| 91亚洲国产成人精品一区二三| 欧美日本一道本| 中文字幕精品—区二区四季| 五月天激情综合| 岛国精品在线播放| 日韩一区二区三区观看| 亚洲精品欧美专区|