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

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

?? os_task.c

?? 一個boot采集的測試程序!僅供ARM學習者參考。
?? 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一区二区三区免费野_久草精品视频
95精品视频在线| 91亚洲国产成人精品一区二三| 国产精品剧情在线亚洲| 久久一区二区三区四区| 日韩欧美国产综合| 日韩美女视频一区二区在线观看| 欧美丝袜丝nylons| 色欧美88888久久久久久影院| 99视频一区二区| jlzzjlzz亚洲日本少妇| 99久久国产综合精品麻豆 | 91网站最新地址| 成人黄色电影在线 | 久久精品国产一区二区三| 久久精品久久精品| 91女人视频在线观看| 色天天综合久久久久综合片| 欧美视频三区在线播放| 欧美精选午夜久久久乱码6080| 欧美日韩另类国产亚洲欧美一级| 欧美浪妇xxxx高跟鞋交| 欧美一区二区网站| 欧美成人官网二区| 中文字幕免费在线观看视频一区| 中文字幕日本乱码精品影院| 亚洲一区二区视频| 麻豆国产精品官网| 成人av网站大全| 99久久免费视频.com| 欧美性猛交xxxx黑人交| 精品国产sm最大网站免费看| 中文字幕乱码日本亚洲一区二区| 亚洲欧美成aⅴ人在线观看| 天天影视色香欲综合网老头| 九九精品视频在线看| 色综合久久综合中文综合网| 日韩片之四级片| 亚洲欧洲成人自拍| 免费在线视频一区| jizzjizzjizz欧美| 欧美一区二区视频在线观看2022| 国产视频一区在线播放| 一级精品视频在线观看宜春院| 免费在线观看一区| 91高清在线观看| 久久亚洲影视婷婷| 午夜精品一区二区三区免费视频 | 欧美色精品在线视频| 精品国产一区二区三区不卡| 国产精品理伦片| 久久草av在线| 欧洲av一区二区嗯嗯嗯啊| 26uuu国产在线精品一区二区| 一区二区成人在线| 成人av资源站| 欧美精品一区二区三区很污很色的 | 亚洲国产成人porn| 99久久国产综合精品女不卡| 久久久.com| 精彩视频一区二区| 欧美丰满嫩嫩电影| 亚洲精品久久嫩草网站秘色| 国产成人精品一区二| 欧美精品一区二区三区在线播放 | 欧美一区二区三区免费大片| 亚洲综合色丁香婷婷六月图片| 国产99精品在线观看| 精品国产乱码久久久久久图片| 午夜精品福利视频网站| 91麻豆产精品久久久久久| 国产清纯在线一区二区www| 国产在线精品一区二区三区不卡 | 亚洲国产另类精品专区| 日本高清视频一区二区| 亚洲免费色视频| 91在线视频观看| 成人免费在线视频| 99国产欧美另类久久久精品| 国产精品美女久久久久aⅴ国产馆| 国产永久精品大片wwwapp| 日韩欧美电影在线| 国产一区二区福利视频| 国产日韩v精品一区二区| 成人性生交大片免费看视频在线 | 日韩丝袜情趣美女图片| 天天亚洲美女在线视频| 91精品福利在线一区二区三区 | 97久久精品人人做人人爽50路| 国产精品高潮久久久久无| 不卡一区二区在线| 亚洲人被黑人高潮完整版| 91成人免费在线视频| 亚洲h精品动漫在线观看| 欧美日韩久久久一区| 日日摸夜夜添夜夜添亚洲女人| 日韩一级片网站| 国产夫妻精品视频| 亚洲天堂精品视频| 91精品午夜视频| 国产一区二区成人久久免费影院| 国产精品剧情在线亚洲| 欧美调教femdomvk| 激情伊人五月天久久综合| 亚洲国产精品99久久久久久久久| 91久久久免费一区二区| 免费视频一区二区| 国产精品久久99| 欧美一级高清片在线观看| 成人午夜电影小说| 亚洲成人福利片| 国产欧美日韩综合| 精品视频123区在线观看| 国产一区二区不卡| 亚洲一线二线三线视频| 精品久久99ma| 欧美亚洲动漫精品| 国产一区二区三区四区五区入口| 亚洲精品国产品国语在线app| 日韩欧美在线一区二区三区| 99久久精品国产一区二区三区| 奇米精品一区二区三区在线观看 | 国产福利一区二区三区视频| 亚洲制服丝袜一区| 久久久国际精品| 制服丝袜亚洲网站| 欧美亚洲国产一区二区三区va| 国产精品一区三区| 奇米888四色在线精品| 亚洲人成7777| 国产精品传媒在线| 精品盗摄一区二区三区| 欧美色综合久久| 国产伦精品一区二区三区免费| 亚洲综合图片区| 国产精品乱人伦一区二区| wwww国产精品欧美| 日韩免费看的电影| 欧美另类videos死尸| 在线中文字幕不卡| 91老师片黄在线观看| 成人国产精品视频| 国产一区91精品张津瑜| 久久国内精品自在自线400部| 亚洲国产成人高清精品| 一区二区三区四区高清精品免费观看| 欧美激情一区三区| 亚洲国产精品二十页| 亚洲国产精品av| 国产精品免费观看视频| 8x福利精品第一导航| 欧美羞羞免费网站| 色综合网色综合| eeuss影院一区二区三区 | 亚洲欧美偷拍三级| 国产精品卡一卡二卡三| 亚洲天天做日日做天天谢日日欢| 中文字幕中文字幕在线一区| 日韩一区在线看| 亚洲综合在线电影| 午夜精品福利一区二区蜜股av| 午夜久久久久久电影| 日本色综合中文字幕| 久久国产欧美日韩精品| 黑人巨大精品欧美黑白配亚洲| 精品中文字幕一区二区| 国产呦萝稀缺另类资源| 波多野结衣的一区二区三区| 99久久99久久精品免费看蜜桃| 99精品在线免费| 欧美日韩美女一区二区| 欧美一区二区三区思思人| 久久人人爽爽爽人久久久| 国产精品情趣视频| 一区二区三区四区不卡在线| 日韩综合小视频| 国产精品一区二区黑丝| av毛片久久久久**hd| 欧美日韩一二三| 精品美女被调教视频大全网站| 中文欧美字幕免费| 亚洲一区二区三区在线看| 日韩成人伦理电影在线观看| 国内精品免费在线观看| 91麻豆蜜桃一区二区三区| 欧美一区午夜视频在线观看| 精品久久人人做人人爰| 亚洲精品欧美综合四区| 激情五月激情综合网| 91麻豆国产福利精品| 26uuu国产电影一区二区| 亚洲一线二线三线视频| 国产福利视频一区二区三区| 欧美日韩另类国产亚洲欧美一级| 久久九九久精品国产免费直播| 亚洲永久免费av| 成人激情校园春色| 欧美一区二区三区免费观看视频| 国产精品第五页| 国产美女av一区二区三区| 欧美日韩精品系列|