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

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

?? os_task.c

?? uCos_II到ARM7的移植
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.83
*********************************************************************************************************
*/

#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_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                     = (INT8U)(newprio >> 3);              /* Yes, compute new TCB fields         */
    x                     = (INT8U)(newprio & 0x07);
    bity                  = (INT8U)(1 << y);
    bitx                  = (INT8U)(1 << x);
#else
    y                     = (INT8U)((newprio >> 4) & 0xFF);
    x                     = (INT8U)( newprio & 0x0F);
    bity                  = (INT16U)(1 << y);
    bitx                  = (INT16U)(1 << x);
#endif

    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 == 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_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,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩五月天| 午夜一区二区三区视频| 亚洲精品成人a在线观看| 日本欧美加勒比视频| 不卡大黄网站免费看| 在线电影国产精品| 一区二区高清在线| 国产91在线观看| 制服丝袜中文字幕一区| 亚洲欧美日韩在线播放| 懂色av一区二区三区免费观看| 欧美专区日韩专区| 中文字幕一区二区三区av| 国产在线不卡一区| 欧美一卡二卡三卡四卡| 亚洲一本大道在线| 91欧美一区二区| 欧美国产精品劲爆| 国产成人综合网| 精品精品国产高清一毛片一天堂| 午夜一区二区三区视频| 欧美在线免费观看亚洲| 伊人色综合久久天天人手人婷| 国产盗摄一区二区| 国产日韩欧美不卡| 成人性生交大片免费看视频在线| 精品国产sm最大网站| 久久国产视频网| 欧美一区二区在线免费播放| 亚洲h动漫在线| 欧美撒尿777hd撒尿| 一卡二卡三卡日韩欧美| 91亚洲国产成人精品一区二三| 中文字幕精品三区| 成人性色生活片免费看爆迷你毛片| 欧美xxxx老人做受| 国产盗摄一区二区| 亚洲婷婷综合色高清在线| av在线综合网| 亚洲精品成人悠悠色影视| 欧美亚洲禁片免费| 日本最新不卡在线| 久久综合九色综合久久久精品综合 | 亚洲一卡二卡三卡四卡五卡| 99re热这里只有精品视频| 亚洲色图丝袜美腿| 99久精品国产| 亚洲国产精品久久人人爱| 欧美国产精品劲爆| 婷婷成人综合网| 色一区在线观看| 亚洲最新视频在线观看| 欧美日韩aaaaa| 老司机精品视频线观看86| 久久久久综合网| 91在线免费播放| 亚洲电影一区二区| 精品久久久久久久久久久久久久久久久 | 蜜臀va亚洲va欧美va天堂| 精品国产精品一区二区夜夜嗨| 国产精品综合久久| 亚洲色图制服诱惑 | 在线影视一区二区三区| 青青草一区二区三区| 欧美激情自拍偷拍| 欧美午夜不卡在线观看免费| 麻豆中文一区二区| 亚洲欧美乱综合| 日韩欧美精品在线视频| 99久久精品免费精品国产| 日韩精品视频网站| 国产精品久久久久久久久久免费看 | 日韩午夜三级在线| 99国产精品久久久久久久久久久| 天堂在线亚洲视频| 中文字幕一区二区三区视频| 91麻豆精品久久久久蜜臀 | 国产精品久久久久久福利一牛影视 | 成人91在线观看| 欧美aaa在线| 亚洲精品乱码久久久久久| 欧美精品一区二区三区一线天视频| 91在线观看成人| 国产一区不卡精品| 热久久免费视频| 亚洲另类在线视频| 国产日韩欧美精品在线| 日韩一区二区三区电影在线观看| 色哟哟一区二区在线观看 | 在线观看日韩电影| 成人黄色在线网站| 国产永久精品大片wwwapp| 天天av天天翘天天综合网色鬼国产| 国产精品的网站| 中文字幕乱码久久午夜不卡| 欧美一级艳片视频免费观看| 91国在线观看| 91丨porny丨户外露出| 国产成人精品免费视频网站| 蜜桃av一区二区在线观看| 亚洲mv大片欧洲mv大片精品| 亚洲精品中文在线| 亚洲视频一二区| 亚洲欧洲精品一区二区三区 | 精品视频999| 在线观看av一区二区| 色婷婷综合视频在线观看| 99久久婷婷国产综合精品| 国产成人免费高清| 成人国产亚洲欧美成人综合网 | 乱一区二区av| 日韩不卡一二三区| 日本vs亚洲vs韩国一区三区| 亚洲一二三四在线观看| 亚洲国产视频一区| 午夜亚洲国产au精品一区二区| 玉米视频成人免费看| 亚洲国产另类精品专区| 亚洲成人综合视频| 视频一区视频二区中文| 日本人妖一区二区| 久久精品国产精品亚洲精品| 国产精一品亚洲二区在线视频| 国产麻豆视频精品| 成人高清在线视频| 色婷婷国产精品综合在线观看| 色婷婷久久99综合精品jk白丝| 91电影在线观看| 欧美一区二区精品| 国产婷婷一区二区| 亚洲三级理论片| 亚洲国产精品影院| 日本成人在线电影网| 国产精品一线二线三线精华| 国产激情视频一区二区在线观看| 成人性生交大片免费看中文| 一本色道久久综合亚洲aⅴ蜜桃| 欧美日韩视频在线第一区| 91精品国产日韩91久久久久久| 欧美不卡一区二区| 国产精品狼人久久影院观看方式| 亚洲人成网站精品片在线观看| 午夜精品久久久久久久99樱桃| 人人超碰91尤物精品国产| 国产成a人亚洲精品| 欧美艳星brazzers| 精品成人在线观看| 亚洲精品乱码久久久久久| 久久9热精品视频| 91免费小视频| 精品剧情在线观看| 亚洲伦在线观看| 精品中文字幕一区二区小辣椒 | 国产成人无遮挡在线视频| 色88888久久久久久影院按摩| 欧美老肥妇做.爰bbww视频| 久久久三级国产网站| 亚洲在线免费播放| 国产99一区视频免费| 欧美一级日韩免费不卡| 中文字幕中文字幕一区二区| 日韩av网站在线观看| 91片在线免费观看| 久久亚区不卡日本| 日韩在线一二三区| 91视频观看视频| 久久婷婷综合激情| 亚洲国产精品久久一线不卡| 国产98色在线|日韩| 日韩亚洲欧美一区二区三区| 亚洲精品国产无天堂网2021| 国产在线日韩欧美| 91麻豆精品国产91久久久久久| 日韩理论电影院| 懂色中文一区二区在线播放| 欧美tk—视频vk| 日韩有码一区二区三区| 欧洲亚洲国产日韩| 国产精品久久久久7777按摩| 韩国成人福利片在线播放| 777欧美精品| 亚洲一区二区三区影院| 91在线小视频| 欧美激情中文字幕一区二区| 国产剧情一区二区| 精品国产制服丝袜高跟| 五月婷婷综合在线| 在线免费观看日韩欧美| 一区在线播放视频| 99精品视频一区| 亚洲免费观看高清完整版在线观看 | 亚洲欧洲国产日韩| 成人国产在线观看| 国产精品成人免费| www.欧美日韩| 综合色天天鬼久久鬼色| www.亚洲免费av| 亚洲日本一区二区| 91麻豆123| 亚洲线精品一区二区三区|