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

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

?? os_task.c

?? UCOS2.83移植的s3c44b0x的最終版,如果那為燒友有好的建議請EMAIL我,不勝感激!
?? 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一区二区三区免费野_久草精品视频
日韩三级.com| 国产成人精品www牛牛影视| 91亚洲精品一区二区乱码| 久久精品免视看| 国产福利一区在线| 亚洲欧洲www| 91福利精品视频| 丝袜亚洲另类丝袜在线| 欧美精品v日韩精品v韩国精品v| 首页综合国产亚洲丝袜| 日韩欧美国产成人一区二区| 精品亚洲国产成人av制服丝袜 | 色天使色偷偷av一区二区| 亚洲欧美aⅴ...| 欧美日韩在线观看一区二区| 捆绑调教一区二区三区| 国产亚洲成年网址在线观看| 99久久久久久| 日韩精品欧美成人高清一区二区| 日韩亚洲国产中文字幕欧美| 国产福利一区二区三区| 亚洲精品少妇30p| 日韩亚洲电影在线| av一区二区不卡| 午夜精品影院在线观看| 久久精子c满五个校花| 欧美成人bangbros| 国产午夜精品一区二区三区嫩草| 亚洲一区二区欧美日韩| 久久97超碰国产精品超碰| 欧美在线观看禁18| 国产三级一区二区| 亚洲电影你懂得| 国产精品中文字幕一区二区三区| 色哟哟一区二区| 久久精品男人的天堂| 裸体在线国模精品偷拍| 精品在线一区二区| 亚洲品质自拍视频| 精品美女在线观看| 在线这里只有精品| 国产91精品久久久久久久网曝门| 亚洲国产人成综合网站| 国产午夜亚洲精品理论片色戒| 欧美午夜不卡视频| 粗大黑人巨茎大战欧美成人| 日本怡春院一区二区| 亚洲黄网站在线观看| 久久久久久亚洲综合| 69堂成人精品免费视频| 色一情一乱一乱一91av| 国产成人精品一区二区三区四区| 肉色丝袜一区二区| 亚洲欧美日韩系列| 国产欧美日韩综合精品一区二区| 91精品国产综合久久国产大片| 日本韩国一区二区三区| 91在线播放网址| 国产成人av资源| 国产一区二区免费在线| 美女脱光内衣内裤视频久久网站 | 午夜精品福利视频网站| 中文字幕在线不卡一区二区三区| 欧美videos中文字幕| 欧美一区二区三区在线观看视频| 在线国产亚洲欧美| 色综合久久久久综合体| www.在线欧美| 岛国一区二区三区| 国产精品一区二区三区乱码| 久久精品国产亚洲高清剧情介绍| 婷婷久久综合九色综合绿巨人| 亚洲免费视频中文字幕| 亚洲欧美日韩成人高清在线一区| 国产精品久久久久久久久快鸭 | 日韩欧美亚洲国产另类| 欧美日韩国产免费一区二区| 欧美性大战久久久久久久蜜臀 | 欧美日韩不卡一区二区| 久久精品二区亚洲w码| 偷拍一区二区三区| 亚洲国产高清不卡| 欧美一区日韩一区| av中文字幕亚洲| 久久99久久久久| 亚洲五码中文字幕| 国产日韩欧美精品在线| 7777精品伊人久久久大香线蕉完整版| 在线免费亚洲电影| 色悠久久久久综合欧美99| 91在线精品一区二区三区| 色综合中文字幕| 欧美日韩日日夜夜| 日韩一区二区三区观看| 欧美tk丨vk视频| 欧美精品一区二区三| 亚洲国产精品成人综合色在线婷婷| 国产精品久久久久久久浪潮网站| 亚洲免费观看高清在线观看| 亚洲成人免费影院| 国产揄拍国内精品对白| voyeur盗摄精品| 欧美三级电影精品| 日韩欧美国产精品一区| 中文字幕成人网| 亚洲一区二区黄色| 精品伊人久久久久7777人| 成人精品在线视频观看| 欧美在线制服丝袜| 欧美精品一区二| 亚洲人成7777| 美国av一区二区| 不卡免费追剧大全电视剧网站| 在线观看三级视频欧美| 日韩欧美一卡二卡| 国产精品国产三级国产aⅴ中文| 亚洲成人动漫在线免费观看| 国产乱妇无码大片在线观看| 91黄视频在线观看| 精品福利av导航| 亚洲免费av网站| 九九久久精品视频 | 久久电影国产免费久久电影| 粉嫩嫩av羞羞动漫久久久| 欧美撒尿777hd撒尿| 久久精品亚洲一区二区三区浴池| 一区二区三区中文字幕精品精品| 久久精品久久99精品久久| 色综合久久久久| 26uuu久久天堂性欧美| 亚洲第一在线综合网站| 国产成人av影院| 日韩一区二区三区视频在线| 亚洲欧美日韩国产成人精品影院 | 91精品欧美福利在线观看| 国产精品免费视频一区| 久久成人免费电影| 欧美日韩精品一区二区| 中文字幕一区二区三区精华液| 精品一区二区三区久久久| 欧美性猛交xxxxxx富婆| 亚洲欧美精品午睡沙发| 国产在线播放一区三区四| 在线成人免费观看| 亚洲自拍都市欧美小说| 99精品欧美一区二区蜜桃免费| 26uuu亚洲综合色欧美 | 久久蜜臀中文字幕| 视频在线观看国产精品| 日本高清不卡aⅴ免费网站| 中文字幕av资源一区| 久久99热国产| 日韩网站在线看片你懂的| 亚洲一级二级三级| 色综合天天天天做夜夜夜夜做| 国产午夜精品一区二区三区四区| 久久99久久精品| 91 com成人网| 亚洲成a人v欧美综合天堂| 色爱区综合激月婷婷| 亚洲欧洲成人精品av97| 99久久精品国产导航| 欧美国产精品专区| 国产成人av一区二区三区在线 | 国产精品电影一区二区三区| 国产福利一区二区三区在线视频| 精品久久久久av影院| 久久电影网站中文字幕| 精品国产伦一区二区三区免费 | 天天色综合成人网| 欧美日韩精品一区二区三区| 天天色天天爱天天射综合| 911精品国产一区二区在线| 免费在线看成人av| 精品乱人伦一区二区三区| 久久99精品一区二区三区 | 久久久久久久免费视频了| 国精产品一区一区三区mba桃花| 欧美精品一区二区三区一线天视频| 久久精品久久99精品久久| 久久精品一区蜜桃臀影院| 不卡一区中文字幕| 亚洲一区视频在线观看视频| 欧美日韩欧美一区二区| 日产精品久久久久久久性色| 精品久久久久久久久久久久久久久| 国产精品一区二区久激情瑜伽| 国产精品伦理在线| 91国产精品成人| 日本不卡123| 久久精品日产第一区二区三区高清版| 国产成人av电影在线| 亚洲精品一卡二卡| 91精品国产综合久久久蜜臀图片| 韩国女主播成人在线观看| 国产精品福利一区| 91精品国产综合久久久久久久| 国产精品456| 亚洲一线二线三线视频| 欧美α欧美αv大片|