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

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

?? os_task.c

?? ARM7TDMI軟件模擬器
?? 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一区二区三区免费野_久草精品视频
亚洲丝袜自拍清纯另类| 国产精品入口麻豆九色| 菠萝蜜视频在线观看一区| 色呦呦国产精品| 国产iv一区二区三区| 久久精品国产久精国产| 亚洲成人一二三| 亚洲国产精品久久人人爱| 亚洲欧洲美洲综合色网| 久久久精品影视| 国产日韩欧美一区二区三区综合| 亚洲欧美经典视频| 秋霞影院一区二区| 蜜桃av噜噜一区| 精品中文字幕一区二区| 久久99国内精品| 韩国毛片一区二区三区| 国产九色精品成人porny| 国内精品第一页| 国产xxx精品视频大全| 国产成人精品影视| 91在线云播放| 欧美日韩成人高清| 精品久久久久av影院| 国产午夜精品一区二区三区嫩草| 国产亚洲一区字幕| 欧美极品少妇xxxxⅹ高跟鞋| 国产精品美女一区二区在线观看| 久草中文综合在线| 不卡电影免费在线播放一区| 色老汉一区二区三区| 在线电影院国产精品| 精品久久久久久亚洲综合网| 国产精品久久久久一区二区三区| 亚洲久草在线视频| 久久精品国产99久久6| 99久久精品国产网站| 制服视频三区第一页精品| 国产欧美一区二区精品性| 亚洲黄网站在线观看| 国产酒店精品激情| 欧美久久一二三四区| 国产亚洲欧美一级| 亚洲超碰97人人做人人爱| 国产综合久久久久久久久久久久| 91麻豆国产精品久久| 26uuu另类欧美| 午夜免费久久看| 成a人片亚洲日本久久| 日韩片之四级片| 亚洲国产美国国产综合一区二区| 国产尤物一区二区在线| 欧美视频在线一区二区三区| 国产精品久久久久久久久搜平片 | 欧美一级在线免费| 亚洲一区国产视频| 波多野结衣视频一区| 精品国产伦一区二区三区观看方式| 成人免费毛片高清视频| 久久伊99综合婷婷久久伊| 日本少妇一区二区| 欧美高清一级片在线| 亚洲国产综合在线| 在线视频观看一区| 亚洲人成影院在线观看| av综合在线播放| 亚洲精品国产精品乱码不99| 国产精品影音先锋| 国产喷白浆一区二区三区| 国产一区 二区| 中文成人av在线| 色噜噜狠狠色综合中国| 亚洲一区二区美女| 日韩精品一区二区三区四区视频| 蜜臀精品久久久久久蜜臀| 精品久久久三级丝袜| 国产在线视频精品一区| 久久久久久毛片| 91尤物视频在线观看| 成人国产亚洲欧美成人综合网| 亚洲人成网站精品片在线观看 | 欧美一区二区久久久| 狠狠狠色丁香婷婷综合激情 | 国产综合色产在线精品| 久久久久久一二三区| 播五月开心婷婷综合| 亚洲h在线观看| 国产清纯白嫩初高生在线观看91| 色视频欧美一区二区三区| 久久国产婷婷国产香蕉| 中文字幕一区二区三区在线播放 | 久久亚洲影视婷婷| 99精品欧美一区二区三区小说| 婷婷六月综合网| 国产精品成人午夜| 欧美一区二区福利在线| 91视频在线观看免费| 国产综合久久久久久鬼色| 一区av在线播放| 欧美国产精品一区二区三区| 制服丝袜日韩国产| 在线亚洲欧美专区二区| 国产精品88av| 免费一级片91| 午夜精品久久久久久久久久| 综合精品久久久| 欧美国产一区二区| 欧美一级片在线看| 欧美日韩国产一区二区三区地区| 91香蕉视频污在线| 成人18视频在线播放| 国产成人精品亚洲午夜麻豆| 国内精品视频666| 麻豆精品视频在线观看视频| 日韩**一区毛片| 青青草原综合久久大伊人精品优势| 亚洲国产一二三| 亚洲五月六月丁香激情| 午夜久久久影院| 视频精品一区二区| 日本欧美加勒比视频| 美美哒免费高清在线观看视频一区二区| 一区二区三区精品视频在线| 亚洲一二三四在线| 亚洲成人7777| 美女视频免费一区| 国产精品66部| 91老师片黄在线观看| 91激情五月电影| 7878成人国产在线观看| 日韩免费高清视频| 国产欧美日韩中文久久| 亚洲丝袜精品丝袜在线| 亚洲国产一区二区三区| 黄色精品一二区| 色婷婷国产精品久久包臀| 91精品国产91久久久久久一区二区 | 日韩专区欧美专区| 国模娜娜一区二区三区| 色综合久久久久网| 日韩亚洲欧美成人一区| 国产精品美日韩| 免费高清在线视频一区·| www.亚洲精品| 日韩一区二区三区电影在线观看| 国产三级欧美三级| 日产国产欧美视频一区精品| 国产精品综合久久| 欧美视频一二三区| 国产色爱av资源综合区| 日韩国产欧美在线观看| 972aa.com艺术欧美| 久久婷婷成人综合色| 亚洲18影院在线观看| 97se亚洲国产综合自在线不卡 | 国产一区三区三区| 欧美伦理电影网| 亚洲一二三四久久| 91亚洲资源网| 国产精品卡一卡二卡三| 国内一区二区在线| 精品国产91亚洲一区二区三区婷婷| 亚洲乱码国产乱码精品精小说| 国产精品一区二区不卡| 欧美成人a视频| 国模大尺度一区二区三区| 欧美刺激午夜性久久久久久久| 日韩在线播放一区二区| 91麻豆精品91久久久久久清纯| 尤物视频一区二区| 欧美体内she精视频| 一区二区三区成人| 欧美日韩久久一区| 日韩精品免费专区| 日韩视频123| 国产在线精品一区二区不卡了| 日韩女优视频免费观看| 久久成人精品无人区| 精品福利一区二区三区| 高清shemale亚洲人妖| 日韩一区中文字幕| 在线精品观看国产| 日韩精品电影在线| 亚洲精品一区二区精华| 99久久精品国产导航| 亚洲免费电影在线| 亚洲桃色在线一区| 91欧美一区二区| 水野朝阳av一区二区三区| 精品国产乱码久久久久久浪潮| 床上的激情91.| 亚洲国产日产av| 欧美激情中文字幕一区二区| 色综合久久天天综合网| 天堂av在线一区| 国产精品福利在线播放| 欧美精品乱码久久久久久| 国产精品自拍毛片| 午夜精品久久久久久久蜜桃app| 综合久久综合久久|