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

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

?? os_task.c

?? uCOS-II 移植到ARM7上
?? 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一区二区三区免费野_久草精品视频
亚洲免费在线观看视频| 国产日产欧美一区| 国产成人精品一区二区三区网站观看| 中文字幕一区二区在线播放| 日韩欧美一区在线观看| 色域天天综合网| 国产麻豆欧美日韩一区| 日本中文字幕不卡| 伊人婷婷欧美激情| 欧美国产日本视频| 欧美成人video| 欧美乱熟臀69xxxxxx| 一本在线高清不卡dvd| 国产成人午夜视频| 奇米色一区二区| 亚洲444eee在线观看| 一区二区在线免费| 成人欧美一区二区三区在线播放| 久久在线观看免费| 日韩欧美激情四射| 欧美日韩国产一级片| 在线亚洲免费视频| 91蜜桃传媒精品久久久一区二区| 国产一区二区三区香蕉| 美女视频黄免费的久久| 亚洲大片精品永久免费| 亚洲精品v日韩精品| 亚洲欧洲无码一区二区三区| 国产三级精品在线| 久久久精品人体av艺术| 久久久激情视频| 国产日韩欧美综合一区| 久久久.com| 国产欧美日韩精品一区| 中日韩av电影| 国产精品拍天天在线| 中文在线资源观看网站视频免费不卡 | 欧美无人高清视频在线观看| 日本高清不卡在线观看| 91国偷自产一区二区三区成为亚洲经典| 成人av一区二区三区| 国产69精品久久久久毛片| 成人一区二区三区视频在线观看 | 国产久卡久卡久卡久卡视频精品| 捆绑调教一区二区三区| 久久er精品视频| 国产一区二区电影| 国产69精品久久99不卡| 成人国产免费视频| 91麻豆免费看片| 欧美三级三级三级| 91精品在线免费观看| 精品久久久久久久人人人人传媒 | 欧美一级午夜免费电影| 精品国产乱码久久| 日韩一区二区三区四区五区六区| 欧美成人免费网站| 色综合中文字幕| 欧美性大战久久久久久久蜜臀| 欧美日韩一卡二卡三卡| 日韩一区二区三区四区| 国产亚洲成av人在线观看导航| 国产日韩精品一区二区三区在线| 亚洲欧美在线另类| 三级一区在线视频先锋| 经典三级在线一区| youjizz久久| 欧美日韩电影在线播放| 久久久久久久久岛国免费| 国产精品乱码久久久久久| 亚洲国产乱码最新视频| 国内精品写真在线观看| 91丨porny丨户外露出| 欧美日本一区二区三区四区| 精品99一区二区| 亚洲男人的天堂网| 美女网站色91| 91丨porny丨户外露出| 欧美一卡二卡在线观看| 日韩美女精品在线| 蜜桃在线一区二区三区| 91麻豆蜜桃一区二区三区| 91精品国产欧美一区二区18| 中文字幕av一区 二区| 日韩二区三区四区| 波多野结衣91| 精品乱码亚洲一区二区不卡| 一区二区三区四区视频精品免费 | 91精品黄色片免费大全| 中文字幕精品在线不卡| 日韩激情一二三区| 99精品黄色片免费大全| 26uuu国产日韩综合| 亚洲福利一区二区| www.亚洲免费av| 日韩免费电影一区| 亚洲自拍偷拍综合| 99久久国产综合精品色伊| 精品裸体舞一区二区三区| 亚洲电影视频在线| 99精品1区2区| 亚洲国产经典视频| 久久国产精品99精品国产| 在线精品视频免费观看| 国产精品理伦片| 国模一区二区三区白浆| 91精品国产一区二区三区香蕉| 日韩美女精品在线| 成人国产电影网| 欧美精品一区二区在线观看| 肉丝袜脚交视频一区二区| 欧美在线制服丝袜| 综合久久一区二区三区| 成人一区在线观看| 久久久亚洲欧洲日产国码αv| 秋霞av亚洲一区二区三| 欧美亚洲自拍偷拍| 一区二区欧美精品| 99久久99久久综合| 国产精品久久久久久久久果冻传媒| 国产自产高清不卡| 欧美成人一区二区三区在线观看| 午夜精品久久久久久久久| 欧美性色黄大片| 亚洲一区二区三区中文字幕在线| 91在线观看美女| 综合亚洲深深色噜噜狠狠网站| 东方欧美亚洲色图在线| 国产婷婷一区二区| 国产精品自拍网站| 国产网站一区二区三区| 国产精品一区2区| 久久久国产精品麻豆| 国产一区二区看久久| www激情久久| 国产精品系列在线播放| 欧美高清在线一区二区| 不卡电影一区二区三区| 一区免费观看视频| 日本精品一区二区三区高清| 一区二区三区在线免费| 欧美日本一区二区| 奇米精品一区二区三区四区| 欧美一级国产精品| 国产精品一区二区在线播放 | 欧美亚一区二区| 手机精品视频在线观看| 欧美一区二区三区性视频| 精品综合免费视频观看| 久久久不卡影院| 91在线视频18| 午夜欧美在线一二页| 日韩一卡二卡三卡四卡| 国产一区二区不卡| 亚洲视频一二三| 在线不卡一区二区| 韩国中文字幕2020精品| 国产精品久久久99| 欧美伊人久久久久久久久影院| 日韩精品一级中文字幕精品视频免费观看 | 日韩av中文在线观看| 久久这里都是精品| 97久久精品人人澡人人爽| 亚洲综合图片区| 欧美v国产在线一区二区三区| 国产黄人亚洲片| 亚洲综合视频网| 337p日本欧洲亚洲大胆精品| youjizz国产精品| 爽好久久久欧美精品| 国产欧美一区二区精品婷婷| 色诱亚洲精品久久久久久| 蜜桃视频在线观看一区二区| 欧美国产激情一区二区三区蜜月 | 在线欧美日韩精品| 精品一二三四区| 一区二区三区精品| 欧美xxxxxxxx| 色94色欧美sute亚洲线路二| 麻豆国产精品官网| 亚洲人成小说网站色在线 | 日韩精品一区二区三区四区视频| 国产成人亚洲综合a∨猫咪| 亚洲成人免费电影| 国产色综合久久| 欧美日韩国产小视频在线观看| 国产精品影视在线观看| 五月天国产精品| 中文字幕在线观看一区| 精品久久一区二区三区| 91电影在线观看| 国产91色综合久久免费分享| 午夜国产精品一区| 最新国产精品久久精品| 日韩欧美一区电影| 欧美伊人久久久久久久久影院| 成人激情黄色小说| 开心九九激情九九欧美日韩精美视频电影 | 欧美另类久久久品| 色呦呦国产精品|