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

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

?? os_task._c

?? ucos如何移植到單片機mega128
?? _C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                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 "..\ucos2_application\includes.h"
#endif

#if !defined(__UCOS_II_H)
	#include "..\ucos2_without_cpu\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.
*********************************************************************************************************
*/

#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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲色大大久久| 日本va欧美va欧美va精品| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产精品二区一区二区aⅴ污介绍| 亚洲成a人片综合在线| 欧洲精品一区二区| 国产精品久久二区二区| 成人三级伦理片| 中文字幕永久在线不卡| 色综合中文字幕| 亚洲成人资源网| 欧美成人午夜电影| 成人综合婷婷国产精品久久| 国产精品污www在线观看| 成人高清免费观看| 亚洲色大成网站www久久九九| 成人免费精品视频| 综合色天天鬼久久鬼色| www.爱久久.com| 中文字幕日本乱码精品影院| 国产精品一区二区久久不卡| 欧美精品一区二区久久久| 日本欧洲一区二区| 欧美精品一区二区三区四区| 国产精品一区二区三区四区| 亚洲人吸女人奶水| 欧美一级在线视频| 不卡一区二区中文字幕| 一区二区在线观看视频在线观看| aaa亚洲精品| 亚洲风情在线资源站| 久久久亚洲综合| 5566中文字幕一区二区电影| 成人中文字幕合集| 麻豆国产精品视频| 亚洲一区中文日韩| 国产女主播一区| 在线综合视频播放| 欧美视频在线一区| 不卡视频在线看| 国产99精品国产| 久久国产精品99久久久久久老狼| **欧美大码日韩| 久久嫩草精品久久久久| 3d动漫精品啪啪1区2区免费| 色老综合老女人久久久| 91免费观看在线| 99久久99久久精品国产片果冻| 天天综合网 天天综合色| 综合欧美亚洲日本| 国产日韩v精品一区二区| 亚洲精品在线电影| 欧美大白屁股肥臀xxxxxx| 91精品在线观看入口| 日韩欧美一级二级三级 | 日本一区二区三区国色天香| 精品国产sm最大网站| 在线播放中文字幕一区| 欧美顶级少妇做爰| 欧美在线播放高清精品| 欧美日韩一区二区三区四区| 91视视频在线观看入口直接观看www| 懂色av一区二区三区免费看| 成人免费视频播放| 精品视频色一区| 精品国产亚洲在线| 精品av久久707| 亚洲日本欧美天堂| 亚洲成人黄色影院| 国产成人久久精品77777最新版本| 毛片基地黄久久久久久天堂| 成人黄色小视频在线观看| 99久免费精品视频在线观看 | 成人一区二区三区视频| 成人久久视频在线观看| 欧美在线观看视频在线| 精品少妇一区二区三区在线播放 | 国产美女一区二区三区| 欧美色综合网站| 亚洲欧美自拍偷拍色图| 日韩av电影一区| 91蝌蚪国产九色| 久久综合九色综合97婷婷女人| 亚洲国产岛国毛片在线| 美女视频黄免费的久久| 欧美性猛片aaaaaaa做受| 国产欧美日韩在线看| 日韩激情av在线| 欧洲一区二区三区免费视频| 日本一区二区综合亚洲| 三级成人在线视频| 日本韩国欧美一区| 国产精品久久久久9999吃药| 青青草视频一区| 欧美日韩综合在线| 亚洲观看高清完整版在线观看| 国产在线乱码一区二区三区| 欧美群妇大交群的观看方式| 国产精品久久久久久久岛一牛影视 | 婷婷国产v国产偷v亚洲高清| 91福利国产精品| 国产精品女上位| 91麻豆免费观看| 亚洲欧洲综合另类在线| 91香蕉视频mp4| 亚洲欧美一区二区三区国产精品 | 国产欧美日韩在线看| 99在线热播精品免费| 国产精品每日更新| 91麻豆国产香蕉久久精品| 日本一区二区三区视频视频| 97精品久久久久中文字幕| 亚洲精品高清在线| 色婷婷久久综合| 亚洲国产精品久久久男人的天堂 | 国产精品一二三区在线| 亚洲国产成人av网| 成人av网在线| 欧美xxxxxxxx| 日韩国产精品大片| 欧美日韩一区二区在线观看视频| 国产精品欧美久久久久无广告| 激情综合色播五月| 欧美福利电影网| 五月天亚洲精品| 日本高清无吗v一区| 成人免费小视频| 成人美女视频在线观看| 精品国产乱码久久久久久夜甘婷婷 | 麻豆极品一区二区三区| 欧美日本高清视频在线观看| 亚洲欧美一区二区三区极速播放| 成人教育av在线| 中文字幕精品一区二区精品绿巨人 | 欧洲色大大久久| 欧美色综合久久| 精品成人佐山爱一区二区| 亚洲国产美国国产综合一区二区 | 欧美电影一区二区| 亚洲二区在线视频| 欧美亚一区二区| 亚洲精品欧美综合四区| 色八戒一区二区三区| 一区二区三区视频在线看| 在线欧美日韩国产| 亚洲一区二区影院| 欧美少妇性性性| 婷婷久久综合九色综合绿巨人 | 欧美日韩午夜在线| 午夜国产不卡在线观看视频| 欧美日韩一级大片网址| 五月婷婷激情综合| 91精品国产入口| 久久99久久99| 久久亚区不卡日本| 国产精品996| 国产精品另类一区| 99久久国产综合精品麻豆| 亚洲最新视频在线观看| 777色狠狠一区二区三区| 精品一二三四区| 国产女人aaa级久久久级| 91免费精品国自产拍在线不卡| 一区二区三区高清| 日韩一区二区在线看| 国产成人免费视频网站高清观看视频| 国产欧美一区二区精品秋霞影院 | 欧美视频在线一区二区三区| 日本怡春院一区二区| 久久久99精品免费观看不卡| 色综合天天视频在线观看| 偷拍日韩校园综合在线| 久久综合九色综合97婷婷| av电影在线观看不卡| 亚洲精品成人在线| 日韩欧美一级二级| 盗摄精品av一区二区三区| 亚洲国产乱码最新视频| 欧美大片日本大片免费观看| 91免费国产在线| 极品少妇xxxx精品少妇| 伊人性伊人情综合网| 欧美不卡一区二区三区| 99国产麻豆精品| 蜜臀久久久久久久| 亚洲天堂av老司机| 精品国产伦一区二区三区观看方式| 91在线看国产| 美女久久久精品| 一区二区三区国产| 国产亚洲污的网站| 欧美一区二区性放荡片| 99视频热这里只有精品免费| 久久精品国内一区二区三区 | 久久99精品国产91久久来源| 亚洲色图欧美激情| 久久久久国产免费免费| 69p69国产精品| 一本一道久久a久久精品| 国产一区二区三区免费看|