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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_task.c

?? ARM7開發(fā)全部源代碼經(jīng)典.rar
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av电影天堂一区二区在线| 中文字幕不卡一区| 日韩黄色小视频| 在线播放91灌醉迷j高跟美女 | 色综合久久久久久久| 亚洲欧美另类在线| 久久成人免费网站| 日韩一级片在线播放| 91免费国产在线| 99久久精品免费看国产| 欧美色视频在线| 精品国产乱子伦一区| 日韩精品一区二区三区老鸭窝 | 大胆欧美人体老妇| 久久精品一二三| jlzzjlzz国产精品久久| 亚洲国产日韩一区二区| 欧美成人精精品一区二区频| 高清beeg欧美| 天天影视涩香欲综合网| 久久久精品免费观看| 色综合咪咪久久| 欧美一二三四区在线| 国内不卡的二区三区中文字幕| 日本一区二区视频在线观看| 91精品福利视频| 激情文学综合丁香| 亚洲午夜电影在线| 久久精品视频在线免费观看| 欧美三级视频在线播放| 国产寡妇亲子伦一区二区| 亚洲午夜久久久久久久久久久| 欧美本精品男人aⅴ天堂| 91久久久免费一区二区| 国内精品第一页| 亚洲电影在线免费观看| 中国色在线观看另类| 欧美一级电影网站| 91久久精品日日躁夜夜躁欧美| 国产河南妇女毛片精品久久久| 午夜视频久久久久久| 成人免费小视频| 久久蜜桃香蕉精品一区二区三区| 欧美在线一二三四区| 成人99免费视频| 激情综合亚洲精品| 日韩高清国产一区在线| 亚洲欧美日韩国产另类专区| 欧美v日韩v国产v| 欧美日韩卡一卡二| 91天堂素人约啪| 成人av在线电影| 黄色小说综合网站| 蜜桃视频一区二区三区在线观看| 亚洲乱码中文字幕| 亚洲欧洲av一区二区三区久久| 精品国产一区二区三区四区四| 欧美日韩高清在线播放| 欧美综合一区二区| 91福利社在线观看| 91视视频在线直接观看在线看网页在线看| 国产精品资源站在线| 麻豆91精品91久久久的内涵| 午夜电影一区二区三区| 国产真实乱偷精品视频免| 久久久影视传媒| 欧美精品电影在线播放| 日本久久一区二区| 成人免费观看av| 国产a久久麻豆| 成人午夜视频福利| 福利一区福利二区| 成人小视频免费在线观看| 国产精品12区| 高清beeg欧美| av高清不卡在线| 色呦呦日韩精品| 欧美四级电影在线观看| 欧美三级视频在线观看| 日韩一级片在线观看| 精品国产在天天线2019| 久久精品视频一区二区三区| 国产日韩精品一区二区三区| 久久老女人爱爱| 中文字幕欧美日本乱码一线二线 | 91精品国产91久久综合桃花| 欧美精品久久天天躁| 欧美一级片在线看| 2020国产精品久久精品美国| 国产欧美日韩综合| 亚洲人亚洲人成电影网站色| 亚洲一级二级三级| 麻豆一区二区三| 国产精品一区在线观看你懂的| 粉嫩嫩av羞羞动漫久久久 | 亚洲天堂成人网| 亚洲精品v日韩精品| 午夜精品久久久久影视| 美女网站一区二区| 成人午夜短视频| 色噜噜久久综合| 欧美一卡2卡三卡4卡5免费| 26uuu亚洲婷婷狠狠天堂| 国产精品成人在线观看| 亚洲超丰满肉感bbw| 国产一区二区福利视频| 91麻豆国产福利精品| 欧美一级日韩不卡播放免费| 中文字幕乱码久久午夜不卡| 国产精品18久久久久久久久 | 亚洲18女电影在线观看| 久久电影网电视剧免费观看| 91在线观看一区二区| 欧美军同video69gay| 国产午夜一区二区三区| 亚洲成人综合网站| 国产风韵犹存在线视精品| 欧洲精品在线观看| 久久老女人爱爱| 日韩在线观看一区二区| 成人免费看片app下载| 91精品国产91久久久久久一区二区 | 欧美国产日产图区| 亚洲一二三专区| 国产精品中文字幕欧美| 欧美男男青年gay1069videost| 国产亚洲成av人在线观看导航| 亚洲午夜精品在线| 丁香婷婷深情五月亚洲| 日韩免费一区二区三区在线播放| 亚洲丝袜自拍清纯另类| 国产精品中文字幕一区二区三区| 欧美日韩高清一区二区| 亚洲视频在线一区二区| 国产成人亚洲综合a∨猫咪| 8x福利精品第一导航| 亚洲卡通欧美制服中文| 欧美一区二区视频在线观看2020| 欧美韩日一区二区三区| 久久精品国产精品亚洲综合| 欧美午夜视频网站| 亚洲视频一区在线观看| 国产精品一区二区在线播放| 日韩欧美色综合网站| 午夜精品久久久久久不卡8050| 91免费版在线| 中文字幕制服丝袜一区二区三区| 精品影视av免费| 欧美精品日韩一区| 亚洲高清中文字幕| 欧美亚洲自拍偷拍| 一区二区三区四区亚洲| 99精品视频在线免费观看| 国产女人aaa级久久久级 | 日韩vs国产vs欧美| 在线中文字幕一区二区| 亚洲欧美激情一区二区| 99久久99久久免费精品蜜臀| 国产精品女主播av| 丁香天五香天堂综合| 国产欧美一区二区三区鸳鸯浴| 国产美女一区二区三区| 久久久美女毛片| 国产精品亚洲一区二区三区妖精 | 免费人成在线不卡| 欧美日韩高清一区| 午夜精品久久久久久久久久| 9191久久久久久久久久久| 天天综合网天天综合色| 91精品福利在线一区二区三区| 秋霞影院一区二区| 欧美大片在线观看| 久久成人羞羞网站| 久久这里都是精品| 国产精品小仙女| 亚洲视频一二三| 欧美三级电影一区| 青青草97国产精品免费观看无弹窗版| 91精品国产高清一区二区三区 | 日本成人超碰在线观看| 欧美一区二区三区系列电影| 久久成人免费日本黄色| 欧美国产日韩在线观看| 日本高清不卡视频| 奇米综合一区二区三区精品视频| 精品国精品自拍自在线| 高清国产一区二区| 亚洲综合在线五月| 欧美大胆一级视频| 国产大片一区二区| 一区av在线播放| 精品久久久三级丝袜| www.日韩av| 亚洲一区二区免费视频| 精品国产伦一区二区三区免费| 99视频一区二区| 日韩不卡一区二区| 亚洲欧洲日韩女同| 91精品国产品国语在线不卡| 国产成人av电影在线|