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

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

?? os_task.c

?? ucosii小實(shí)驗(yàn)任務(wù)五 時(shí)鐘中斷
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_TASK.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.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.
*********************************************************************************************************
*/

#if OS_TASK_CHANGE_PRIO_EN > 0
INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR    cpu_sr;
#endif

#if OS_EVENT_EN > 0
    OS_EVENT    *pevent;
#endif

    OS_TCB      *ptcb;
    INT8U        x;
    INT8U        y;
    INT8U        bitx;
    INT8U        bity;



#if OS_ARG_CHK_EN > 0
    if ((oldprio >= OS_LOWEST_PRIO && oldprio != OS_PRIO_SELF)  ||
         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);
    } else {
        OSTCBPrioTbl[newprio] = (OS_TCB *)1;                    /* Reserve the entry to prevent others */
        OS_EXIT_CRITICAL();
        y    = newprio >> 3;                                    /* Precompute to reduce INT. latency   */
        bity = OSMapTbl[y];
        x    = newprio & 0x07;
        bitx = OSMapTbl[x];
        OS_ENTER_CRITICAL();
        if (oldprio == OS_PRIO_SELF) {                          /* See if changing self                */
            oldprio = OSTCBCur->OSTCBPrio;                      /* Yes, get priority                   */
        }
        ptcb = OSTCBPrioTbl[oldprio];
        if (ptcb != (OS_TCB *)0) {                              /* Task to change must exist           */
            OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                /* Remove TCB from old priority        */
            if ((OSRdyTbl[ptcb->OSTCBY] & ptcb->OSTCBBitX) != 0x00) {  /* If task is ready make it not */
                if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0x00) {
                    OSRdyGrp &= ~ptcb->OSTCBBitY;
                }
                OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
                OSRdyTbl[y] |= bitx;
#if OS_EVENT_EN > 0
            } else {
                pevent = ptcb->OSTCBEventPtr;
                if (pevent != (OS_EVENT *)0) {                  /* Remove from event wait list  */
                    if ((pevent->OSEventTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
                        pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
                    }
                    pevent->OSEventGrp    |= bity;              /* Add new priority to wait list       */
                    pevent->OSEventTbl[y] |= bitx;
                }
#endif
            }
            OSTCBPrioTbl[newprio] = ptcb;                       /* Place pointer to TCB @ new priority */
            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);
        } else {
            OSTCBPrioTbl[newprio] = (OS_TCB *)0;                /* Release the reserved prio.          */
            OS_EXIT_CRITICAL();
            return (OS_PRIO_ERR);                               /* Task to change didn't exist         */
        }
    }
}
#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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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)
*********************************************************************************************************
*/

