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

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

?? os_task.c

?? UCOS的源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_TASK.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.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.
*********************************************************************************************************
*/

#if OS_TASK_CHANGE_PRIO_EN > 0
INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR    cpu_sr;
#endif

#if OS_EVENT_EN > 0
    OS_EVENT    *pevent;
#endif

    OS_TCB      *ptcb;
    INT8U        x;
    INT8U        y;
    INT8U        bitx;
    INT8U        bity;



#if OS_ARG_CHK_EN > 0
    if ((oldprio >= OS_LOWEST_PRIO && oldprio != OS_PRIO_SELF)  ||
         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);
    } else {
        OSTCBPrioTbl[newprio] = (OS_TCB *)1;                    /* Reserve the entry to prevent others */
        OS_EXIT_CRITICAL();
        y    = newprio >> 3;                                    /* Precompute to reduce INT. latency   */
        bity = OSMapTbl[y];
        x    = newprio & 0x07;
        bitx = OSMapTbl[x];
        OS_ENTER_CRITICAL();
        if (oldprio == OS_PRIO_SELF) {                          /* See if changing self                */
            oldprio = OSTCBCur->OSTCBPrio;                      /* Yes, get priority                   */
        }
        ptcb = OSTCBPrioTbl[oldprio];
        if (ptcb != (OS_TCB *)0) {                              /* Task to change must exist           */
            OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                /* Remove TCB from old priority        */
            if ((OSRdyTbl[ptcb->OSTCBY] & ptcb->OSTCBBitX) != 0x00) {  /* If task is ready make it not */
                if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0x00) {
                    OSRdyGrp &= ~ptcb->OSTCBBitY;
                }
                OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
                OSRdyTbl[y] |= bitx;
#if OS_EVENT_EN > 0
            } else {
                pevent = ptcb->OSTCBEventPtr;
                if (pevent != (OS_EVENT *)0) {                  /* Remove from event wait list  */
                    if ((pevent->OSEventTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
                        pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
                    }
                    pevent->OSEventGrp    |= bity;              /* Add new priority to wait list       */
                    pevent->OSEventTbl[y] |= bitx;
                }
#endif
            }
            OSTCBPrioTbl[newprio] = ptcb;                       /* Place pointer to TCB @ new priority */
            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);
        } else {
            OSTCBPrioTbl[newprio] = (OS_TCB *)0;                /* Release the reserved prio.          */
            OS_EXIT_CRITICAL();
            return (OS_PRIO_ERR);                               /* Task to change didn't exist         */
        }
    }
}
#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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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)
*********************************************************************************************************
*/

