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

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

?? os_task.c

?? 我現在需要看幾個論文。。今年馬上畢業。。急著用
?? 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一区二区三区免费野_久草精品视频
一区二区三区欧美| 日韩三级av在线播放| 久久成人免费日本黄色| 亚洲国产日韩在线一区模特| 亚洲欧洲日本在线| 国产精品久久久久毛片软件| 国产三级久久久| 国产欧美日韩精品一区| www精品美女久久久tv| 欧美va日韩va| 久久精品人人爽人人爽| 精品久久一区二区三区| 欧美大胆一级视频| 欧美一区二区日韩一区二区| 欧美一区二区日韩一区二区| 精品久久久久久久人人人人传媒 | 中文在线免费一区三区高中清不卡| 精品动漫一区二区三区在线观看| 欧美一区二区三区视频在线观看| 欧美老肥妇做.爰bbww视频| 欧美日本在线看| 日韩午夜电影在线观看| 久久久久久久综合日本| 国产精品午夜在线| 亚洲免费观看高清| 天天色天天操综合| 国产精品自在在线| 91视频在线观看免费| 色综合久久中文综合久久牛| 欧美日韩一区在线观看| 久久亚洲综合av| 亚洲欧洲精品天堂一级 | 国产日韩欧美在线一区| 国产精品久久久久9999吃药| 亚洲一区二区三区视频在线| 伦理电影国产精品| 99re热视频精品| 在线不卡一区二区| 国产欧美一区二区精品仙草咪| 亚洲视频你懂的| 久久99精品久久久久久动态图| 成人丝袜高跟foot| 91精品在线麻豆| 国产精品久久久久久久蜜臀| 欧美a一区二区| 91小视频在线| 精品国内二区三区| 亚洲午夜激情网页| 国产综合久久久久久久久久久久 | 欧美午夜不卡在线观看免费| 精品成a人在线观看| 亚洲精品免费看| 国产精品一区二区在线观看不卡| 欧美视频在线观看一区| 国产精品久久久久久福利一牛影视 | 亚洲少妇30p| 裸体健美xxxx欧美裸体表演| 色先锋久久av资源部| 欧美精品一区二区三区在线| 自拍偷拍亚洲激情| 国产成人精品免费视频网站| 91麻豆精品国产91久久久久久| 亚洲色图色小说| 风流少妇一区二区| 26uuu精品一区二区| 日韩av一级电影| 欧美私模裸体表演在线观看| 亚洲欧美激情小说另类| jlzzjlzz国产精品久久| 久久久久久99久久久精品网站| 麻豆精品视频在线观看视频| 欧美精品v日韩精品v韩国精品v| 亚洲欧美日韩国产一区二区三区| 国产成人精品免费在线| 精品少妇一区二区三区视频免付费 | 中文字幕一区二区日韩精品绯色 | 国产精品福利影院| 国产盗摄一区二区| 久久精品人人做| 成人激情午夜影院| 国产精品毛片高清在线完整版| 国产精品一二三四区| 欧美精品一区二区三区蜜桃视频 | 亚欧色一区w666天堂| 在线观看av不卡| 一区二区三区av电影| 欧美亚洲综合在线| 亚洲欧美日韩电影| 色婷婷综合激情| 午夜久久久影院| 日韩一区二区免费电影| 激情综合五月天| 国产香蕉久久精品综合网| 成人夜色视频网站在线观看| 中文字幕一区二区三| 在线观看亚洲成人| 日韩精品一二三区| 欧美成人精品1314www| 国产麻豆一精品一av一免费| 欧美激情自拍偷拍| 日本道在线观看一区二区| 天天综合日日夜夜精品| 精品国产91九色蝌蚪| av在线不卡免费看| 天堂一区二区在线| 久久欧美一区二区| 色偷偷成人一区二区三区91| 日本不卡一区二区三区高清视频| 欧美电视剧在线观看完整版| 成年人网站91| 日韩—二三区免费观看av| 2014亚洲片线观看视频免费| 99久久99久久精品国产片果冻| 亚洲第一综合色| 久久久久久夜精品精品免费| 色婷婷久久久综合中文字幕| 久久精品国产久精国产| 亚洲日本成人在线观看| 欧美一级欧美一级在线播放| av影院午夜一区| 麻豆免费精品视频| 亚洲综合偷拍欧美一区色| 久久综合久久鬼色| 欧美日免费三级在线| 丰满少妇久久久久久久| 午夜精品久久久久久久蜜桃app| 国产欧美日韩精品a在线观看| 欧美日韩精品一区二区在线播放| 国产精品一区二区在线观看不卡 | av男人天堂一区| 免费成人小视频| 亚洲无线码一区二区三区| 国产精品少妇自拍| 日韩免费视频线观看| 在线观看一区日韩| 成人福利视频网站| 狠狠色综合日日| 视频精品一区二区| 一区二区激情小说| 国产精品久久久久久妇女6080| 日韩午夜激情av| 91精品国产综合久久国产大片| 91视频91自| 97精品国产露脸对白| 国产成人精品综合在线观看 | 99视频一区二区| 国产大陆精品国产| 国内精品写真在线观看| 久久爱www久久做| 人人精品人人爱| 三级在线观看一区二区| 丝袜国产日韩另类美女| 亚洲综合色在线| 亚洲国产成人91porn| 一区二区三区不卡视频在线观看| 中文字幕一区二区视频| 亚洲欧洲性图库| 亚洲男人的天堂在线观看| 国产精品久久久久一区二区三区| 欧美激情中文字幕| 国产精品三级av| 日本一区二区三区视频视频| 国产欧美精品国产国产专区| 国产欧美日产一区| 国产精品素人视频| 亚洲欧美激情小说另类| 亚洲综合一二三区| 亚洲成a人v欧美综合天堂下载 | 日韩一区二区在线观看视频| 欧美日韩在线三级| 欧美一区二区三区四区在线观看| 7777女厕盗摄久久久| 日韩欧美卡一卡二| 久久久久久97三级| 中文字幕一区视频| 一个色综合网站| 五月综合激情婷婷六月色窝| 奇米一区二区三区av| 狠狠色丁香久久婷婷综合_中| 国产成人av电影在线| 91丨九色丨黑人外教| 欧美另类变人与禽xxxxx| 欧美电影免费观看高清完整版在| 国产亚洲女人久久久久毛片| 国产精品传媒在线| 五月综合激情网| 国产91在线看| 欧美日韩色一区| 国产亚洲欧美日韩在线一区| 亚洲精品高清在线| 久久99精品久久久久婷婷| 99久久精品国产网站| 欧美肥胖老妇做爰| 国产精品情趣视频| 日本中文一区二区三区| 岛国精品在线观看| 制服丝袜激情欧洲亚洲| 国产精品免费视频网站| 天天色综合天天| 97久久久精品综合88久久|