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

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

?? os_task.c

?? uCOS-II在三星44B0開發板上的移植
?? C
?? 第 1 頁 / 共 3 頁
字號:
#endif
    if (prio == OS_PRIO_SELF) {                  /* See if caller desires to set it's own name         */
        prio = OSTCBCur->OSTCBPrio;
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                   /* Does task exist?                                   */
        OS_EXIT_CRITICAL();                      /* No                                                 */
        *err = OS_TASK_NOT_EXIST;
        return;
    }
    len = 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)strcpy(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
*
*              pdata    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 *pdata)
{
#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
    pdata->OSFree = 0;                                 /* Assume failure, set to 0 size                */
    pdata->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
    pdata->OSFree = free * sizeof(OS_STK);            /* Compute number of free bytes on the stack     */
    pdata->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.
*
* 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 *pdata)
{
#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);
    }
    memcpy(pdata, ptcb, sizeof(OS_TCB));                   /* Copy TCB into user storage area          */
    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一区二区三区免费野_久草精品视频
欧美综合久久久| 亚洲高清不卡在线观看| 亚洲不卡在线观看| 成人性生交大合| 日韩美女一区二区三区| 亚洲一区电影777| 99热这里都是精品| 国产欧美日韩另类视频免费观看| 日日夜夜免费精品| 91国产成人在线| 自拍偷拍欧美精品| 粉嫩一区二区三区在线看| 精品国产乱码久久久久久图片| 一级中文字幕一区二区| 91年精品国产| 最新热久久免费视频| 成人午夜视频福利| 久久久国产一区二区三区四区小说 | 亚洲视频小说图片| 国产成都精品91一区二区三| 久久久亚洲综合| 激情文学综合网| 久久久久久久久蜜桃| 国产乱码精品1区2区3区| 日韩女优av电影在线观看| 日韩avvvv在线播放| 欧美丰满少妇xxxbbb| 日韩成人一级大片| 91精品国产综合久久福利| 亚洲成人av资源| 欧美日韩久久久一区| 丝袜脚交一区二区| 日韩一级完整毛片| 精彩视频一区二区三区| 久久婷婷一区二区三区| 国产成人免费高清| 国产精品视频麻豆| 在线亚洲免费视频| 日日摸夜夜添夜夜添精品视频| 欧美日本一道本| 美女在线视频一区| 国产日韩av一区| 色哟哟日韩精品| 五月天欧美精品| xfplay精品久久| 不卡区在线中文字幕| 一区二区三区美女| 69久久夜色精品国产69蝌蚪网| 麻豆国产精品一区二区三区| 久久嫩草精品久久久精品一| 97精品国产露脸对白| 亚洲成av人片在线观看无码| 欧美va日韩va| 94-欧美-setu| 男女男精品网站| 国产精品美女视频| 欧美人狂配大交3d怪物一区| 国产一区二区三区高清播放| 亚洲色图视频网站| 日韩一级成人av| 成人av在线网| 蜜臀av国产精品久久久久| 中文在线资源观看网站视频免费不卡| 99久久精品国产导航| 日本亚洲欧美天堂免费| 国产精品美女久久久久久2018| 欧美日韩国产bt| 成人中文字幕合集| 日韩成人免费电影| 亚洲免费视频成人| 欧美成人a∨高清免费观看| 91丨porny丨首页| 久久激情五月婷婷| 亚洲综合激情小说| 国产亚洲女人久久久久毛片| 欧美日韩一二三| www.av亚洲| 国产一区二区福利| 亚洲影院久久精品| 国产精品成人在线观看| 欧美草草影院在线视频| 欧美日本一区二区| 一本大道久久精品懂色aⅴ| 精品一区二区三区在线视频| 亚洲最大成人综合| 国产精品美女久久久久aⅴ| 欧美刺激午夜性久久久久久久| 色素色在线综合| eeuss影院一区二区三区| 国内精品国产成人国产三级粉色| 亚洲成人动漫精品| 亚洲免费资源在线播放| 国产精品免费丝袜| 久久久国产精品不卡| 日韩一区二区三区精品视频| 欧美区在线观看| 欧美四级电影在线观看| 一本大道久久a久久综合婷婷| 成人av动漫在线| 国产成人免费av在线| 国产成人精品一区二区三区网站观看 | 中文字幕一区二区视频| 国产欧美日韩麻豆91| 久久久久97国产精华液好用吗| 日韩欧美一二三四区| 5月丁香婷婷综合| 884aa四虎影成人精品一区| 欧美日韩中文字幕一区二区| 欧美亚州韩日在线看免费版国语版| 91丨porny丨最新| 欧美一a一片一级一片| 色综合网色综合| 欧美网站一区二区| 制服丝袜成人动漫| 4438成人网| 精品久久久影院| 久久嫩草精品久久久精品| 国产色综合一区| 中文字幕免费一区| 亚洲精品视频在线观看网站| 一区二区三区不卡视频| 亚洲国产精品嫩草影院| 日本不卡高清视频| 国产精品综合一区二区三区| 福利91精品一区二区三区| 成人av先锋影音| 欧美在线免费播放| 91精品国产91综合久久蜜臀| 久久影院电视剧免费观看| 欧美国产综合一区二区| 亚洲精品成人悠悠色影视| 亚洲成人av电影在线| 狠狠久久亚洲欧美| av男人天堂一区| 欧美日韩在线播放三区| 日韩一区二区中文字幕| 久久精品亚洲国产奇米99| 国产精品大尺度| 日韩精品91亚洲二区在线观看| 久久国产精品一区二区| 成人va在线观看| 欧美日韩黄色一区二区| 国产亚洲成aⅴ人片在线观看 | 国产欧美日产一区| 亚洲精品高清视频在线观看| 麻豆91精品视频| 99精品热视频| 日韩欧美一二三四区| 亚洲欧洲美洲综合色网| 三级久久三级久久久| 成人黄色免费短视频| 欧美日韩视频不卡| 亚洲国产精品激情在线观看| 丝袜诱惑亚洲看片| 成人综合婷婷国产精品久久免费| 欧美日韩国产美| 亚洲国产精品激情在线观看| 三级欧美在线一区| hitomi一区二区三区精品| 欧美成人一区二区三区| 一区二区三区在线观看国产| 国产一区不卡在线| 在线播放中文字幕一区| 中文字幕色av一区二区三区| 蜜臀av一区二区在线免费观看| 色哟哟亚洲精品| 国产精品美女久久久久久久久| 麻豆一区二区99久久久久| 在线看一区二区| 国产精品网站在线观看| 久久99精品久久久久久国产越南| 欧美色精品天天在线观看视频| 国产欧美日韩在线观看| 久久国产精品72免费观看| 欧美顶级少妇做爰| 亚洲精品国产成人久久av盗摄| 成人影视亚洲图片在线| 26uuu另类欧美亚洲曰本| 日本成人在线视频网站| 欧美日高清视频| 亚洲午夜精品网| 欧美私模裸体表演在线观看| 亚洲欧美日本在线| 99久久99久久精品免费观看| 中文字幕av免费专区久久| 国产成人在线看| 国产欧美一区二区精品久导航| 国产最新精品免费| 久久久国际精品| 成人在线综合网| 国产精品天美传媒沈樵| 成人激情综合网站| 自拍av一区二区三区| 99re66热这里只有精品3直播| 亚洲欧洲精品天堂一级| 99精品视频在线免费观看| 亚洲色大成网站www久久九九| 波多野洁衣一区| 亚洲美女免费在线| 欧美日韩亚洲高清一区二区|