#if OS_TASK_CREATE_EN > 0
INT8U  OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT8U prio)
{
#if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr;
#endif
    OS_STK    *psp;
    INT8U      err;


#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 (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, pdata, 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) {
            OS_ENTER_CRITICAL();
            OSTaskCtr++;                                        /* Increment the #tasks counter        */
            OS_EXIT_CRITICAL();
            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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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.  'pstk' 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.
*                       For example, this user memory can hold the contents of floating-point registers
*                       during a context switch, the time each task takes to execute, the number of times
*                       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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩激情av在线| 欧美图区在线视频| 91福利区一区二区三区| 日韩欧美一级二级| 自拍偷拍欧美激情| 激情五月激情综合网| 在线欧美日韩精品| 欧美精品一区在线观看| 亚洲小少妇裸体bbw| 欧美一级夜夜爽| 亚洲欧美激情一区二区| 国产美女精品一区二区三区| 欧美女孩性生活视频| 亚洲人妖av一区二区| 国产成人免费网站| 欧美一区二区三区在线观看| 亚洲一区电影777| 99久久99久久精品免费观看| 久久色.com| 国产一区欧美二区| 日韩欧美卡一卡二| 日韩电影在线一区二区三区| 精品视频在线免费| 亚洲老司机在线| 91在线国产观看| 1024亚洲合集| 99久久精品免费看国产 | 18成人在线视频| 国产高清精品久久久久| 欧美精品一区二区三区四区| 日本午夜精品视频在线观看| 在线播放日韩导航| 一区二区三区蜜桃网| 91小视频免费看| 亚洲欧美激情视频在线观看一区二区三区| 国产精品白丝av| 国产日韩影视精品| 国产激情视频一区二区在线观看| 精品国产伦一区二区三区观看体验 | 国产麻豆午夜三级精品| 精品免费国产二区三区| 另类小说图片综合网| 日韩精品在线网站| 激情久久五月天| 久久久99精品免费观看不卡| 国产精品亚洲专一区二区三区 | 欧美日韩一区成人| 亚洲成人高清在线| 日韩欧美中文字幕一区| 久久成人18免费观看| 久久久久高清精品| 99麻豆久久久国产精品免费优播| 亚洲人精品午夜| 欧美在线影院一区二区| 欧美96一区二区免费视频| 精品欧美久久久| 99精品视频在线播放观看| 一区二区三区在线高清| 3atv在线一区二区三区| 国产麻豆日韩欧美久久| 一区二区三区久久久| 欧美一级欧美三级| 国产91在线|亚洲| 一区二区三区在线看| 日韩一区二区中文字幕| 99视频精品全部免费在线| 亚洲福利视频导航| 久久午夜羞羞影院免费观看| 一本色道亚洲精品aⅴ| 日本成人中文字幕在线视频| 国产女同性恋一区二区| 欧美在线一区二区| 国产一区二区电影| 亚洲va中文字幕| 中文字幕va一区二区三区| 7777精品久久久大香线蕉| 国产激情91久久精品导航| 亚洲国产你懂的| 国产精品不卡一区| 日韩视频一区二区三区在线播放| 波多野结衣一区二区三区| 蜜臀久久久久久久| 一区二区三区日韩| 国产女同互慰高潮91漫画| 91麻豆精品国产91久久久久久| 粉嫩一区二区三区在线看| 免费一级片91| 亚洲一区在线视频| 中文字幕第一区| 欧美成人猛片aaaaaaa| 欧美亚洲精品一区| 99久久er热在这里只有精品15 | 不卡一区二区三区四区| 美女脱光内衣内裤视频久久网站 | 美女一区二区久久| 亚洲第一av色| 一区二区三区日韩在线观看| 中文一区一区三区高中清不卡| 日韩免费看网站| 欧美放荡的少妇| 欧美三级电影网站| 色综合久久天天| a在线播放不卡| 大陆成人av片| 国产成人aaaa| 国产乱人伦偷精品视频免下载| 婷婷中文字幕综合| 亚洲成人综合在线| 亚洲va国产天堂va久久en| 亚洲午夜精品一区二区三区他趣| 亚洲色图制服诱惑| 中文字幕一区免费在线观看| 亚洲国产精品99久久久久久久久| 精品国产污污免费网站入口| 精品日韩99亚洲| 精品国产乱码久久久久久老虎 | 亚洲电影一级黄| 亚洲精品免费一二三区| 亚洲男人的天堂在线观看| 亚洲日本青草视频在线怡红院| 国产精品素人一区二区| 国产精品理伦片| 亚洲日本在线看| 亚洲女人的天堂| 夜夜揉揉日日人人青青一国产精品 | 亚洲国产人成综合网站| 亚洲图片自拍偷拍| 日日摸夜夜添夜夜添精品视频| 视频一区二区三区在线| 日韩激情av在线| 狠狠久久亚洲欧美| 成人福利视频网站| 91美女精品福利| 欧美午夜影院一区| 日韩一二三四区| 国产日本欧洲亚洲| 亚洲欧美日韩国产另类专区| 亚洲成人你懂的| 韩国成人在线视频| 成人精品一区二区三区中文字幕| 99精品桃花视频在线观看| 欧美三级电影一区| www国产精品av| 1000精品久久久久久久久| 亚洲成人av在线电影| 美女网站在线免费欧美精品| 国产高清不卡一区| 欧美亚洲动漫精品| 精品国产乱码久久久久久老虎 | 精品国产免费久久| 国产精品每日更新在线播放网址 | 国产精品无圣光一区二区| 亚洲欧美另类在线| 美日韩黄色大片| 9久草视频在线视频精品| 4hu四虎永久在线影院成人| 国产亚洲一区字幕| 性感美女极品91精品| 国产精品1024久久| 欧美老年两性高潮| 国产精品午夜免费| 日本网站在线观看一区二区三区 | 久久精品噜噜噜成人av农村| 波多野结衣一区二区三区| 91精品国产综合久久久蜜臀图片| 日本一区二区三区在线观看| 婷婷久久综合九色综合绿巨人 | 激情综合色播五月| 在线观看不卡视频| 国产精品视频观看| 蜜桃视频一区二区三区在线观看| 91视频免费观看| 久久精品视频免费| 麻豆成人91精品二区三区| 色播五月激情综合网| 久久精品欧美一区二区三区不卡| 五月婷婷色综合| 91在线无精精品入口| 国产网站一区二区| 另类欧美日韩国产在线| 欧美日韩电影一区| 一区二区三区欧美在线观看| 国产 日韩 欧美大片| 精品美女一区二区| 丝袜美腿亚洲一区二区图片| 91在线国内视频| 国产精品国产a| 国产99一区视频免费| 久久无码av三级| 国产一区欧美日韩| 亚洲精品在线观看视频| 麻豆91精品91久久久的内涵| 欧美日韩黄色影视| 亚洲成av人影院| 欧美日韩中文一区| 亚洲午夜精品一区二区三区他趣| 色综合色综合色综合| 亚洲制服丝袜av| 欧美日韩在线观看一区二区 | 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 |