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

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

?? os_task.c

?? atmel128L
?? C
?? 第 1 頁 / 共 3 頁
字號:
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                   /* Does task exist?                                   */
        OS_EXIT_CRITICAL();                      /* No                                                 */
        *err = OS_TASK_NOT_EXIST;
        return;
    }
    len = OS_StrLen(pname);                          /* Yes, Can we fit the string in the TCB?         */
    if (len > (OS_TASK_NAME_SIZE - 1)) {             /*      No                                        */
        OS_EXIT_CRITICAL();
        *err = OS_ERR_TASK_NAME_TOO_LONG;
        return;
    } 
    (void)OS_StrCopy(ptcb->OSTCBTaskName, pname);    /*      Yes, copy to TCB                          */
    OS_EXIT_CRITICAL();
    *err = OS_NO_ERR;
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                        RESUME A SUSPENDED TASK
*
* Description: This function is called to resume a previously suspended task.  This is the only call that
*              will remove an explicit task suspension.
*
* Arguments  : prio     is the priority of the task to resume.
*
* Returns    : OS_NO_ERR                if the requested task is resumed
*              OS_PRIO_INVALID          if the priority you specify is higher that the maximum allowed
*                                       (i.e. >= OS_LOWEST_PRIO)
*              OS_TASK_RESUME_PRIO      if the task to resume does not exist
*              OS_TASK_NOT_SUSPENDED    if the task to resume has not been suspended
*********************************************************************************************************
*/

#if OS_TASK_SUSPEND_EN > 0
INT8U  OSTaskResume (INT8U prio)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    OS_TCB    *ptcb;


#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {                               /* Make sure task priority is valid    */
        return (OS_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                                  /* Task to suspend must exist          */
        OS_EXIT_CRITICAL();
        return (OS_TASK_RESUME_PRIO);
    }
    if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) != OS_STAT_RDY) {   /* Task must be suspended              */
        ptcb->OSTCBStat &= ~OS_STAT_SUSPEND;					/* Remove suspension                   */
        if (ptcb->OSTCBStat == OS_STAT_RDY) {                      
            if (ptcb->OSTCBDly  == 0) {                         /* Must not be delayed                 */
                OSRdyGrp               |= ptcb->OSTCBBitY;      /* Make task ready to run              */
                OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
                OS_EXIT_CRITICAL();
                OS_Sched();
			} else {
			    OS_EXIT_CRITICAL();
			}
        } else {
            OS_EXIT_CRITICAL();
        }
        return (OS_NO_ERR);
    }
    OS_EXIT_CRITICAL();
    return (OS_TASK_NOT_SUSPENDED);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                             STACK CHECKING
*
* Description: This function is called to check the amount of free memory left on the specified task's
*              stack.
*
* Arguments  : prio          is the task priority
*
*              p_stk_data    is a pointer to a data structure of type OS_STK_DATA.
*
* Returns    : OS_NO_ERR           upon success
*              OS_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_TASK_NOT_EXIST   if the desired task has not been created
*              OS_TASK_OPT_ERR     if you did NOT specified OS_TASK_OPT_STK_CHK when the task was created
*********************************************************************************************************
*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    OS_TCB    *ptcb;
    OS_STK    *pchk;
    INT32U     free;
    INT32U     size;


#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {					   /* Make sure task priority is valid             */
        if (prio != OS_PRIO_SELF) {        
            return (OS_PRIO_INVALID);
        }
    }
#endif
    p_stk_data->OSFree = 0;                            /* Assume failure, set to 0 size                */
    p_stk_data->OSUsed = 0;
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                        /* See if check for SELF                        */
        prio = OSTCBCur->OSTCBPrio;
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                         /* Make sure task exist                         */
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }
    if (ptcb == (OS_TCB *)1) {
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }  
    if ((ptcb->OSTCBOpt & OS_TASK_OPT_STK_CHK) == 0) { /* Make sure stack checking option is set       */
        OS_EXIT_CRITICAL();
        return (OS_TASK_OPT_ERR);
    }
    free = 0;
    size = ptcb->OSTCBStkSize;
    pchk = ptcb->OSTCBStkBottom;
    OS_EXIT_CRITICAL();
