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

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

?? os_task.c

?? 這是AVR單片機移植UCOS
?? C
?? 第 1 頁 / 共 4 頁
字號:
*                                    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.
*                        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.  Current choices are:
*
*                        OS_TASK_OPT_STK_CHK      Stack checking to be allowed for the task
*                        OS_TASK_OPT_STK_CLR      Clear the stack when the task is created
*                        OS_TASK_OPT_SAVE_FP      If the CPU has floating-point registers, save them
*                                                 during a context switch.
*
* Returns    : OS_ERR_NONE             if the function was successful.
*              OS_PRIO_EXIT            if the task priority already exist
*                                      (each task MUST have a unique priority).
*              OS_ERR_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.
*********************************************************************************************************
*/
/*$PAGE*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskCreateExt (void   (*task)(void *p_arg),
                        void    *p_arg,
                        OS_STK  *ptos,
                        INT8U    prio,
                        INT16U   id,
                        OS_STK  *pbos,
                        INT32U   stk_size,
                        void    *pext,
                        INT16U   opt)
{
    OS_STK    *psp;
    INT8U      err;
#if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_ERR_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_RESERVED;/* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();

#if (OS_TASK_STAT_STK_CHK_EN > 0)
        OS_TaskStkClr(pbos, stk_size, opt);                    /* Clear the task stack (if needed)     */
#endif

        psp = OSTaskStkInit(task, p_arg, ptos, opt);           /* Initialize the task's stack          */
        err = OS_TCBInit(prio, psp, pbos, id, stk_size, pext, opt);
        if (err == OS_ERR_NONE) {
            if (OSRunning == OS_TRUE) {                        /* Find HPT if multitasking has started */
                OS_Sched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;                  /* Make this priority avail. to others  */
            OS_EXIT_CRITICAL();
        }
        return (err);
    }
    OS_EXIT_CRITICAL();
    return (OS_ERR_PRIO_EXIST);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            DELETE A TASK
*
* Description: This function allows you to delete a task.  The calling task can delete itself by
*              its own priority number.  The deleted task is returned to the dormant state and can be
*              re-activated by creating the deleted task again.
*
* Arguments  : prio    is the priority of the task to delete.  Note that you can explicitely delete
*                      the current task without knowing its priority level by setting 'prio' to
*                      OS_PRIO_SELF.
*
* Returns    : OS_ERR_NONE             if the call is successful
*              OS_ERR_TASK_DEL_IDLE    if you attempted to delete uC/OS-II's idle task
*              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
*                                      (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_ERR_TASK_DEL         if the task is assigned to a Mutex PIP.   
*              OS_ERR_TASK_NOT_EXIST   if the task you want to delete does not exist.
*              OS_ERR_TASK_DEL_ISR     if you tried to delete a task from an ISR
*
* Notes      : 1) To reduce interrupt latency, OSTaskDel() 'disables' the task:
*                    a) by making it not ready
*                    b) by removing it from any wait lists
*                    c) by preventing OSTimeTick() from making the task ready to run.
*                 The task can then be 'unlinked' from the miscellaneous structures in uC/OS-II.
*              2) The function OS_Dummy() is called after OS_EXIT_CRITICAL() because, on most processors,
*                 the next instruction following the enable interrupt instruction is ignored.
*              3) An ISR cannot delete a task.
*              4) The lock nesting counter is incremented because, for a brief instant, if the current
*                 task is being deleted, the current task would not be able to be rescheduled because it
*                 is removed from the ready list.  Incrementing the nesting counter prevents another task
*                 from being schedule.  This means that an ISR would return to the current task which is
*                 being deleted.  The rest of the deletion would thus be able to be completed.
*********************************************************************************************************
*/

