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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? os_task.c

?? 最小的嵌入式操作系統(tǒng)
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                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.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美性感一区二区三区| 成人av中文字幕| 色狠狠综合天天综合综合| 日韩欧美在线网站| 国产精品国产三级国产aⅴ原创 | 欧美人与禽zozo性伦| 国产夜色精品一区二区av| 亚洲成年人影院| 99久久伊人久久99| 日韩美女主播在线视频一区二区三区| 亚洲日本乱码在线观看| 国模娜娜一区二区三区| 欧美日韩国产123区| 亚洲欧美自拍偷拍| 国产一区二区三区| 欧美一三区三区四区免费在线看| 亚洲综合免费观看高清完整版在线| 国产一级精品在线| 欧美一区二区三区人| 一区二区三区精密机械公司| 成人免费不卡视频| 久久久亚洲精品一区二区三区| 日本欧美加勒比视频| 欧美视频在线观看一区二区| 亚洲人成在线观看一区二区| 东方aⅴ免费观看久久av| www精品美女久久久tv| 美女视频第一区二区三区免费观看网站| 欧美日韩久久不卡| 亚洲与欧洲av电影| 色综合网站在线| 亚洲男人天堂一区| 91视频一区二区三区| 综合网在线视频| av成人免费在线观看| 中文字幕免费不卡| 国产精品一二三四五| www一区二区| 黄一区二区三区| 337p日本欧洲亚洲大胆精品| 五月激情综合网| 欧美乱熟臀69xxxxxx| 亚洲国产精品欧美一二99| 在线观看欧美日本| 亚洲自拍偷拍欧美| 欧美三级中文字幕| 亚洲成精国产精品女| 4438成人网| 日本在线不卡视频| 欧美电影精品一区二区| 久久精工是国产品牌吗| 精品国产91乱码一区二区三区 | 一区二区三区四区蜜桃| 一本高清dvd不卡在线观看| 亚洲女性喷水在线观看一区| 色国产综合视频| 亚洲一区二区三区四区的| 欧美欧美欧美欧美| 男女性色大片免费观看一区二区 | 丰满放荡岳乱妇91ww| 国产清纯美女被跳蛋高潮一区二区久久w| 国产高清在线精品| 国产精品乱码久久久久久| 91理论电影在线观看| 亚洲综合图片区| 欧美一级黄色录像| 国产在线精品国自产拍免费| 国产精品美女视频| 在线观看网站黄不卡| 男女激情视频一区| 国产日韩欧美亚洲| 91一区二区三区在线观看| 亚洲成人av中文| 2023国产精品视频| 99久久综合国产精品| 五月天中文字幕一区二区| 亚洲精品在线三区| 日韩欧美不卡一区| 国产夫妻精品视频| 亚洲激情第一区| 日韩一级完整毛片| 成人午夜激情在线| 亚洲午夜一区二区| 欧美精品一区二区三区在线播放| 成人免费毛片片v| 亚洲午夜久久久久久久久久久| 日韩欧美国产综合一区 | 日韩精彩视频在线观看| 久久综合久久99| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产91丝袜在线播放0| 亚洲最色的网站| 精品成a人在线观看| 色天天综合久久久久综合片| 麻豆精品一二三| 亚洲视频网在线直播| 日韩美女天天操| 色婷婷av一区二区三区大白胸 | 亚洲国产婷婷综合在线精品| 精品国产91久久久久久久妲己| 91视频一区二区三区| 理论片日本一区| 亚洲乱码日产精品bd| 日韩精品中午字幕| 色综合久久中文综合久久牛| 免费成人在线网站| 亚洲欧美色图小说| 精品国产乱码久久久久久浪潮| 在线观看免费视频综合| 国产一区二区三区电影在线观看| 亚洲午夜日本在线观看| 国产色综合一区| 6080日韩午夜伦伦午夜伦| 成人激情电影免费在线观看| 美女久久久精品| 一区二区国产盗摄色噜噜| 久久久精品影视| 69成人精品免费视频| 色婷婷激情久久| 成人黄色网址在线观看| 久久激情五月婷婷| 亚洲福利视频一区| 国产精品麻豆欧美日韩ww| 日韩免费电影网站| 欧美日韩精品二区第二页| 波多野结衣亚洲一区| 国产一区激情在线| 日本大胆欧美人术艺术动态| 玉足女爽爽91| 国产精品久久久久久久裸模 | 在线观看日韩电影| www.亚洲色图.com| 国产乱码精品一区二区三区av | 秋霞午夜av一区二区三区| 日韩理论片中文av| 国产精品三级久久久久三级| 精品国产乱码久久久久久久| 欧美精品日韩综合在线| 色综合中文字幕国产| 国产成人精品三级麻豆| 麻豆精品国产传媒mv男同| 日日夜夜精品视频免费| 亚洲国产精品一区二区www在线| 亚洲美女区一区| 国产精品三级在线观看| 国产女同性恋一区二区| 26uuu国产电影一区二区| 欧美videossexotv100| 日韩欧美亚洲一区二区| 欧美精品 国产精品| 欧美日韩精品高清| 欧美猛男超大videosgay| 欧美视频一二三区| 91国偷自产一区二区开放时间| heyzo一本久久综合| 99这里只有久久精品视频| 99热精品一区二区| 99国产精品国产精品毛片| 99视频在线观看一区三区| 99久久精品久久久久久清纯| 不卡一区二区中文字幕| 成人精品国产免费网站| 成人av在线播放网址| 9i在线看片成人免费| 一本到不卡免费一区二区| 色丁香久综合在线久综合在线观看| 99国产精品国产精品毛片| 91麻豆免费观看| 欧美在线免费播放| 欧美日韩激情一区| 91精品在线一区二区| 欧美一二三四在线| 精品福利二区三区| 国产午夜精品一区二区| 中文字幕精品综合| 亚洲精品乱码久久久久久日本蜜臀| 一区二区三区在线免费观看| 亚洲综合无码一区二区| 日日摸夜夜添夜夜添精品视频| 另类小说视频一区二区| 国产一区二区久久| 成人性生交大片免费看在线播放 | 激情亚洲综合在线| 国产不卡免费视频| 一本大道久久a久久综合婷婷| 欧美揉bbbbb揉bbbbb| 欧美大片一区二区三区| 久久亚洲精华国产精华液 | 精品国偷自产国产一区| 国产亚洲va综合人人澡精品| 国产精品家庭影院| 亚洲国产视频一区| 久久精品国产亚洲aⅴ | 国产精品99久久久久| av一区二区久久| 欧美日韩精品是欧美日韩精品| 精品国产髙清在线看国产毛片| 国产精品青草综合久久久久99| 一区二区三区四区中文字幕| 美女高潮久久久|