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

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

?? os_task.c

?? ucos2.8 系統(tǒng)的源代碼 我找到的 可以使用
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.80
*********************************************************************************************************
*/

#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;
#if OS_LOWEST_PRIO <= 63
    INT8U        bitx;
    INT8U        bity;
#else
    INT16U       bitx;
    INT16U       bity;
#endif
    INT8U        y_old;
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR    cpu_sr = 0;                                    /* Storage for CPU status register     */
#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);
    }
#if OS_LOWEST_PRIO <= 63
    y                     = newprio >> 3;                       /* Yes, compute new TCB fields         */
    x                     = newprio & 0x07;
#else
    y                     = (newprio >> 4) & 0xFF;
    x                     =  newprio & 0x0F;
#endif

    bity                  = 1 << y;
    bitx                  = 1 << 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) != 0) {             /* If task is ready make it not        */
        OSRdyTbl[y_old] &= ~ptcb->OSTCBBitX;
        if (OSRdyTbl[y_old] == 0) {
            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 *p_arg), 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 = 0;
#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 = 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区在线免费观看| 欧美日韩视频在线一区二区| 91黄色免费看| 精品理论电影在线观看| 亚洲综合在线观看视频| 国产在线国偷精品免费看| 欧美丝袜丝nylons| 国产精品毛片大码女人| 九色porny丨国产精品| 欧美综合一区二区| 综合精品久久久| 国产成人综合在线播放| 制服丝袜国产精品| 伊人色综合久久天天人手人婷| 国产精品一级在线| 欧美tk—视频vk| 日本在线不卡视频| 欧美日韩大陆一区二区| 一区二区三区日韩| 97超碰欧美中文字幕| 久久精品一区二区三区四区| 另类中文字幕网| 日韩午夜在线影院| 久久国产免费看| 欧美成人免费网站| 捆绑调教一区二区三区| 欧美一级免费观看| 七七婷婷婷婷精品国产| 91精品国产综合久久小美女| 婷婷成人综合网| 欧美一区二区视频网站| 午夜精品久久久久久久99樱桃| 欧洲国内综合视频| 一区二区三国产精华液| 欧美综合亚洲图片综合区| 亚洲精品成人悠悠色影视| 一本色道**综合亚洲精品蜜桃冫| 中文字幕日韩一区| 色综合久久九月婷婷色综合| 亚洲老司机在线| 欧美日韩精品电影| 久久精品国产一区二区| 久久这里只精品最新地址| 国产成人精品一区二区三区四区 | 国产精品网曝门| 成人黄色在线看| 一区二区三区加勒比av| 欧美日韩三级一区| 精品午夜久久福利影院| 国产区在线观看成人精品| 99精品在线免费| 五月婷婷激情综合| 精品国产伦一区二区三区免费 | 欧美专区在线观看一区| 天天综合色天天综合色h| 日韩一区二区三区av| 国产91清纯白嫩初高中在线观看| 国产精品国产三级国产| 欧美无乱码久久久免费午夜一区 | 亚洲综合一区二区精品导航| 欧美亚洲国产一区二区三区va| 蜜桃视频第一区免费观看| 久久奇米777| 色嗨嗨av一区二区三区| 免费在线欧美视频| 综合色天天鬼久久鬼色| 91精品国产一区二区三区香蕉| 国产一区二区中文字幕| 亚洲激情av在线| 精品国产91九色蝌蚪| 91美女在线看| 国内外成人在线视频| 亚洲综合免费观看高清完整版在线 | 欧美精品一区二区久久婷婷| www.亚洲色图| 男女男精品网站| 一区二区在线看| 国产视频一区二区三区在线观看| 欧美综合一区二区| 成人免费视频视频| 蜜乳av一区二区三区| 亚洲欧美日韩国产一区二区三区| 日韩手机在线导航| 在线观看亚洲精品视频| 国产美女久久久久| 日韩电影在线免费看| 亚洲素人一区二区| 国产视频一区在线播放| 欧美一区二区三区免费在线看 | 91精品国产免费久久综合| 处破女av一区二区| 蜜臀久久99精品久久久久久9 | 亚洲精品欧美综合四区| 久久这里只有精品首页| 日韩一区二区电影在线| 欧美性大战xxxxx久久久| 成人精品一区二区三区四区 | 午夜精品久久久| 中文字幕第一区二区| 精品sm捆绑视频| 日韩免费视频一区| 欧美日本一区二区在线观看| 色综合一区二区| 成人av在线资源网| 粉嫩av一区二区三区在线播放| 久久精品国产精品亚洲精品| 日欧美一区二区| 五月天网站亚洲| 亚洲韩国精品一区| 亚洲国产精品久久不卡毛片 | 成人欧美一区二区三区黑人麻豆| 26uuu精品一区二区在线观看| 欧美一级黄色大片| 欧美电视剧在线看免费| 欧美大黄免费观看| 精品粉嫩超白一线天av| 欧美精品一区二区三区蜜桃视频 | 一区二区在线观看不卡| 亚洲精品免费电影| 亚洲成人三级小说| 青青草伊人久久| 国产麻豆一精品一av一免费| 国产在线不卡一卡二卡三卡四卡| 久久99久久精品| 国产丶欧美丶日本不卡视频| 国产69精品久久99不卡| 99精品视频中文字幕| 久久精品国产亚洲5555| 玖玖九九国产精品| 粉嫩高潮美女一区二区三区 | 东方欧美亚洲色图在线| 成人黄页毛片网站| 91麻豆精品在线观看| 欧美色网站导航| 精品久久久影院| 中文字幕巨乱亚洲| 亚洲国产精品一区二区尤物区| 日韩精品亚洲一区| 91麻豆国产香蕉久久精品| 日本乱码高清不卡字幕| 欧美一卡2卡三卡4卡5免费| 久久久五月婷婷| 亚洲女同一区二区| 日本欧美久久久久免费播放网| 国产精品99久久久久久有的能看| 色综合色综合色综合色综合色综合| 91福利社在线观看| 精品日韩一区二区三区免费视频| 国产精品伦理一区二区| 首页国产欧美久久| 粉嫩一区二区三区性色av| 欧美日韩成人一区| 国产精品全国免费观看高清| 婷婷六月综合亚洲| a美女胸又www黄视频久久| 欧美一级久久久久久久大片| 1024亚洲合集| 久草这里只有精品视频| 色综合久久99| 日本一区二区视频在线| 美腿丝袜亚洲三区| 色美美综合视频| 国产欧美日产一区| 日产国产欧美视频一区精品| 北条麻妃一区二区三区| 日韩天堂在线观看| 亚洲h在线观看| 波多野结衣91| 国产情人综合久久777777| 日本伊人色综合网| 在线一区二区三区四区五区 | 国产午夜精品一区二区三区视频| 亚洲尤物视频在线| 成人国产精品免费观看动漫| 欧美丰满嫩嫩电影| 亚洲精品亚洲人成人网在线播放| 国产精品一区二区不卡| 日韩欧美一级特黄在线播放| 亚洲第一二三四区| 91麻豆精品在线观看| 中文字幕在线不卡国产视频| 国产乱码精品一区二区三区忘忧草| 在线不卡欧美精品一区二区三区| 亚洲精品精品亚洲| 色老汉一区二区三区| 国产精品成人网| 成人三级在线视频| 国产精品无码永久免费888| 国产精品一区二区在线播放 | 国产一区二区三区| 欧美电视剧在线看免费| 蜜桃av噜噜一区| 精品欧美一区二区久久| 久久99精品久久久久久动态图| 日韩亚洲欧美成人一区| 日韩不卡一区二区| 日韩一级成人av| 国产最新精品精品你懂的| 久久亚洲精品国产精品紫薇| 国产麻豆日韩欧美久久|