#if OS_TASK_DEL_EN > 0
INT8U  OSTaskDel (INT8U prio)
{
#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    OS_FLAG_NODE *pnode;
#endif
    OS_TCB       *ptcb;
#if OS_CRITICAL_METHOD == 3                             /* Allocate storage for CPU status register    */
    OS_CPU_SR     cpu_sr = 0;
#endif



    if (OSIntNesting > 0) {                             /* See if trying to delete from ISR            */
        return (OS_ERR_TASK_DEL_ISR);
    }
    if (prio == OS_TASK_IDLE_PRIO) {                    /* Not allowed to delete idle task             */
        return (OS_ERR_TASK_DEL_IDLE);
    }
#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {                       /* Task priority valid ?                       */
        if (prio != OS_PRIO_SELF) {
            return (OS_ERR_PRIO_INVALID);
        }
    }
#endif

/*$PAGE*/
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                         /* See if requesting to delete self            */
        prio = OSTCBCur->OSTCBPrio;                     /* Set priority to delete to current           */
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                          /* Task to delete must exist                   */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_NOT_EXIST);
    }
    if (ptcb == OS_TCB_RESERVED) {                      /* Must not be assigned to Mutex               */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_DEL);
    }

    OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX;
    if (OSRdyTbl[ptcb->OSTCBY] == 0) {                  /* Make task not ready                         */
        OSRdyGrp           &= ~ptcb->OSTCBBitY;
    }
    
#if (OS_EVENT_EN)
    if (ptcb->OSTCBEventPtr != (OS_EVENT *)0) {
        OS_EventTaskRemove(ptcb, ptcb->OSTCBEventPtr);  /* Remove this task from any event   wait list */
    }
#if (OS_EVENT_MULTI_EN > 0)
    if (ptcb->OSTCBEventMultiPtr != (OS_EVENT **)0) {   /* Remove this task from any events' wait lists*/
        OS_EventTaskRemoveMulti(ptcb, ptcb->OSTCBEventMultiPtr);
    }
#endif
#endif

#if (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    pnode = ptcb->OSTCBFlagNode;
    if (pnode != (OS_FLAG_NODE *)0) {                   /* If task is waiting on event flag            */
        OS_FlagUnlink(pnode);                           /* Remove from wait list                       */
    }
#endif

    ptcb->OSTCBDly      = 0;                            /* Prevent OSTimeTick() from updating          */
    ptcb->OSTCBStat     = OS_STAT_RDY;                  /* Prevent task from being resumed             */
    ptcb->OSTCBStatPend = OS_STAT_PEND_OK;
    if (OSLockNesting < 255u) {                         /* Make sure we don't context switch           */
        OSLockNesting++;
    }
    OS_EXIT_CRITICAL();                                 /* Enabling INT. ignores next instruc.         */
    OS_Dummy();                                         /* ... Dummy ensures that INTs will be         */
    OS_ENTER_CRITICAL();                                /* ... disabled HERE!                          */
    if (OSLockNesting > 0) {                            /* Remove context switch lock                  */
        OSLockNesting--;
    }
    OSTaskDelHook(ptcb);                                /* Call user defined hook                      */
    OSTaskCtr--;                                        /* One less task being managed                 */
    OSTCBPrioTbl[prio] = (OS_TCB *)0;                   /* Clear old priority entry                    */
    if (ptcb->OSTCBPrev == (OS_TCB *)0) {               /* Remove from TCB chain                       */
        ptcb->OSTCBNext->OSTCBPrev = (OS_TCB *)0;
        OSTCBList                  = ptcb->OSTCBNext;
    } else {
        ptcb->OSTCBPrev->OSTCBNext = ptcb->OSTCBNext;
        ptcb->OSTCBNext->OSTCBPrev = ptcb->OSTCBPrev;
    }
    ptcb->OSTCBNext   = OSTCBFreeList;                  /* Return TCB to free TCB list                 */
    OSTCBFreeList     = ptcb;
#if OS_TASK_NAME_SIZE > 1
    ptcb->OSTCBTaskName[0] = '?';                       /* Unknown name                                */
    ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
#endif
    OS_EXIT_CRITICAL();
    if (OSRunning == OS_TRUE) {
        OS_Sched();                                     /* Find new highest priority task              */
    }
    return (OS_ERR_NONE);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                    REQUEST THAT A TASK DELETE ITSELF
