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

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

?? os_task.c

?? V2.8 uc/os移植到PC機上運行
?? 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一区二区三区免费野_久草精品视频
欧美tickling挠脚心丨vk| 欧美日韩日日骚| 免费成人小视频| 亚洲国产精品一区二区久久恐怖片| 中文字幕不卡在线| 国产精品色婷婷| 国产精品久久福利| 亚洲免费观看高清完整版在线观看熊| 国产精品美女一区二区在线观看| 国产精品久久久久精k8| 亚洲欧美电影院| 天天影视网天天综合色在线播放| 麻豆精品国产传媒mv男同| 国内精品免费在线观看| 成人av免费观看| 欧美色精品在线视频| 欧美一区二区精品在线| 在线播放91灌醉迷j高跟美女| 97久久超碰国产精品| 亚洲国产欧美在线| 日本怡春院一区二区| 国产剧情一区二区| 韩国v欧美v日本v亚洲v| 国产精品乱人伦中文| 亚洲成人动漫精品| 欧美三级日韩三级| 午夜影院久久久| 欧美日韩亚洲丝袜制服| 偷拍日韩校园综合在线| 欧美日韩精品一区二区在线播放 | 国产区在线观看成人精品 | 91精品国产一区二区三区蜜臀| 亚洲天堂a在线| 91麻豆蜜桃一区二区三区| 国产精品久久看| 9l国产精品久久久久麻豆| 国产精品传媒在线| 欧洲一区在线观看| 天天av天天翘天天综合网| 日韩限制级电影在线观看| 久久成人18免费观看| 欧美r级在线观看| 国产精品亚洲人在线观看| 日本一区二区三区免费乱视频 | 麻豆91在线播放免费| 精品国产一区二区精华| 国产成人精品免费一区二区| 国产亚洲一二三区| 色综合亚洲欧洲| 日韩专区在线视频| 久久女同性恋中文字幕| 99久久国产综合精品色伊 | 色婷婷av一区二区三区之一色屋| 亚洲国产中文字幕在线视频综合| 在线成人av网站| 激情五月婷婷综合| 亚洲欧洲精品一区二区三区| 欧美色图片你懂的| 九一九一国产精品| 国产精品青草久久| 欧美日韩激情一区二区| 国产麻豆视频精品| 亚洲与欧洲av电影| 欧美精品一区二区三区久久久| 成人av手机在线观看| 午夜久久久久久| 国产精品亲子乱子伦xxxx裸| 欧美视频在线一区二区三区 | www国产精品av| 99久免费精品视频在线观看 | 成人免费看视频| 日韩1区2区日韩1区2区| 国产精品天干天干在观线| 欧美性生活大片视频| 国产成人亚洲综合色影视| 亚洲国产一区二区在线播放| 久久久久久久久久久电影| 欧美日韩精品一区二区三区| 成人午夜精品在线| 久久黄色级2电影| 亚洲影院免费观看| 国产精品久久久99| 久久先锋影音av鲁色资源网| 欧美无乱码久久久免费午夜一区| 国产成人免费视频一区| 日韩av一区二区三区| 亚洲精品中文字幕在线观看| 国产午夜精品一区二区三区视频| 在线电影国产精品| 欧美性生活大片视频| 99在线视频精品| 国产成人午夜片在线观看高清观看 | 亚洲综合偷拍欧美一区色| 久久精品一二三| 欧美变态凌虐bdsm| 欧美一级二级在线观看| 欧美亚州韩日在线看免费版国语版| 成人h版在线观看| 国产精品18久久久| 国内成人自拍视频| 极品瑜伽女神91| 久久精品久久久精品美女| 日本成人在线一区| 丝袜亚洲另类欧美| 日本sm残虐另类| 免费高清成人在线| 另类欧美日韩国产在线| 美腿丝袜亚洲色图| 美国精品在线观看| 麻豆91在线播放| 黄色成人免费在线| 国产成人精品三级麻豆| 成人午夜电影网站| www..com久久爱| 一本色道久久综合精品竹菊| 91蜜桃婷婷狠狠久久综合9色| 色综合久久综合网欧美综合网| 99r国产精品| 欧洲精品中文字幕| 欧美一区二区三区色| 日韩欧美不卡一区| 欧美激情一区二区三区| 国产精品毛片高清在线完整版| 亚洲日本中文字幕区| 亚洲一线二线三线视频| 日韩精品亚洲专区| 韩国中文字幕2020精品| 成人一区二区在线观看| 91麻豆国产香蕉久久精品| 欧美日韩亚洲综合在线| 日韩精品一区二| 欧美韩国日本一区| 亚洲国产毛片aaaaa无费看 | 久久精品综合网| 国产精品久久综合| 亚洲美女屁股眼交| 秋霞影院一区二区| 国产馆精品极品| 欧美体内she精视频| 日韩免费电影一区| 亚洲视频一区二区在线| 日韩精品成人一区二区三区| 国产精品自拍毛片| 欧洲一区在线电影| 久久久三级国产网站| 亚洲人吸女人奶水| 六月丁香婷婷久久| 99re视频这里只有精品| 6080国产精品一区二区| 国产日韩精品视频一区| 亚洲国产sm捆绑调教视频| 国内成人免费视频| 91视频一区二区| 精品国产一区二区三区不卡| 综合中文字幕亚洲| 精品写真视频在线观看| 在线视频国产一区| 久久亚洲一区二区三区明星换脸| 亚洲蜜臀av乱码久久精品 | 国产三级久久久| 亚洲成av人影院| 99久久综合99久久综合网站| 欧美一区二区日韩| 亚洲欧美日韩一区二区三区在线观看| 免费精品视频在线| 日本久久精品电影| 欧美国产欧美综合| 九九**精品视频免费播放| 欧美伊人久久大香线蕉综合69 | 99视频一区二区| 2023国产精品自拍| 奇米在线7777在线精品 | 国产午夜精品久久久久久久| 亚洲成av人片www| 色偷偷成人一区二区三区91| 久久精品一区八戒影视| 麻豆91在线播放| 欧美一区二区三区四区视频| 一级精品视频在线观看宜春院| 波多野结衣在线一区| 国产亚洲一区二区三区| 毛片一区二区三区| 6080国产精品一区二区| 亚洲尤物视频在线| 欧美综合天天夜夜久久| 亚洲老妇xxxxxx| 色综合久久久久久久| 中文字幕色av一区二区三区| 国产一区二区三区四区五区入口| 欧美大胆人体bbbb| 日韩av中文在线观看| 91精品国产综合久久福利软件| 亚洲第一成人在线| 7777女厕盗摄久久久| 亚洲va国产va欧美va观看| 欧美无砖专区一中文字| 午夜久久电影网| 欧美大片日本大片免费观看| 精品亚洲欧美一区| 久久久无码精品亚洲日韩按摩|