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

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

?? os_task.c

?? ARM9 9200 UCOS 程序
?? 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一区二区三区免费野_久草精品视频
7777精品久久久大香线蕉| 色综合天天综合色综合av | 日韩欧美国产一区二区在线播放| 在线欧美小视频| 在线观看亚洲一区| 欧美亚洲丝袜传媒另类| 在线观看日产精品| 欧美日韩国产电影| 4438亚洲最大| 欧美成人猛片aaaaaaa| 精品国产乱码久久久久久老虎 | 91视视频在线观看入口直接观看www | 国产福利一区在线观看| 久久成人久久爱| 国产乱码精品一区二区三区av | 欧美成人官网二区| 国产亚洲欧美日韩日本| 日本一区二区三区免费乱视频| 中文字幕精品三区| 亚洲欧洲制服丝袜| 日本欧美大码aⅴ在线播放| 麻豆精品一二三| 成人国产精品免费网站| 在线视频欧美精品| 欧美一级免费观看| 国产欧美精品区一区二区三区| 亚洲色欲色欲www| 亚洲va欧美va国产va天堂影院| 青草av.久久免费一区| 国产成人亚洲综合a∨婷婷| 97精品国产露脸对白| 欧美精品久久久久久久多人混战 | 懂色av中文字幕一区二区三区| jvid福利写真一区二区三区| 欧美日韩国产小视频| 久久青草欧美一区二区三区| 一区二区理论电影在线观看| 久久精品av麻豆的观看方式| 91亚洲资源网| 精品日本一线二线三线不卡| 亚洲特黄一级片| 国模大尺度一区二区三区| 91污片在线观看| 精品国产乱码久久久久久老虎| 亚洲区小说区图片区qvod| 国产综合成人久久大片91| 91成人看片片| 国产精品久久一卡二卡| 免费在线看成人av| 在线国产亚洲欧美| 国产精品久久久久永久免费观看| 免费成人小视频| 日本韩国欧美一区二区三区| 久久久久久久久久久久电影 | 欧美日韩国产美| 国产精品五月天| 韩国av一区二区| 欧美精品自拍偷拍动漫精品| 亚洲人被黑人高潮完整版| 国产伦精一区二区三区| 欧美一区二区女人| 亚洲va欧美va人人爽午夜| 97精品超碰一区二区三区| 久久夜色精品国产噜噜av| 日日夜夜精品视频免费| 欧洲日韩一区二区三区| 中文字幕一区二区三区视频 | 国产精品视频一二三区| 国内精品国产成人| 精品理论电影在线| 蜜桃视频免费观看一区| 777欧美精品| 日本不卡视频一二三区| 欧美日韩一二三区| 亚洲高清视频在线| 欧美亚洲动漫另类| 亚洲在线免费播放| 91成人在线免费观看| 一区二区三区在线不卡| 在线视频国内自拍亚洲视频| 亚洲综合色噜噜狠狠| 欧美自拍丝袜亚洲| 亚洲电影在线免费观看| 精品视频在线视频| 丝袜美腿亚洲综合| 日韩视频免费观看高清完整版| 青青草原综合久久大伊人精品| 宅男在线国产精品| 九九**精品视频免费播放| 26uuu亚洲| 成人精品电影在线观看| 国产精品日韩成人| 日本韩国一区二区三区视频| 亚洲3atv精品一区二区三区| 3d动漫精品啪啪| 狠狠久久亚洲欧美| 国产精品电影一区二区| 在线观看91视频| 奇米影视一区二区三区| 久久色中文字幕| 成人福利视频在线| 亚洲国产成人高清精品| 欧美xxxxx牲另类人与| 福利一区福利二区| 一区二区三区加勒比av| 欧美日韩高清一区二区三区| 麻豆精品一二三| 国产精品久久午夜夜伦鲁鲁| 欧美日韩国产精品自在自线| 国内精品嫩模私拍在线| 国产精品美女久久久久久| 欧美亚洲综合一区| 国产乱淫av一区二区三区| 日韩理论片网站| 日韩精品一区二区三区三区免费| av激情亚洲男人天堂| 天天操天天综合网| 国产精品亲子乱子伦xxxx裸| 91麻豆精品国产无毒不卡在线观看| 国产麻豆精品95视频| 亚洲一区二区美女| 久久精品亚洲麻豆av一区二区| 欧美性猛交xxxx黑人交| 韩国女主播一区二区三区| 亚洲一区二区在线免费看| 国产午夜精品美女毛片视频| 911精品国产一区二区在线| 成人视屏免费看| 精品一区二区三区香蕉蜜桃| 亚洲国产成人tv| 国产精品欧美一区二区三区| 欧美xxxxxxxx| 7777精品久久久大香线蕉| 91在线视频网址| 高潮精品一区videoshd| 久久国产精品第一页| 亚洲成a人片在线观看中文| 国产精品毛片大码女人| 欧美精品一区二区三| 欧美一区二区三区影视| 欧美色老头old∨ideo| 97超碰欧美中文字幕| 粉嫩av一区二区三区| 久久99久久久久| 美女网站在线免费欧美精品| 天天综合网 天天综合色| 亚洲欧美日韩人成在线播放| 亚洲国产精品高清| 久久久国产午夜精品| xfplay精品久久| 久久精品视频免费观看| 久久久久久日产精品| 久久精品亚洲精品国产欧美kt∨| 久久综合九色综合久久久精品综合| 日韩一卡二卡三卡四卡| 日韩无一区二区| 日韩精品一区二| 久久久久久一二三区| 国产日韩影视精品| 国产精品美女一区二区在线观看| 欧美国产精品中文字幕| 中文在线一区二区| 国产精品福利一区二区| 亚洲天堂久久久久久久| 一个色妞综合视频在线观看| 午夜影院在线观看欧美| 精品一区二区三区久久| 美女精品自拍一二三四| 国产乱淫av一区二区三区| 丰满少妇在线播放bd日韩电影| 成人免费看片app下载| 北岛玲一区二区三区四区| 97久久超碰国产精品电影| 91黄色激情网站| 欧美精品v国产精品v日韩精品| 91精品国产色综合久久| 久久色视频免费观看| 亚洲欧美影音先锋| 亚洲成人av资源| 国产精一区二区三区| eeuss鲁片一区二区三区 | 蜜桃视频一区二区三区| 国产一区二区精品在线观看| www.日韩精品| 欧美日本国产一区| 国产亚洲人成网站| 亚洲曰韩产成在线| 精品亚洲porn| 日本高清无吗v一区| 日韩欧美你懂的| 日韩伦理av电影| 激情伊人五月天久久综合| av亚洲精华国产精华| 欧美一区二区成人6969| 国产精品久久久久aaaa| 日韩成人午夜电影| 一本一本大道香蕉久在线精品| 欧美mv日韩mv| 亚洲国产aⅴ天堂久久| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 |