#if OS_TASK_CREATE_EN > 0
INT8U  OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT8U prio)
{
#if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr;
#endif
    OS_STK    *psp;
    INT8U      err;


#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 (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, pdata, 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) {
            OS_ENTER_CRITICAL();
            OSTaskCtr++;                                        /* Increment the #tasks counter        */
            OS_EXIT_CRITICAL();
            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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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.  'pstk' 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.
*                       For example, this user memory can hold the contents of floating-point registers
*                       during a context switch, the time each task takes to execute, the number of times
*                       the task has been switched-in, etc.
*
*              opt      contains additional information (or options) about the behavior of the task.  The
*                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application
*                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲愉拍一区二区| 日韩一级完整毛片| 午夜不卡在线视频| 日本一区二区视频在线观看| 欧美视频自拍偷拍| 国产一区二区0| 亚洲一区在线观看网站| 国产亚洲欧洲一区高清在线观看| 欧美日韩亚洲不卡| 国产+成+人+亚洲欧洲自线| 洋洋av久久久久久久一区| 国产日韩欧美精品综合| 欧美美女一区二区在线观看| 99re这里只有精品6| 国内一区二区视频| 日韩专区中文字幕一区二区| 亚洲婷婷综合久久一本伊一区| 精品国产乱码久久久久久闺蜜 | 日韩欧美一区电影| 色网站国产精品| 懂色av一区二区三区免费看| 蜜桃av一区二区在线观看| 亚洲一区二区三区四区的| 亚洲精品少妇30p| 国产精品看片你懂得| 欧美大片免费久久精品三p| 欧美夫妻性生活| 欧美日韩三级一区| 91国产丝袜在线播放| 99国产麻豆精品| 成人app软件下载大全免费| 成人综合婷婷国产精品久久| 国产在线一区观看| 国产乱码一区二区三区| 国产裸体歌舞团一区二区| 韩国女主播一区二区三区| 免费在线观看成人| 日本特黄久久久高潮| 视频一区二区欧美| 美女mm1313爽爽久久久蜜臀| 日韩不卡一二三区| 美日韩黄色大片| 久久精品国产亚洲5555| 国产一区二区三区美女| 韩国成人精品a∨在线观看| 黄色资源网久久资源365| 精品一区二区日韩| 九九**精品视频免费播放| 激情图片小说一区| 成人午夜在线免费| 97久久久精品综合88久久| 日本高清不卡视频| 精品婷婷伊人一区三区三| 欧美久久久久中文字幕| 日韩一级大片在线观看| 精品国产不卡一区二区三区| 国产婷婷色一区二区三区| 日本一区二区成人在线| 一区二区三区不卡视频| 日韩av一级片| 国产乱人伦偷精品视频免下载| 国产成人精品网址| 色噜噜夜夜夜综合网| 欧美日韩一区二区欧美激情| 欧美成人a在线| 中文字幕精品三区| 亚洲国产欧美日韩另类综合| 免费人成在线不卡| 国产福利一区二区三区视频在线| 99久久国产综合色|国产精品| 欧美性色综合网| 欧美大肚乱孕交hd孕妇| 国产精品久久久久久久久果冻传媒 | 亚洲成a人v欧美综合天堂| 免费在线看成人av| 成人av在线看| 欧美精品一二三| 国产欧美综合在线观看第十页| 亚洲日本va午夜在线影院| 婷婷开心久久网| 成人精品视频一区二区三区| 在线视频欧美精品| 久久影院视频免费| 亚洲精选在线视频| 狠狠狠色丁香婷婷综合久久五月| 99国产欧美久久久精品| 日韩女同互慰一区二区| 亚洲精品综合在线| 久久99最新地址| 在线观看中文字幕不卡| 国产午夜精品一区二区三区视频 | 国产麻豆精品久久一二三| 日本久久一区二区| 精品日韩一区二区三区免费视频| 成人欧美一区二区三区视频网页| 三级成人在线视频| 99re热视频精品| 日韩欧美在线综合网| 亚洲欧美另类小说视频| 国产毛片精品国产一区二区三区| 欧美无砖专区一中文字| 国产精品美女久久久久久久久| 免费在线看成人av| 欧美三级中文字幕| 中文字幕亚洲区| 国产精品18久久久久久久久久久久| 欧美日韩另类一区| 亚洲猫色日本管| 国产成人午夜视频| 精品日韩欧美一区二区| 视频一区欧美日韩| 色94色欧美sute亚洲线路一久| 国产午夜精品一区二区三区嫩草 | 欧美性受极品xxxx喷水| 国产精品免费视频观看| 久久99久久久欧美国产| 欧美日韩在线不卡| 亚洲精品免费在线播放| 波多野结衣的一区二区三区| 国产视频在线观看一区二区三区| 婷婷久久综合九色国产成人 | 国产成人一区在线| 精品国产乱码久久久久久图片| 亚洲不卡一区二区三区| 欧美无人高清视频在线观看| 亚洲精品久久久蜜桃| 麻豆国产精品一区二区三区| 成人av影院在线| 久久久三级国产网站| 久久aⅴ国产欧美74aaa| 日韩欧美国产一二三区| 日韩电影在线观看电影| 欧美另类高清zo欧美| 日韩中文字幕麻豆| 在线成人av影院| 日韩vs国产vs欧美| 日韩欧美一级二级| 蜜桃av一区二区| 日韩精品一区二区三区在线 | 精品国产欧美一区二区| 美洲天堂一区二卡三卡四卡视频| 91.com视频| 麻豆91精品91久久久的内涵| 日韩午夜激情视频| 国内精品免费在线观看| 26uuu精品一区二区三区四区在线| 精品一区中文字幕| 久久久久久97三级| 成人免费视频免费观看| 成人欧美一区二区三区在线播放| 色哟哟国产精品| 午夜精品在线看| 精品毛片乱码1区2区3区| 国产一区二区三区免费在线观看| 久久综合一区二区| 丁香桃色午夜亚洲一区二区三区| 国产精品久久久久影院老司| 一本色道亚洲精品aⅴ| 亚洲人成小说网站色在线 | 成年人国产精品| 亚洲欧美一区二区三区极速播放 | 久久精品国产亚洲aⅴ| 久久久国产一区二区三区四区小说 | 91美女视频网站| 亚洲一区二区三区四区五区黄| 欧美乱妇20p| 国产成人精品在线看| 一区二区三区四区在线| 日韩亚洲电影在线| 成人高清视频免费观看| 亚洲国产美女搞黄色| 精品成a人在线观看| 99精品视频一区| 亚洲va欧美va天堂v国产综合| 日韩免费看的电影| 91免费国产在线| 免费视频一区二区| 亚洲色欲色欲www| 91麻豆精品国产无毒不卡在线观看| 国产自产高清不卡| 亚洲六月丁香色婷婷综合久久| 91精品综合久久久久久| 国产91露脸合集magnet| 亚洲国产精品麻豆| 国产日韩欧美精品在线| 欧美性大战久久久久久久| 国产成人av电影| 日韩二区三区在线观看| 专区另类欧美日韩| 日韩精品在线看片z| 欧美性生活久久| 成人爽a毛片一区二区免费| 蜜臀久久99精品久久久久宅男 | 久久久99精品免费观看| 欧美吞精做爰啪啪高潮| 国产成人av一区二区三区在线| 亚洲3atv精品一区二区三区| 欧美国产一区二区在线观看| 91精品国产色综合久久不卡蜜臀 | 国产成人丝袜美腿|