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

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

?? os_task.c

?? ucos-ii在msp430f149上的移植
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                              (c) Copyright 1992-2008, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.87
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
* its use in your product. We provide ALL the source code for your convenience and to help you experience 
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
* licensing fee.
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "ucos_ii.h"
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                        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_ERR_NONE            is the call was successful
*              OS_ERR_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                     (i.e. >= OS_LOWEST_PRIO)
*              OS_ERR_PRIO_EXIST      if the new priority already exist.
*              OS_ERR_PRIO            there is no task with the specified OLD priority (i.e. the OLD task does
*                                     not exist.
*              OS_ERR_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;
#if (OS_EVENT_MULTI_EN > 0)
    OS_EVENT **pevents;
#endif
#endif
    OS_TCB    *ptcb;
    INT8U      y_new;
    INT8U      x_new;
    INT8U      y_old;
#if OS_LOWEST_PRIO <= 63
    INT8U      bity_new;
    INT8U      bitx_new;
    INT8U      bity_old;
    INT8U      bitx_old;
#else
    INT16U     bity_new;
    INT16U     bitx_new;
    INT16U     bity_old;
    INT16U     bitx_old;
#endif
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr = 0;                                  /* Storage for CPU status register         */
#endif


/*$PAGE*/
#if OS_ARG_CHK_EN > 0
    if (oldprio >= OS_LOWEST_PRIO) {
        if (oldprio != OS_PRIO_SELF) {
            return (OS_ERR_PRIO_INVALID);
        }
    }
    if (newprio >= OS_LOWEST_PRIO) {
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {             /* New priority must not already exist     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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_ERR_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {                          /* Is task assigned to Mutex               */
        OS_EXIT_CRITICAL();                                 /* No, can't change its priority!          */
        return (OS_ERR_TASK_NOT_EXIST);
    }
#if OS_LOWEST_PRIO <= 63
    y_new                 = (INT8U)(newprio >> 3);          /* Yes, compute new TCB fields             */
    x_new                 = (INT8U)(newprio & 0x07);
    bity_new              = (INT8U)(1 << y_new);
    bitx_new              = (INT8U)(1 << x_new);
#else
    y_new                 = (INT8U)((newprio >> 4) & 0x0F);
    x_new                 = (INT8U)( newprio & 0x0F);
    bity_new              = (INT16U)(1 << y_new);
    bitx_new              = (INT16U)(1 << x_new);
#endif

    OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                    /* Remove TCB from old priority            */
    OSTCBPrioTbl[newprio] =  ptcb;                          /* Place pointer to TCB @ new priority     */
    y_old                 =  ptcb->OSTCBY;
    bity_old              =  ptcb->OSTCBBitY;
    bitx_old              =  ptcb->OSTCBBitX;
    if ((OSRdyTbl[y_old] &   bitx_old) != 0) {              /* If task is ready make it not            */
         OSRdyTbl[y_old] &= ~bitx_old;
         if (OSRdyTbl[y_old] == 0) {
             OSRdyGrp &= ~bity_old;
         }
         OSRdyGrp        |= bity_new;                       /* Make new priority ready to run          */
         OSRdyTbl[y_new] |= bitx_new;
    }

#if (OS_EVENT_EN)
    pevent = ptcb->OSTCBEventPtr;
    if (pevent != (OS_EVENT *)0) {
        pevent->OSEventTbl[y_old] &= ~bitx_old;             /* Remove old task prio from wait list     */
        if (pevent->OSEventTbl[y_old] == 0) {
            pevent->OSEventGrp    &= ~bity_old;
        }
        pevent->OSEventGrp        |= bity_new;              /* Add    new task prio to   wait list     */
        pevent->OSEventTbl[y_new] |= bitx_new;
    }
#if (OS_EVENT_MULTI_EN > 0)
    if (ptcb->OSTCBEventMultiPtr != (OS_EVENT **)0) {
        pevents =  ptcb->OSTCBEventMultiPtr;
        pevent  = *pevents;
        while (pevent != (OS_EVENT *)0) {
            pevent->OSEventTbl[y_old] &= ~bitx_old;         /* Remove old task prio from wait lists    */
            if (pevent->OSEventTbl[y_old] == 0) {
                pevent->OSEventGrp    &= ~bity_old;
            }
            pevent->OSEventGrp        |= bity_new;          /* Add    new task prio to   wait lists    */
            pevent->OSEventTbl[y_new] |= bitx_new;
            pevents++;
            pevent                     = *pevents;
        }
    }
#endif
#endif

    ptcb->OSTCBPrio = newprio;                              /* Set new task priority                   */
    ptcb->OSTCBY    = y_new;
    ptcb->OSTCBX    = x_new;
    ptcb->OSTCBBitY = bity_new;
    ptcb->OSTCBBitX = bitx_new;
    OS_EXIT_CRITICAL();
    if (OSRunning == OS_TRUE) {
        OS_Sched();                                         /* Find new highest priority task          */
    }
    return (OS_ERR_NONE);
}
#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_ERR_NONE             if the function was successful.
*              OS_PRIO_EXIT            if the task priority already exist
*                                      (each task MUST have a unique priority).
*              OS_ERR_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_ERR_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_RESERVED;/* 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_ERR_NONE) {
            if (OSRunning == OS_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_ERR_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.
*                        For example, this user memory can hold the contents of floating-point registers
*                        during a context switch, the time each task takes to execute, the number of times

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线一区二区视频| 欧美在线free| 亚洲高清视频在线| 久久久99免费| 91精品欧美一区二区三区综合在 | 亚洲一区在线电影| 欧美一区二区三区啪啪| 国产精品1024| 免费在线观看一区| 洋洋av久久久久久久一区| 久久精品一二三| 中文字幕中文字幕一区| 2024国产精品视频| 制服丝袜国产精品| 色一情一乱一乱一91av| 国产激情91久久精品导航| 日韩精品每日更新| 亚洲高清中文字幕| 一区二区三区中文字幕| 中文一区二区在线观看| xnxx国产精品| 精品欧美乱码久久久久久| 欧美精品99久久久**| 在线观看欧美日本| 色视频欧美一区二区三区| 成人黄色在线网站| 国产a久久麻豆| 国产精品自在欧美一区| 韩国成人精品a∨在线观看| 老司机免费视频一区二区三区| 91麻豆精品91久久久久久清纯| 污片在线观看一区二区| 亚洲精品乱码久久久久| 一区在线观看视频| 中文字幕亚洲精品在线观看 | www.色精品| 国产98色在线|日韩| 韩国视频一区二区| 精品一区二区三区影院在线午夜| 蜜臀av性久久久久蜜臀aⅴ| 亚洲欧美日韩在线| 亚洲私人影院在线观看| 亚洲免费av在线| 亚洲在线视频一区| 亚洲成人精品在线观看| 亚洲大片精品永久免费| 悠悠色在线精品| 午夜久久福利影院| 日韩二区三区在线观看| 免播放器亚洲一区| 国产精品一区二区久久精品爱涩| 久久亚洲精华国产精华液| 久久欧美一区二区| 欧美激情资源网| 亚洲三级电影全部在线观看高清| 欧美日韩精品三区| 日韩视频永久免费| 久久精品一区二区三区四区| 国产亚洲精品aa午夜观看| 久久精品免视看| 亚洲欧美日韩国产手机在线| 亚洲国产精品自拍| 久草在线在线精品观看| 国产999精品久久久久久绿帽| 亚洲成人www| 精品影视av免费| 国产成都精品91一区二区三| 91丨九色丨蝌蚪丨老版| 欧美日韩精品电影| 精品嫩草影院久久| 综合自拍亚洲综合图不卡区| 亚洲高清不卡在线观看| 激情综合色播激情啊| av在线不卡观看免费观看| 91成人在线观看喷潮| 精品国产91九色蝌蚪| 国产精品久久国产精麻豆99网站| 精品成a人在线观看| 国产精品欧美极品| 亚洲成人先锋电影| 国产99久久久久久免费看农村| 免费美女久久99| av激情综合网| 欧美狂野另类xxxxoooo| 26uuu成人网一区二区三区| 亚洲免费资源在线播放| 美女视频黄频大全不卡视频在线播放| 亚洲国产一区二区在线播放| 国产一级精品在线| 欧美午夜电影网| 国产精品美日韩| 美日韩一区二区三区| 色婷婷av一区二区三区之一色屋| av不卡一区二区三区| 日韩视频免费观看高清完整版在线观看| 91黄视频在线观看| 国产亚洲欧美日韩俺去了| 香蕉成人啪国产精品视频综合网| 一区二区三区视频在线观看| 国产精品一区三区| 日韩一区二区麻豆国产| 综合久久给合久久狠狠狠97色| 亚洲天堂网中文字| 美女任你摸久久| 欧美三级在线看| 国产精品麻豆视频| 国产一区二区日韩精品| 欧美二区在线观看| 亚洲乱码中文字幕| 国产91精品一区二区麻豆网站| 不卡的av在线播放| 2021国产精品久久精品| 日韩国产在线观看| 色吧成人激情小说| 亚洲国产精品成人综合| 青青草国产成人99久久| 欧美三级电影网站| 亚洲一线二线三线视频| 91亚洲永久精品| 国产欧美日韩不卡免费| 国内成人免费视频| 欧美一区二区三区人| 日韩一区精品视频| 欧美日韩夫妻久久| 亚洲国产毛片aaaaa无费看| 91九色最新地址| 亚洲精品国产成人久久av盗摄 | 亚洲电影视频在线| 色视频成人在线观看免| 亚洲日本va在线观看| 成人h动漫精品一区二区| 国产精品私人影院| 国产精品一二三| 国产精品三级久久久久三级| 国产精品亚洲午夜一区二区三区 | 国产亚洲短视频| 蜜桃视频第一区免费观看| 欧美一卡2卡3卡4卡| 七七婷婷婷婷精品国产| 91精品国产一区二区人妖| 日韩高清一级片| 91麻豆精品国产无毒不卡在线观看| 国产精品乱人伦| 99久久婷婷国产综合精品 | 久久综合九色综合欧美98| 日韩有码一区二区三区| 欧美大白屁股肥臀xxxxxx| 精品一区二区在线视频| 久久精品夜色噜噜亚洲aⅴ| 国产白丝精品91爽爽久久| 国产精品全国免费观看高清| 色婷婷综合视频在线观看| 亚洲一区二区在线免费观看视频 | 成人激情校园春色| 国产精品国产自产拍高清av王其 | 亚洲图片欧美色图| 在线不卡a资源高清| 蜜桃av一区二区三区| 国产色婷婷亚洲99精品小说| 国产精品一区二区三区四区| 国产精品白丝在线| 欧美伦理视频网站| 国产真实乱对白精彩久久| 亚洲国产精品二十页| 欧美视频三区在线播放| 九九视频精品免费| 国产精品二三区| 欧美高清dvd| 国产黄色精品网站| 一区二区三区中文字幕精品精品 | 欧美不卡123| 大白屁股一区二区视频| 亚洲综合久久av| 2024国产精品| 欧美在线小视频| 国产电影一区二区三区| 一区二区在线观看免费| 精品伦理精品一区| 91视频国产观看| 精品在线观看免费| 亚洲综合色自拍一区| 精品国产自在久精品国产| 99在线精品视频| 美女视频第一区二区三区免费观看网站 | 日精品一区二区三区| 久久久久久影视| 欧美日韩大陆一区二区| 久久国内精品视频| 一区二区三区四区中文字幕| 日韩欧美电影在线| 欧美曰成人黄网| 国产一区二区三区在线观看免费视频| 精品美女在线播放| 欧美日韩黄色影视| 国产一级精品在线| 青青青伊人色综合久久| 亚洲欧美日韩国产中文在线| 久久精品夜夜夜夜久久| 日韩欧美一级二级三级久久久| 久久99精品久久久久|