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

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

?? os_task.c

?? ucos ii 2.83的完整版,包含接口程序
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久 天天综合| 99re成人精品视频| 欧美大片国产精品| 亚洲成av人片在www色猫咪| 99精品国产99久久久久久白柏| 国产亚洲欧美中文| 国产精品中文有码| 国产亚洲视频系列| 国产成人综合亚洲91猫咪| 精品国产乱码久久久久久浪潮| 日韩成人精品视频| 欧美一级精品在线| 久久99精品久久久久婷婷| 91精品国产综合久久蜜臀| 日韩中文字幕亚洲一区二区va在线| 欧美天堂一区二区三区| 日韩国产在线观看一区| 4438x亚洲最大成人网| 视频一区中文字幕| 日韩欧美国产麻豆| 狠狠色狠狠色合久久伊人| 久久久久国产免费免费| 国产成人综合自拍| 中文字幕亚洲区| 9人人澡人人爽人人精品| 成人免费视频在线观看| 99久久国产综合精品色伊| 亚洲欧洲国产日本综合| 91麻豆国产香蕉久久精品| 一区二区成人在线| 欧美日韩在线免费视频| 欧美性xxxxxx少妇| 亚洲高清三级视频| 91精品午夜视频| 激情综合网av| 国产精品毛片久久久久久| av午夜一区麻豆| 亚洲欧美日韩在线不卡| 欧美日韩www| 激情综合色丁香一区二区| 亚洲国产岛国毛片在线| 91看片淫黄大片一级| 亚洲福利电影网| 日韩精品一区二区三区四区视频| 国产一区福利在线| 亚洲天天做日日做天天谢日日欢| 欧美亚洲日本一区| 精品一区二区av| 国产精品三级av| 欧美三级资源在线| 经典三级视频一区| 中文字幕一区二区不卡| 7777女厕盗摄久久久| 国产麻豆精品视频| 亚洲一区二区三区四区在线观看| 欧美成人在线直播| 99精品视频中文字幕| 亚洲123区在线观看| 久久久久久亚洲综合影院红桃 | 免费成人结看片| 欧美激情中文字幕| 91精彩视频在线观看| 午夜精品福利一区二区三区蜜桃| 久久亚洲欧美国产精品乐播| 91麻豆国产自产在线观看| 青草国产精品久久久久久| 国产精品国产馆在线真实露脸| 911精品国产一区二区在线| 豆国产96在线|亚洲| 天堂久久久久va久久久久| 中文字幕免费一区| 欧美一区二区免费| 91玉足脚交白嫩脚丫在线播放| 青草av.久久免费一区| 亚洲欧美一区二区三区孕妇| 日韩午夜在线观看视频| 一本久久a久久精品亚洲| 激情综合色综合久久综合| 亚洲一卡二卡三卡四卡五卡| 久久蜜桃香蕉精品一区二区三区| 欧美性淫爽ww久久久久无| 国产精品主播直播| 日韩制服丝袜av| 1区2区3区欧美| 久久久www成人免费毛片麻豆| 欧美日韩国产影片| 成人免费看视频| 韩国三级中文字幕hd久久精品| 夜夜爽夜夜爽精品视频| 中文字幕免费不卡在线| 精品久久久影院| 欧美放荡的少妇| 色狠狠色噜噜噜综合网| 国产成人av福利| 免费一级欧美片在线观看| 亚洲综合激情另类小说区| 国产精品蜜臀在线观看| 亚洲精品一区二区三区影院| 欧美精品777| 色婷婷激情综合| 成人高清在线视频| 日韩三级视频在线观看| 91福利视频网站| 成人av在线网站| 国产成人三级在线观看| 看片的网站亚洲| 日欧美一区二区| 亚洲一区在线观看视频| 亚洲色图色小说| 综合色天天鬼久久鬼色| 久久久久久久久久久久久夜| 欧美一区二区性放荡片| 欧美日韩一区三区| 色婷婷精品大视频在线蜜桃视频| 成人精品国产一区二区4080| 国产a久久麻豆| 国内精品伊人久久久久av一坑| 麻豆91精品视频| 丝袜美腿亚洲色图| 亚洲国产一二三| 亚洲一本大道在线| 亚洲电影你懂得| 一区二区三区 在线观看视频| 亚洲欧美一区二区视频| 国产精品无人区| 国产精品伦理一区二区| 亚洲欧洲日产国码二区| 国产精品对白交换视频 | |精品福利一区二区三区| 久久久久97国产精华液好用吗| 日韩欧美国产三级电影视频| 日韩一区二区中文字幕| 日韩精品一区二区在线| 精品久久久久久久久久久久包黑料| 欧美一级爆毛片| 精品少妇一区二区三区在线视频| 日韩午夜在线播放| 日韩欧美区一区二| 2023国产精品视频| 欧美精品一区二区三| 久久精品一区二区| 国产日韩综合av| 亚洲视频图片小说| 亚洲影视在线观看| 午夜精品一区二区三区三上悠亚| 首页综合国产亚洲丝袜| 久久99国产精品麻豆| 国产精华液一区二区三区| 成人在线视频一区二区| 91丝袜呻吟高潮美腿白嫩在线观看| 91日韩精品一区| 欧美日韩一区二区在线观看视频| 这里只有精品电影| 久久这里只有精品首页| 日本一二三不卡| 亚洲美女精品一区| 日韩国产精品久久久| 老司机一区二区| 成人国产精品免费网站| 91成人在线精品| 91精品国产综合久久福利软件| 26uuu国产电影一区二区| 国产精品视频你懂的| 亚洲黄色小视频| 秋霞午夜av一区二区三区| 国产剧情av麻豆香蕉精品| 成人动漫av在线| 欧美日韩免费在线视频| 精品日韩99亚洲| 日韩一区日韩二区| 丝袜美腿成人在线| 国产精品一区在线观看你懂的| 99精品欧美一区二区三区综合在线| 欧美日韩激情一区二区三区| 欧美精品一区二区三区高清aⅴ| 亚洲国产精品v| 亚洲狠狠爱一区二区三区| 久久99精品久久久久久国产越南| k8久久久一区二区三区| 欧美日韩免费高清一区色橹橹| 精品精品国产高清一毛片一天堂| 中文在线资源观看网站视频免费不卡| 一区二区三区美女| 九色综合狠狠综合久久| 日本精品视频一区二区三区| 欧美不卡激情三级在线观看| 亚洲欧洲韩国日本视频| 日本午夜精品视频在线观看| 成人高清视频在线观看| 91麻豆精品国产自产在线观看一区| 久久蜜桃av一区二区天堂 | 亚洲大片在线观看| 国产精品综合二区| 欧美伊人久久大香线蕉综合69 | 天堂久久久久va久久久久| 韩国成人精品a∨在线观看| 色久优优欧美色久优优| 久久久噜噜噜久久人人看| 亚洲mv在线观看| 成人福利视频在线看|