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

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

?? os_task.c

?? 一個輕量tcpip協(xié)議在移植在ucOS2系統(tǒng)上運行
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2001, 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                   */
        }
        if ((ptcb = OSTCBPrioTbl[oldprio]) != (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 {
                if ((pevent = ptcb->OSTCBEventPtr) != (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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区在线观看免费视频| 日韩片之四级片| 欧美日韩久久不卡| 国产片一区二区| 五月综合激情婷婷六月色窝| 国产成人av资源| 91麻豆精品国产自产在线观看一区 | 欧美不卡视频一区| 亚洲乱码国产乱码精品精98午夜 | 亚洲综合久久av| 国产69精品久久777的优势| 欧美精品99久久久**| 国产精品国产成人国产三级| 国产在线播精品第三| 91精品国产色综合久久久蜜香臀| 亚洲精品视频在线看| 高清av一区二区| 久久午夜电影网| 韩国理伦片一区二区三区在线播放| 欧美美女黄视频| 亚洲一区二区精品3399| 91小视频在线观看| 国产精品视频一区二区三区不卡| 麻豆精品久久久| 欧美一区二区日韩| 日日嗨av一区二区三区四区| 91成人免费网站| 亚洲精品免费在线| 一本一本大道香蕉久在线精品| 国产欧美日韩不卡免费| 国产高清不卡一区| 久久精品人人做人人综合 | 成人午夜免费电影| 久久久久久久久久久电影| 激情欧美日韩一区二区| 久久麻豆一区二区| 国产精品一区二区久久不卡| 久久久精品日韩欧美| 成人久久久精品乱码一区二区三区| 国产偷国产偷亚洲高清人白洁 | 久久久久久久精| 国产精品综合久久| 国产精品第13页| 日本道精品一区二区三区| 亚洲精品成人在线| 91精品国产欧美日韩| 久久福利视频一区二区| 国产欧美一区二区精品性色| 成人精品国产一区二区4080| 中文字幕一区视频| 欧美视频一区二区| 久久爱另类一区二区小说| 国产亚洲精品aa午夜观看| 国v精品久久久网| 亚洲免费观看高清| 91精品国产91综合久久蜜臀| 精品亚洲成a人| 亚洲国产精品黑人久久久| 91国产视频在线观看| 日本va欧美va精品发布| 久久在线观看免费| 欧美综合在线视频| 久久精品99国产精品日本| 日韩理论在线观看| 欧美一区二区三区四区高清| 国产91在线观看丝袜| 国产麻豆欧美日韩一区| 日韩成人一区二区| 欧美日韩激情一区二区三区| 另类小说一区二区三区| 国产欧美综合在线观看第十页| 色综合天天综合| 久久99精品一区二区三区| 1区2区3区欧美| 精品美女一区二区| 日本高清成人免费播放| 国产综合久久久久久久久久久久| 亚洲免费伊人电影| 精品福利一区二区三区免费视频| 91亚洲精品一区二区乱码| 久久99热国产| 亚洲一区二区欧美日韩| 国产欧美日韩综合| 日韩免费观看2025年上映的电影 | www精品美女久久久tv| 在线观看免费亚洲| 成人综合婷婷国产精品久久蜜臀| 日本午夜精品视频在线观看| 亚洲人成网站色在线观看| 精品久久久久久久一区二区蜜臀| 色噜噜偷拍精品综合在线| 国产麻豆欧美日韩一区| 男人的j进女人的j一区| 一个色综合网站| 国产精品人妖ts系列视频| 精品日韩在线观看| 欧美日韩国产免费一区二区 | 国产精品一品视频| 奇米色一区二区| 日韩精品色哟哟| 性做久久久久久久免费看| 亚洲人成在线播放网站岛国| 国产清纯白嫩初高生在线观看91 | 国产精品一级黄| 激情综合色播五月| 久久成人免费电影| 久久福利视频一区二区| 蜜臀av一区二区在线免费观看| 亚洲一区二区三区四区的 | 国产精品久久久久久久久动漫| 久久久久久免费毛片精品| 精品播放一区二区| 欧美精品一区二区三区蜜桃视频| 6080国产精品一区二区| 3d动漫精品啪啪| 欧美一区二区视频在线观看2020| 欧美一区二区播放| 精品日韩av一区二区| 精品国产3级a| 国产日产欧产精品推荐色| 久久久国产精品午夜一区ai换脸| 久久久亚洲国产美女国产盗摄 | av午夜精品一区二区三区| 99国产精品国产精品毛片| 91色porny在线视频| 91无套直看片红桃| 欧美日韩免费观看一区二区三区| 欧美综合天天夜夜久久| 欧美日本在线看| 日韩精品一区二区三区中文精品 | 亚洲人午夜精品天堂一二香蕉| 亚洲日本va午夜在线影院| 亚洲美女免费视频| 亚洲18女电影在线观看| 九九**精品视频免费播放| 国产激情一区二区三区| 91色视频在线| 日韩三级免费观看| 国产欧美一区二区在线| 亚洲自拍偷拍麻豆| 久久精品国产999大香线蕉| 成人亚洲精品久久久久软件| 一本大道久久a久久精品综合| 欧美日本国产视频| 久久综合色8888| 亚洲精品国产一区二区精华液 | 欧美精品一区在线观看| 国产精品欧美久久久久无广告| 亚洲一区av在线| 国产精品主播直播| 欧美视频三区在线播放| 国产夜色精品一区二区av| 亚洲国产日韩在线一区模特| 精彩视频一区二区| 欧美三区在线观看| 国产亚洲欧洲一区高清在线观看| 夜夜精品浪潮av一区二区三区| 麻豆91精品视频| 色综合 综合色| 久久久久久久久久久久电影| 亚洲国产日韩在线一区模特| 国产福利一区在线| 欧美一区二区三区免费| 亚洲色图欧美激情| 国内精品写真在线观看| 欧美性视频一区二区三区| 中文字幕精品—区二区四季| 奇米色一区二区三区四区| 色综合 综合色| 久久久精品免费观看| 青青草91视频| 欧美日韩国产免费一区二区| 国产精品入口麻豆九色| 极品少妇xxxx精品少妇偷拍| 欧美色手机在线观看| 国产精品传媒视频| 国产成人自拍网| 久久这里只有精品首页| 美女网站视频久久| 欧美在线免费视屏| 最新高清无码专区| 成人综合婷婷国产精品久久| 日韩你懂的在线播放| 日韩激情av在线| 欧美情侣在线播放| 亚洲动漫第一页| 91黄色免费观看| 亚洲欧洲综合另类在线| 99re视频精品| 国产精品初高中害羞小美女文| 国产aⅴ综合色| 久久精品亚洲乱码伦伦中文| 狠狠色伊人亚洲综合成人| 日韩欧美成人一区二区| 欧美aⅴ一区二区三区视频| 日韩一区二区在线看| 麻豆成人免费电影| 精品福利av导航| 国产成人免费av在线| 国产精品久久久久影院色老大|