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

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

?? os_task.c

?? uCOS 嵌入式操作系統(tǒng)的改進(jìn)版,增加了網(wǎng)絡(luò)通訊.
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                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) reentrant //using 0
{
#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;
    INT8U        y_old;


#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);
    }                                       
    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 > 0
    } 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
*
*              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 *pndata, OS_STK *ptos, INT8U prio) reentrant //using 0
{
#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, pndata, 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).  '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.
*                       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.
*
* 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)
*********************************************************************************************************
*/
/*$PAGE*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskCreateExt (void   (*task)(void *pd),
                        void    *pndata,
                        OS_STK  *ptos,
                        INT8U    prio,
                        INT16U   id,
                        OS_STK  *pbos,
                        INT32U   stk_size,
                        void    *pext,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
秋霞国产午夜精品免费视频| 日韩免费看的电影| 亚洲三级电影网站| 色悠久久久久综合欧美99| 亚洲午夜日本在线观看| 欧美一区二区免费视频| 精品无人区卡一卡二卡三乱码免费卡 | 国产欧美日韩久久| 91免费观看视频在线| 亚洲国产另类精品专区| 欧美成人精品1314www| 国产成人8x视频一区二区| 亚洲欧美日韩一区| 欧美老女人在线| 国产乱国产乱300精品| 日韩美女视频19| 制服丝袜亚洲色图| 成人污视频在线观看| 亚洲一区二区三区四区在线| 欧美一卡2卡3卡4卡| 波多野结衣欧美| 亚洲gay无套男同| 国产婷婷色一区二区三区| 日韩一区二区在线观看| 成人精品国产福利| 午夜久久福利影院| 中文字幕在线不卡国产视频| 3751色影院一区二区三区| 国产91精品一区二区| 亚洲成av人在线观看| 国产日韩欧美精品一区| 欧美日韩一区小说| 成人sese在线| 美日韩一区二区| ...xxx性欧美| 精品精品国产高清a毛片牛牛| 高清成人免费视频| 日韩成人免费看| 亚洲免费在线观看视频| 精品国产sm最大网站| 色哟哟一区二区| 粉嫩aⅴ一区二区三区四区五区| 亚洲 欧美综合在线网络| 久久九九久久九九| 欧美一区二区三区视频在线 | 99久久99久久精品免费看蜜桃| 日本大胆欧美人术艺术动态| 自拍偷在线精品自拍偷无码专区| 欧美一区二区三区日韩| 91精品91久久久中77777| 国产一区二区三区四区五区入口| 五月天亚洲精品| 亚洲精选视频在线| 国产精品三级在线观看| 26uuu色噜噜精品一区| 欧美日韩国产精品自在自线| 99精品久久只有精品| 国产成人av一区| 国产一区免费电影| 国产在线精品一区在线观看麻豆| 午夜电影一区二区| 亚洲电影在线免费观看| 亚洲精品乱码久久久久久黑人| 国产欧美一区二区三区沐欲| 久久久久久电影| 精品国产乱码久久久久久浪潮 | 日韩午夜激情免费电影| 欧美日韩一区 二区 三区 久久精品| 99riav久久精品riav| jlzzjlzz亚洲女人18| 国产成人av电影在线| 国产夫妻精品视频| 国产精品69毛片高清亚洲| 国产永久精品大片wwwapp| 激情五月播播久久久精品| 免费观看在线色综合| 裸体健美xxxx欧美裸体表演| 日本色综合中文字幕| 日韩av一级片| 捆绑紧缚一区二区三区视频| 久久精品久久99精品久久| 韩国理伦片一区二区三区在线播放| 蜜臀精品久久久久久蜜臀| 另类中文字幕网| 国产精选一区二区三区| 国产91在线观看| 成年人午夜久久久| 欧美性xxxxx极品少妇| 欧美美女一区二区| 日韩免费电影网站| 国产亚洲一区二区在线观看| 欧美国产激情一区二区三区蜜月| 国产精品久久久久久久久免费樱桃 | 高清久久久久久| 色婷婷亚洲综合| 9191国产精品| 2023国产精品| 亚洲欧美乱综合| 亚洲电影第三页| 极品销魂美女一区二区三区| 成人h动漫精品| 欧美视频一区二区在线观看| 91精品国产免费| 日本一区二区免费在线| 亚洲一区在线视频| 精品一区二区在线看| 成人激情小说网站| 欧美精品高清视频| 久久久国产精品麻豆| 夜夜精品视频一区二区| 九九九精品视频| 成人av影视在线观看| 欧美日韩国产综合视频在线观看| 久久综合av免费| 亚洲一级不卡视频| 国产精品中文字幕日韩精品| 色成人在线视频| 精品sm捆绑视频| 亚洲国产综合在线| 成人综合在线观看| 欧美疯狂做受xxxx富婆| 国产情人综合久久777777| 亚洲成av人片一区二区三区| 国产乱妇无码大片在线观看| 欧美午夜精品一区| 久久一区二区视频| 亚洲成av人影院在线观看网| 成人av高清在线| 欧美大胆一级视频| 亚洲第一电影网| zzijzzij亚洲日本少妇熟睡| 日韩欧美一区二区免费| 一区二区三区久久久| 国产精品66部| 欧美一级爆毛片| 亚洲国产日韩在线一区模特| 国产99久久精品| 日韩精品一区二区三区在线播放| 亚洲综合999| 不卡的av网站| 久久久.com| 极品少妇xxxx精品少妇偷拍| 欧美区在线观看| 亚洲一区二区综合| 91在线看国产| 国产精品久久久久永久免费观看 | 日韩在线卡一卡二| 色久优优欧美色久优优| 国产精品国产a| 国产成人精品影院| 久久婷婷一区二区三区| 蜜臀久久99精品久久久画质超高清| 欧美日韩不卡一区二区| 亚洲蜜臀av乱码久久精品| 成人高清在线视频| 国产日韩欧美麻豆| 国产福利不卡视频| 国产三级精品视频| 国产999精品久久久久久| 国产偷国产偷亚洲高清人白洁| 国产一区91精品张津瑜| 精品国产伦一区二区三区观看方式| 人禽交欧美网站| 欧美一区二区三区精品| 日韩av中文字幕一区二区| 欧美一级理论性理论a| 蜜臀av性久久久久蜜臀aⅴ流畅| 91精品免费观看| 日韩高清在线不卡| 欧美另类变人与禽xxxxx| 亚洲123区在线观看| 69久久99精品久久久久婷婷| 日韩成人午夜精品| 精品国产精品网麻豆系列| 久久av资源网| 久久久久久毛片| 国产福利精品导航| 综合久久国产九一剧情麻豆| 一本久久综合亚洲鲁鲁五月天| 亚洲自拍偷拍综合| 7777女厕盗摄久久久| 激情五月播播久久久精品| 国产精品美女久久久久久久久久久| 播五月开心婷婷综合| 亚洲一区二区五区| 日韩网站在线看片你懂的| 国产麻豆一精品一av一免费| 日本一区二区动态图| 色天使色偷偷av一区二区| 五月天丁香久久| 久久亚洲私人国产精品va媚药| 波多野结衣一区二区三区| 亚洲电影一区二区| 久久女同精品一区二区| 99精品热视频| 日韩综合一区二区| 国产亚洲婷婷免费| 91久久精品一区二区三| 男人的j进女人的j一区| 国产精品国产三级国产有无不卡 |