#if OS_STK_GROWTH == 1
    while (*pchk++ == (OS_STK)0) {                    /* Compute the number of zero entries on the stk */
        free++;
    }
#else
    while (*pchk-- == (OS_STK)0) {
        free++;
    }
#endif
    p_stk_data->OSFree = free * sizeof(OS_STK);           /* Compute number of free bytes on the stack */
    p_stk_data->OSUsed = (size - free) * sizeof(OS_STK);  /* Compute number of bytes used on the stack */
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            SUSPEND A TASK
*
* Description: This function is called to suspend a task.  The task can be the calling task if the
*              priority passed to OSTaskSuspend() is the priority of the calling task or OS_PRIO_SELF.
*
* Arguments  : prio     is the priority of the task to suspend.  If you specify OS_PRIO_SELF, the
*                       calling task will suspend itself and rescheduling will occur.
*
* Returns    : OS_NO_ERR                if the requested task is suspended
*              OS_TASK_SUSPEND_IDLE     if you attempted to suspend the idle task which is not allowed.
*              OS_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_TASK_SUSPEND_PRIO     if the task to suspend does not exist
*
* Note       : You should use this function with great care.  If you suspend a task that is waiting for
*              an event (i.e. a message, a semaphore, a queue ...) you will prevent this task from
*              running when the event arrives.
*********************************************************************************************************
*/

#if OS_TASK_SUSPEND_EN > 0
INT8U  OSTaskSuspend (INT8U prio)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    BOOLEAN    self;
    OS_TCB    *ptcb;
	INT8U      y;


