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

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

?? os_task.c

?? ucos252,ucos2.52的源碼包
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#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;
    INT8U        bitx;
    INT8U        bity;
    INT8U        y_old;
#if OS_CRITICAL_METHOD == 3                                     
    OS_CPU_SR    cpu_sr;                                        /* Storage for CPU status register     */



    cpu_sr = 0;                                                 /* Prevent compiler warning            */
#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);
    }                                       
    y                     = newprio >> 3;                       /* Yes, compute new TCB fields         */
    bity                  = OSMapTbl[y];
    x                     = newprio & 0x07;
    bitx                  = OSMapTbl[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) != 0x00) {          /* If task is ready make it not        */
        OSRdyTbl[y_old] &= ~ptcb->OSTCBBitX;
        if (OSRdyTbl[y_old] == 0x00) {
            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 *pd), 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;



    cpu_sr = 0;                              /* Prevent compiler warning                               */
#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 = (OS_STK *)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,
*                        'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
*                        INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
*                        OS_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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合在线免费观看| 色一区在线观看| 91在线云播放| 日韩精品一区二区三区在线播放 | 亚洲久草在线视频| 久久99精品久久久久久| 色综合天天天天做夜夜夜夜做| 欧美大片国产精品| 亚洲成人自拍网| 色婷婷久久综合| 国产精品国产三级国产aⅴ原创| 美女视频黄久久| 91麻豆精品国产无毒不卡在线观看| 国产精品久久夜| 欧美伊人精品成人久久综合97| 国产女人18毛片水真多成人如厕| 欧美a一区二区| 欧美日韩久久不卡| 亚洲一区在线观看免费观看电影高清| 国产成人免费网站| 久久婷婷色综合| 激情综合色综合久久综合| 制服丝袜av成人在线看| 亚洲国产精品麻豆| 欧美日韩国产在线观看| 亚洲一区二区在线免费看| 91福利视频久久久久| 一区二区三区在线视频观看58| 99久久精品免费看国产免费软件| 国产精品亲子乱子伦xxxx裸| 国产91精品欧美| 国产精品乱人伦中文| 成人国产亚洲欧美成人综合网| 国产欧美一区二区在线| 国产伦理精品不卡| 国产香蕉久久精品综合网| 国产激情91久久精品导航| 久久精品亚洲精品国产欧美| 岛国一区二区在线观看| 国产精品欧美一级免费| 99在线精品观看| 一区二区三区中文字幕电影| 欧美午夜影院一区| 日韩电影一二三区| 久久这里都是精品| av在线不卡网| 亚洲超丰满肉感bbw| 日韩丝袜美女视频| 国产露脸91国语对白| 国产精品美女视频| 日本高清无吗v一区| 午夜国产精品影院在线观看| 欧美一个色资源| 国产不卡在线一区| 夜夜嗨av一区二区三区网页| 欧美精品99久久久**| 激情图区综合网| 国产精品免费网站在线观看| 在线视频国内自拍亚洲视频| 蜜乳av一区二区| 中文字幕在线一区二区三区| 欧美日韩视频在线一区二区| 国内成人精品2018免费看| 国产午夜精品一区二区| 色哟哟国产精品免费观看| 免费高清在线一区| 国产精品萝li| 欧美精品高清视频| 成人国产精品免费网站| 偷拍一区二区三区四区| 国产偷国产偷精品高清尤物| 欧美日韩一区二区三区高清| 国产麻豆午夜三级精品| 亚洲大片在线观看| 国产精品成人免费在线| 日韩午夜精品电影| 日本高清视频一区二区| 国产成人在线免费| 天天综合网天天综合色| 国产精品视频在线看| 欧美一区二区三区在线视频| 99久久国产综合精品色伊| 免费高清在线一区| 亚洲午夜一二三区视频| 国产欧美精品一区aⅴ影院| 欧美疯狂做受xxxx富婆| 99国产精品国产精品毛片| 麻豆一区二区三| 亚洲综合av网| 亚洲欧洲av在线| 国产女人18毛片水真多成人如厕| 欧美精品日韩一本| 色菇凉天天综合网| 成人午夜激情在线| 国产精品99精品久久免费| 免费人成网站在线观看欧美高清| 亚洲一区精品在线| 尤物视频一区二区| 国产精品人成在线观看免费| 26uuu色噜噜精品一区| 欧美片在线播放| 欧美最新大片在线看| 99综合影院在线| 成人黄色大片在线观看| 国产成人免费网站| 国产精品一区不卡| 国产精品一级片在线观看| 理论片日本一区| 日韩av一区二区三区四区| 午夜精品福利久久久| 天天色综合成人网| 日韩av一区二区三区四区| 视频一区欧美日韩| 免费人成网站在线观看欧美高清| 日韩高清在线不卡| 日本不卡一二三| 精久久久久久久久久久| 国产一区二区三区高清播放| 国产乱码精品一区二区三区五月婷| 国产一区二区三区蝌蚪| 国产福利一区二区| 成人黄色免费短视频| 99re热视频精品| 欧美亚洲国产怡红院影院| 欧美日韩中字一区| 日韩欧美国产精品| 久久久亚洲精华液精华液精华液| 国产无人区一区二区三区| 国产精品久久久久久福利一牛影视 | 成人aa视频在线观看| a级精品国产片在线观看| 99re成人精品视频| 欧美日韩一区二区在线观看视频| 91精品国产综合久久久蜜臀粉嫩| 欧美一区二区三区思思人| 亚洲精品在线观看网站| 中文成人av在线| 夜夜亚洲天天久久| 精品一区二区在线免费观看| 国产成人av电影在线| 在线观看网站黄不卡| 日韩一级高清毛片| 国产精品免费av| 天堂一区二区在线| 国产成人aaaa| 欧美日韩国产在线播放网站| 久久美女艺术照精彩视频福利播放| 亚洲欧美一区二区在线观看| 午夜久久久影院| 国产精一区二区三区| 色婷婷亚洲婷婷| 欧美mv日韩mv国产网站| 亚洲精品国产一区二区三区四区在线| 日韩av电影天堂| 99久久婷婷国产综合精品电影| 欧美老女人第四色| 亚洲大片在线观看| 亚洲制服欧美中文字幕中文字幕| 18涩涩午夜精品.www| 亚洲一卡二卡三卡四卡| 久久99精品久久久| 日本精品免费观看高清观看| 精品乱码亚洲一区二区不卡| 亚洲午夜电影网| 成人性生交大合| 日韩欧美123| 亚洲图片欧美视频| 成人av网站在线观看| 日韩欧美国产麻豆| 亚洲图片欧美一区| 色综合天天性综合| 亚洲欧美日本韩国| 精品一区精品二区高清| 欧美日韩国产片| 亚洲天堂福利av| 国产成人99久久亚洲综合精品| 日韩视频免费观看高清在线视频| 一区二区三区在线免费播放 | 欧美区在线观看| 亚洲免费在线电影| av成人免费在线观看| 久久亚洲捆绑美女| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美怡红院视频| 亚洲免费资源在线播放| 99vv1com这只有精品| 国产精品无码永久免费888| 国产在线精品一区二区不卡了 | 成人午夜av电影| 26uuu精品一区二区| 日本欧美久久久久免费播放网| 91浏览器在线视频| 国产精品国产自产拍高清av| 国产成人免费在线| 中文字幕欧美日韩一区| 91精品国产入口| 日韩在线一二三区| 91精品国产一区二区| 美女视频黄频大全不卡视频在线播放| 91麻豆精品91久久久久久清纯|