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

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

?? os_task.c

?? UCOS-II在ARM S3C44B0X上的移植源代碼。 移植說明: 我沒有移植uCOS前
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2001, 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                   */
        }
        if ((ptcb = OSTCBPrioTbl[oldprio]) != (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 {
                if ((pevent = ptcb->OSTCBEventPtr) != (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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩一区| 国产成人精品免费网站| 久久精品国产999大香线蕉| 国产成都精品91一区二区三| 欧美性videosxxxxx| 亚洲国产精品激情在线观看| 免费精品视频在线| 在线免费观看一区| 国产精品欧美久久久久一区二区| 日韩成人一级大片| 欧美羞羞免费网站| 亚洲人精品一区| 国产成人在线免费| 久久久久久久久蜜桃| 五月天精品一区二区三区| 色综合天天综合给合国产| 日本一区二区免费在线观看视频| 久久精品国产第一区二区三区| 欧美日韩国产成人在线免费| 一区二区三区在线免费视频| 成人久久视频在线观看| 国产片一区二区三区| 精品亚洲aⅴ乱码一区二区三区| 欧美久久久影院| 亚洲福利视频三区| 欧美日韩aaaaaa| 亚瑟在线精品视频| 欧美夫妻性生活| 亚洲成a人v欧美综合天堂下载| 色综合色狠狠综合色| 国产精品久久久久久久久免费相片| 国产精品中文有码| 国产午夜亚洲精品羞羞网站| 国产九色精品成人porny| 欧美精品一区视频| 国产一区二区三区免费播放| 久久久影视传媒| 国产精品一级二级三级| 亚洲国产成人一区二区三区| 国产91精品久久久久久久网曝门| 国产三级欧美三级日产三级99 | 日韩毛片在线免费观看| 成人激情开心网| 亚洲欧洲制服丝袜| 日本韩国欧美三级| 午夜免费欧美电影| 欧美www视频| 粉嫩高潮美女一区二区三区| 国产精品免费观看视频| 91福利在线播放| 水野朝阳av一区二区三区| 欧美成人官网二区| 成人精品国产免费网站| 一区二区理论电影在线观看| 欧美高清视频www夜色资源网| 久久爱www久久做| 欧美国产日本韩| 欧美性猛交xxxx乱大交退制版| 蜜臀精品一区二区三区在线观看| 精品成人a区在线观看| 99国产精品一区| 三级久久三级久久久| 久久久精品tv| 在线观看欧美黄色| 激情综合网天天干| 成人欧美一区二区三区在线播放| 欧美日本视频在线| 国产成人免费视频一区| 亚洲国产中文字幕在线视频综合| 日韩视频不卡中文| 94-欧美-setu| 麻豆精品一区二区三区| 亚洲欧美一区二区久久 | 91小视频免费看| 日韩成人免费在线| 综合网在线视频| 日韩精品一区二区三区在线观看 | 日韩一区二区在线观看视频播放| 丁香婷婷深情五月亚洲| 午夜影院在线观看欧美| 久久综合九色综合97_久久久| 色菇凉天天综合网| 国产精品一区久久久久| 日韩精品欧美成人高清一区二区| 中文字幕第一区| 日韩女优视频免费观看| 欧美性大战久久久久久久蜜臀| 国内精品伊人久久久久影院对白| 亚洲地区一二三色| 中文字幕亚洲一区二区av在线| 欧美成人三级在线| 欧美日韩国产综合久久| 99精品热视频| 成人免费毛片高清视频| 99在线精品一区二区三区| 天堂成人国产精品一区| 亚洲精品视频一区| 中文字幕av在线一区二区三区| 日韩欧美久久久| 欧美丰满一区二区免费视频| 色综合久久综合网欧美综合网| 国产99久久久国产精品潘金 | 亚洲免费大片在线观看| 欧美激情一区二区三区在线| 日韩精品专区在线| 欧美一区二区不卡视频| 在线不卡欧美精品一区二区三区| 91原创在线视频| 91网站黄www| 91蝌蚪porny九色| 91色.com| 色综合久久99| 在线一区二区三区做爰视频网站| 99国产欧美久久久精品| 色综合天天性综合| 97久久超碰国产精品电影| 91在线视频网址| 91浏览器在线视频| 在线精品视频免费观看| 色天使色偷偷av一区二区| 91高清视频在线| 欧美日韩午夜精品| 91精品国产综合久久久久久| 欧美一区二区日韩| 日韩欧美一级二级三级久久久| 日韩美女视频一区二区在线观看| 欧美tickling挠脚心丨vk| 久久免费电影网| 中文字幕永久在线不卡| 一区二区三区在线免费| 午夜精品在线看| 蜜桃久久精品一区二区| 国产福利不卡视频| eeuss影院一区二区三区| 色噜噜狠狠成人中文综合 | 亚洲国产成人tv| 免费xxxx性欧美18vr| 91丨porny丨蝌蚪视频| 欧美日韩中文精品| 日韩欧美www| 中文字幕在线不卡一区| 亚洲综合男人的天堂| 日韩av电影免费观看高清完整版 | 在线观看日韩国产| 日韩美一区二区三区| 欧美国产精品一区二区三区| 亚洲精品成人a在线观看| 日本美女视频一区二区| 处破女av一区二区| 欧美色图免费看| 久久久精品人体av艺术| 一区二区视频免费在线观看| 麻豆国产精品777777在线| 粉嫩13p一区二区三区| 欧美唯美清纯偷拍| 久久综合九色综合97婷婷| 亚洲精品免费在线| 国内外成人在线| 欧美性受极品xxxx喷水| 久久―日本道色综合久久| 一区二区成人在线| 国产精品77777| 欧美三区在线观看| 国产欧美精品国产国产专区| 三级一区在线视频先锋| 99久久伊人久久99| 亚洲精品一区二区三区蜜桃下载 | 国产精品系列在线| 日韩精品欧美精品| 色哟哟精品一区| 国产午夜亚洲精品理论片色戒 | 国产精品国产三级国产aⅴ入口 | 国产大陆a不卡| 在线综合视频播放| 亚洲麻豆国产自偷在线| 国产精品一区二区三区四区| 91精品综合久久久久久| 一区二区三区加勒比av| 国产成人在线观看免费网站| 日韩一级完整毛片| 亚洲电影视频在线| 一本一道久久a久久精品综合蜜臀| 国产亚洲精品精华液| 蜜臀91精品一区二区三区| 欧美日韩中字一区| 亚洲乱码日产精品bd| 波多野结衣中文字幕一区 | 国产精品久久久久影视| 狠狠色丁香婷综合久久| 欧美顶级少妇做爰| 午夜欧美视频在线观看| 欧美三级视频在线播放| 一区二区三区在线视频播放| 一本一道综合狠狠老| 综合久久久久综合| 91小视频免费观看| 亚洲免费在线看| 一本大道av一区二区在线播放| 国产精品久久毛片a| 不卡一区二区在线|