#if OS_ARG_CHK_EN > 0
    if (prio == OS_IDLE_PRIO) {                                 /* Not allowed to suspend idle task    */
        return (OS_TASK_SUSPEND_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO) {								/* Task priority valid ?               */
        if (prio != OS_PRIO_SELF) {
            return (OS_PRIO_INVALID);
        }
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                                 /* See if suspend SELF                 */
        prio = OSTCBCur->OSTCBPrio;
        self = TRUE;
    } else if (prio == OSTCBCur->OSTCBPrio) {                   /* See if suspending self              */
        self = TRUE;
    } else {
        self = FALSE;                                           /* No suspending another task          */
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                                  /* Task to suspend must exist          */
        OS_EXIT_CRITICAL();
        return (OS_TASK_SUSPEND_PRIO);
    }
	y            = ptcb->OSTCBY;
	OSRdyTbl[y] &= ~ptcb->OSTCBBitX;							/* Make task not ready                 */
    if (OSRdyTbl[y] == 0x00) { 
        OSRdyGrp &= ~ptcb->OSTCBBitY;
    }
    ptcb->OSTCBStat |= OS_STAT_SUSPEND;                         /* Status of task is 'SUSPENDED'       */
    OS_EXIT_CRITICAL();
    if (self == TRUE) {                                         /* Context switch only if SELF         */
        OS_Sched();
    }
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            QUERY A TASK
*
* Description: This function is called to obtain a copy of the desired task's TCB.
*
* Arguments  : prio         is the priority of the task to obtain information from.
*
*              p_task_data  is a pointer to where the desired task's OS_TCB will be stored.
*
* Returns    : OS_NO_ERR       if the requested task is suspended
*              OS_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_PRIO_ERR     if the desired task has not been created
*********************************************************************************************************
*/

#if OS_TASK_QUERY_EN > 0
INT8U  OSTaskQuery (INT8U prio, OS_TCB *p_task_data)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    OS_TCB    *ptcb;


#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {				 /* Task priority valid ?    	                       */
        if (prio != OS_PRIO_SELF) {   
            return (OS_PRIO_INVALID);
        }
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                  /* See if suspend SELF                                */
        prio = OSTCBCur->OSTCBPrio;
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                   /* Task to query must exist                           */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_ERR);
    }
                                                 /* Copy TCB into user storage area                    */
    OS_MemCopy((INT8U *)p_task_data, (INT8U *)ptcb, sizeof(OS_TCB));  
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        CLEAR TASK STACK
*
* Description: This function is used to clear the stack of a task (i.e. write all zeros)
*
* Arguments  : 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.
*
*              size     is the number of 'stack elements' to clear.
*
*              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.
*
* Returns    : none
*********************************************************************************************************
*/
#if OS_TASK_CREATE_EXT_EN > 0
void  OS_TaskStkClr (OS_STK *pbos, INT32U size, INT16U opt)
{
    if ((opt & OS_TASK_OPT_STK_CHK) != 0x0000) {       /* See if stack checking has been enabled       */
        if ((opt & OS_TASK_OPT_STK_CLR) != 0x0000) {   /* See if stack needs to be cleared             */
#if OS_STK_GROWTH == 1                     
            while (size > 0) {                         /* Stack grows from HIGH to LOW memory          */
                size--;
                *pbos++ = (OS_STK)0;                   /* Clear from bottom of stack and up!           */
            }
#else
            while (size > 0) {                         /* Stack grows from LOW to HIGH memory          */
                size--;
                *pbos-- = (OS_STK)0;                   /* Clear from bottom of stack and down          */
            }
#endif
        }
    }
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品在线亚洲视频| 亚洲精品你懂的| 国产精品久久久久国产精品日日| 日韩美女久久久| 奇米影视在线99精品| 国产成人在线视频免费播放| 在线精品视频免费观看| 日韩欧美一区二区三区在线| 国产精品麻豆欧美日韩ww| 亚洲高清视频在线| 国产·精品毛片| 欧美日韩一区二区三区视频| 久久久三级国产网站| 一级中文字幕一区二区| 国产乱对白刺激视频不卡| 欧美亚洲自拍偷拍| 亚洲在线视频一区| 亚洲成人av一区二区三区| 国产精品白丝jk黑袜喷水| 欧美日韩精品免费观看视频| 在线观看91精品国产入口| 久久久久国产精品免费免费搜索| 一区二区激情小说| 国产成人午夜精品5599| 欧美日本一道本| 亚洲图片你懂的| 国产乱码字幕精品高清av| 欧美精品在线视频| 亚洲男同1069视频| 高清视频一区二区| 日韩欧美一区二区视频| 亚洲国产视频在线| 成人a免费在线看| 2021中文字幕一区亚洲| 五月天激情综合网| 色菇凉天天综合网| 欧美极品美女视频| 国产一区二区三区免费看 | 国产视频一区在线播放| 日韩中文字幕亚洲一区二区va在线 | 91黄色激情网站| 久久久久久久久蜜桃| 免费av网站大全久久| 欧美日韩在线精品一区二区三区激情| 国产欧美综合在线观看第十页| 日本aⅴ亚洲精品中文乱码| 欧美在线free| 国产欧美视频在线观看| 精东粉嫩av免费一区二区三区| 欧美狂野另类xxxxoooo| 亚洲午夜一区二区三区| 色噜噜久久综合| 一区二区中文字幕在线| 成人精品免费看| 国产日产欧美一区二区视频| 国精产品一区一区三区mba视频| 制服.丝袜.亚洲.中文.综合| 亚洲午夜一区二区三区| 一区二区三区精品视频在线| 在线精品视频免费播放| 中文字幕一区二区三区不卡| 成人黄色综合网站| 日本一区二区成人在线| 国产一区999| 国产欧美一区二区精品性| 国产毛片精品一区| 久久免费电影网| 国产一区999| 久久精品一区二区三区不卡| 激情都市一区二区| 久久先锋影音av| 国产老肥熟一区二区三区| 久久免费视频色| 国产成人亚洲综合a∨婷婷图片| 久久精品一区二区三区不卡| 国产精品中文字幕欧美| 欧美国产97人人爽人人喊| 成人av在线播放网站| 最新久久zyz资源站| 在线精品视频免费观看| 亚洲国产精品一区二区www在线 | 国产一区二区三区在线观看精品 | 国产精品一区二区黑丝| 久久精品视频网| 大胆欧美人体老妇| 综合电影一区二区三区 | 日韩精品国产欧美| 日韩精品一区二区在线观看| 国产精品一区二区视频| 中文字幕精品综合| 91性感美女视频| 日韩精品电影在线观看| 精品国产一二三| 高清成人免费视频| 一区二区三区成人| 欧美人伦禁忌dvd放荡欲情| 麻豆国产精品777777在线| 久久精品人人爽人人爽| 成人av电影免费观看| 一区二区三区欧美| 日韩三级视频在线看| 成人性生交大片免费看中文 | 欧美挠脚心视频网站| 奇米综合一区二区三区精品视频| 欧美精品一区二区在线播放| 成人福利视频在线看| 亚洲成人先锋电影| 欧美精品一区二区三区一线天视频| 成人动漫一区二区在线| 亚洲地区一二三色| 久久久www成人免费毛片麻豆| 99视频在线精品| 午夜久久久久久久久| 久久精品一区二区三区四区| 91老师片黄在线观看| 麻豆精品视频在线观看视频| 亚洲国产精品99久久久久久久久| 91福利精品视频| 国产精品一区二区三区99| 亚洲国产中文字幕在线视频综合| 精品国产免费一区二区三区香蕉| 色综合久久久久网| 极品少妇一区二区三区精品视频| 18成人在线观看| 欧美成人官网二区| 在线日韩一区二区| 国产精品亚洲第一区在线暖暖韩国| 亚洲国产你懂的| 国产精品美女视频| 日韩欧美一级二级三级久久久| 91偷拍与自偷拍精品| 韩国欧美国产一区| 丝袜美腿亚洲色图| 18成人在线视频| 国产午夜三级一区二区三| 欧美一区二区三区精品| 91香蕉视频污| 国产98色在线|日韩| 日本中文一区二区三区| 日日夜夜免费精品视频| 日韩亚洲国产中文字幕欧美| 色综合视频在线观看| 国产成人一区二区精品非洲| 免费欧美在线视频| 一区二区三区在线视频观看| 久久精品亚洲国产奇米99 | 美腿丝袜亚洲色图| 亚洲主播在线播放| 日韩毛片精品高清免费| 国产三级欧美三级| 日韩女优av电影| 欧美肥大bbwbbw高潮| 91福利在线观看| 91香蕉国产在线观看软件| 国产成人免费在线视频| 激情深爱一区二区| 日本午夜精品一区二区三区电影| 亚洲一区二区三区中文字幕在线| 一区二区中文字幕在线| 国产欧美一区在线| 久久久久久久久岛国免费| 日韩精品一区二区三区中文不卡| 欧美日本一区二区三区四区 | 秋霞午夜鲁丝一区二区老狼| 亚洲一区在线观看网站| 亚洲免费av观看| 亚洲日本乱码在线观看| 国产精品久久久久久久久久久免费看 | 一区二区三区欧美视频| 亚洲欧美日韩国产另类专区| 国产精品日韩精品欧美在线| 国产日韩三级在线| 欧美激情综合五月色丁香小说| 久久―日本道色综合久久| 久久亚洲综合av| 国产婷婷色一区二区三区| 国产午夜精品久久久久久久 | 91小视频在线观看| 色婷婷久久99综合精品jk白丝| 99精品视频免费在线观看| 97久久久精品综合88久久| 99re成人精品视频| 色妹子一区二区| 欧洲精品在线观看| 欧美男男青年gay1069videost| 91黄色免费看| 欧美精品电影在线播放| 欧美一区二区三区在线观看| 日韩女优av电影在线观看| 精品黑人一区二区三区久久| 久久这里只精品最新地址| 国产日产亚洲精品系列| 中文字幕亚洲成人| 亚洲主播在线播放| 青青国产91久久久久久| 六月丁香婷婷色狠狠久久| 国产精品一区二区免费不卡 | 亚洲一区国产视频| 亚洲不卡av一区二区三区| 免费看欧美女人艹b|