*
* Description: This function is used to:
*                   a) notify a task to delete itself.
*                   b) to see if a task requested that the current task delete itself.
*              This function is a little tricky to understand.  Basically, you have a task that needs
*              to be deleted however, this task has resources that it has allocated (memory buffers,
*              semaphores, mailboxes, queues etc.).  The task cannot be deleted otherwise these
*              resources would not be freed.  The requesting task calls OSTaskDelReq() to indicate that
*              the task needs to be deleted.  Deleting of the task is however, deferred to the task to
*              be deleted.  For example, suppose that task #10 needs to be deleted.  The requesting task
*              example, task #5, would call OSTaskDelReq(10).  When task #10 gets to execute, it calls
*              this function by specifying OS_PRIO_SELF and monitors the returned value.  If the return
*              value is OS_ERR_TASK_DEL_REQ, another task requested a task delete.  Task #10 would look like
*              this:
*
*                   void Task(void *p_arg)
*                   {
*                       .
*                       .
*                       while (1) {
*                           OSTimeDly(1);
*                           if (OSTaskDelReq(OS_PRIO_SELF) == OS_ERR_TASK_DEL_REQ) {
*                               Release any owned resources;
*                               De-allocate any dynamic memory;
*                               OSTaskDel(OS_PRIO_SELF);
*                           }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一三区三区四区免费在线看| 在线不卡的av| 在线播放日韩导航| 亚洲国产精品二十页| 婷婷六月综合网| 成人av在线播放网址| 日韩一区二区精品在线观看| 最近日韩中文字幕| 国产一区激情在线| 日韩区在线观看| 一区二区三区在线播放| 成人丝袜18视频在线观看| 欧美岛国在线观看| 亚洲成人免费看| 色综合亚洲欧洲| 国产精品视频一区二区三区不卡| 日韩国产一二三区| 欧美日韩国产欧美日美国产精品| 中文字幕日韩一区| 国产91对白在线观看九色| 欧美videos大乳护士334| 日韩av一二三| 欧美日本不卡视频| 午夜精品一区在线观看| 在线视频一区二区三| 成人欧美一区二区三区白人 | 欧美日韩国产欧美日美国产精品| 国产精品三级久久久久三级| 国产一区二区三区不卡在线观看| 欧美一区二区三区视频在线观看 | 国产成都精品91一区二区三| 精品国产污污免费网站入口| 日韩成人dvd| 日韩一区二区三区在线视频| 麻豆传媒一区二区三区| 日韩免费在线观看| 九色综合国产一区二区三区| 欧美成人精品二区三区99精品| 蜜臀av在线播放一区二区三区| 欧美一卡二卡在线观看| 免费成人性网站| 精品91自产拍在线观看一区| 国产一区在线精品| 国产欧美综合色| 成人一级视频在线观看| 成人欧美一区二区三区小说 | 欧美一区二区女人| 蜜臀av性久久久久蜜臀aⅴ| 日韩一区二区不卡| 极品少妇xxxx偷拍精品少妇| 国产天堂亚洲国产碰碰| 97久久精品人人做人人爽| 亚洲另类春色国产| 91精品国产高清一区二区三区蜜臀| 日韩av二区在线播放| 精品黑人一区二区三区久久| 不卡的av在线| 午夜精品一区二区三区三上悠亚| 日韩精品一区二区三区视频播放 | 久久老女人爱爱| 成人av在线影院| 日韩高清国产一区在线| 久久久不卡网国产精品二区| 91日韩精品一区| 日韩av中文在线观看| 国产亚洲污的网站| 欧美亚洲尤物久久| 精品在线观看免费| 一区二区三区电影在线播| 91精品一区二区三区在线观看| 国产精品99久久久久久久女警| 亚洲美女在线一区| 2023国产精华国产精品| 一本色道综合亚洲| 久久精品国产77777蜜臀| 亚洲视频在线一区二区| 日韩欧美激情一区| 日本精品视频一区二区三区| 麻豆高清免费国产一区| 一区二区成人在线视频| 2023国产精品视频| 欧美日韩另类一区| 91在线一区二区| 国产一区不卡在线| 日韩精品五月天| 亚洲精品福利视频网站| 久久精品一区四区| 欧亚一区二区三区| 成人不卡免费av| 国产乱码精品一区二区三区忘忧草| 樱桃国产成人精品视频| 国产目拍亚洲精品99久久精品| 欧美精品xxxxbbbb| 色婷婷综合久久久中文一区二区| 国产精品538一区二区在线| 肉色丝袜一区二区| 一区二区三区在线播| 中文字幕五月欧美| 国产亚洲美州欧州综合国| 91精品一区二区三区在线观看| 在线日韩国产精品| 色偷偷一区二区三区| jlzzjlzz国产精品久久| 国产精品69久久久久水密桃 | 一区二区三区不卡视频| 欧美国产禁国产网站cc| 亚洲精品一区二区三区香蕉| 欧美精品第1页| 欧美日本国产视频| 欧美日韩午夜影院| 欧美日韩免费观看一区二区三区| 一本色道久久综合亚洲精品按摩| 成人美女视频在线观看18| 国产99久久久久久免费看农村| 国产精品白丝jk黑袜喷水| 国产在线视频不卡二| 国产原创一区二区三区| 国产精品综合一区二区三区| 国产精品99久久久久久宅男| 国产在线不卡视频| 国产成人精品一区二区三区四区| 国产99一区视频免费| 99re亚洲国产精品| 欧美三级视频在线播放| 欧美日韩精品一二三区| 欧美一区二区三区啪啪| 欧美sm极限捆绑bd| 久久奇米777| 国产精品家庭影院| 亚洲一二三四区| 日韩精品视频网站| 韩国女主播成人在线| 丰满放荡岳乱妇91ww| 91小视频免费观看| 欧美日韩国产片| 精品久久人人做人人爽| 国产精品色哟哟网站| 亚洲免费在线看| 日本在线不卡视频一二三区| 精品亚洲国内自在自线福利| 成人免费高清在线| 在线观看日韩精品| 欧美成人精品3d动漫h| 亚洲国产精品精华液ab| 一区二区三区四区激情| 理论电影国产精品| 不卡视频一二三| 在线播放91灌醉迷j高跟美女| 久久蜜臀中文字幕| 亚洲精品va在线观看| 看片网站欧美日韩| 99久久精品免费看国产免费软件| 欧美日韩视频在线一区二区| 久久久亚洲综合| 一区二区视频在线| 久久99热这里只有精品| 一本一道久久a久久精品| 欧美电视剧免费全集观看| 中文字幕亚洲精品在线观看| 蜜桃视频在线一区| 91丨九色丨国产丨porny| 日韩欧美亚洲一区二区| 国产精品久久久久久户外露出| 丝袜美腿成人在线| av福利精品导航| 欧美精品一区二区三| 亚洲一区二区三区三| 国产91精品一区二区麻豆网站| 欧美高清视频在线高清观看mv色露露十八| 久久久久久97三级| 五月婷婷综合网| 色综合欧美在线| 欧美国产激情二区三区| 麻豆成人av在线| 欧美精品色综合| 亚洲裸体xxx| 成人午夜在线免费| 精品成人一区二区| 三级不卡在线观看| 欧美日韩一级黄| 亚洲蜜臀av乱码久久精品| 成人免费毛片高清视频| 久久综合狠狠综合久久激情| 日韩电影免费在线看| 精品视频在线免费看| 伊人婷婷欧美激情| 91小视频在线| 亚洲欧洲色图综合| 成人av网站在线| 欧美激情一区二区| 国产激情一区二区三区桃花岛亚洲| 日韩欧美另类在线| 久久精品国产在热久久| 欧美一卡二卡三卡四卡| 日韩电影免费在线看| 日韩欧美国产综合一区 | 国产精品99久久久久久宅男| 欧美成人精品福利| 黄一区二区三区| 久久久久久久久97黄色工厂|