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

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

?? os_core.c

?? uCosII 郵箱消息和任務管理
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             CORE FUNCTIONS
*
*                          (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_CORE.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#define  OS_GLOBALS
#include "includes.h"
#endif

/*
*********************************************************************************************************
*                              MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
*
* Note: Index into table is desired bit position, 0..7
*       Indexed value corresponds to bit mask
*********************************************************************************************************
*/

INT8U  const  OSMapTbl[]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};

/*
*********************************************************************************************************
*                                       PRIORITY RESOLUTION TABLE
*
* Note: Index into table is bit pattern to resolve highest priority
*       Indexed value corresponds to highest priority bit position (i.e. 0..7)
*********************************************************************************************************
*/

INT8U  const  OSUnMapTbl[] = {
    0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
};
/*$PAGE*/
/*
*********************************************************************************************************
*                                             INITIALIZATION
*
* Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
*              creating any uC/OS-II object and, prior to calling OSStart().
*
* Arguments  : none
*
* Returns    : none
*********************************************************************************************************
*/

void  OSInit (void)
{
    INT16U     i;
    INT8U     *prdytbl;
    OS_TCB    *ptcb1;
    OS_TCB    *ptcb2;
#if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 1)
    OS_EVENT  *pevent1;
    OS_EVENT  *pevent2;
#endif


#if OS_VERSION >= 204
    OSInitHookBegin();                                           /* Call port specific initialization code   */
#endif

#if OS_TIME_GET_SET_EN > 0   
    OSTime        = 0L;                                          /* Clear the 32-bit system clock            */
#endif
    OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter      */
    OSLockNesting = 0;                                           /* Clear the scheduling lock counter        */
    OSTaskCtr     = 0;                                           /* Clear the number of tasks                */
    OSRunning     = FALSE;                                       /* Indicate that multitasking not started   */
    OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter            */
#if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
    OSIdleCtrRun  = 0L;
    OSIdleCtrMax  = 0L;
    OSStatRdy     = FALSE;                                       /* Statistic task is not ready              */
#endif
    OSCtxSwCtr    = 0;                                           /* Clear the context switch counter         */
    OSRdyGrp      = 0x00;                                        /* Clear the ready list                     */
    prdytbl       = &OSRdyTbl[0];
    for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
        *prdytbl++ = 0x00;
    }

    OSPrioCur     = 0;
    OSPrioHighRdy = 0;
    OSTCBHighRdy  = (OS_TCB *)0;                                 /* TCB Initialization                       */
    OSTCBCur      = (OS_TCB *)0;
    OSTCBList     = (OS_TCB *)0;
    for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table                 */
        OSTCBPrioTbl[i] = (OS_TCB *)0;
    }
    ptcb1 = &OSTCBTbl[0];
    ptcb2 = &OSTCBTbl[1];
    for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs                  */
        ptcb1->OSTCBNext = ptcb2;
        ptcb1++;
        ptcb2++;
    }
    ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                              */
    OSTCBFreeList    = &OSTCBTbl[0];

#if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
    #if OS_MAX_EVENTS == 1                                       
    OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block        */
    OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
    OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
    #else
    pevent1 = &OSEventTbl[0];
    pevent2 = &OSEventTbl[1];
    for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control blocks  */
        pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
        pevent1->OSEventPtr  = pevent2;
        pevent1++;
        pevent2++;
    }
    pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
    pevent1->OSEventPtr  = (OS_EVENT *)0;
    OSEventFreeList      = &OSEventTbl[0];
    #endif
#endif

#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    OS_FlagInit();                                               /* Initialize the event flag structures     */
#endif

#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
    OS_QInit();                                                  /* Initialize the message queue structures  */
#endif

#if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
    OS_MemInit();                                                /* Initialize the memory manager            */
#endif

    /* ------------------------------------- CREATION OF 'IDLE' TASK --------------------------------------- */
#if OS_TASK_CREATE_EXT_EN > 0
    #if OS_STK_GROWTH == 1
    (void)OSTaskCreateExt(OS_TaskIdle,
                          (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
                          &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack                     */
                          OS_IDLE_PRIO,                              /* Lowest priority level                */
                          OS_TASK_IDLE_ID,
                          &OSTaskIdleStk[0],                         /* Set Bottom-Of-Stack                  */
                          OS_TASK_IDLE_STK_SIZE,
                          (void *)0,                                 /* No TCB extension                     */
                          OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
    #else
    (void)OSTaskCreateExt(OS_TaskIdle,
                          (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
                          &OSTaskIdleStk[0],                         /* Set Top-Of-Stack                     */
                          OS_IDLE_PRIO,                              /* Lowest priority level                */
                          OS_TASK_IDLE_ID,
                          &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack                  */
                          OS_TASK_IDLE_STK_SIZE,
                          (void *)0,                                 /* No TCB extension                     */
                          OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
    #endif
#else
    #if OS_STK_GROWTH == 1
    (void)OSTaskCreate(OS_TaskIdle,
                       (void *)0,
                       &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
                       OS_IDLE_PRIO);
    #else
    (void)OSTaskCreate(OS_TaskIdle,
                       (void *)0,
                       &OSTaskIdleStk[0],
                       OS_IDLE_PRIO);
    #endif
#endif

    /* ------------------------------- CREATION OF 'STATISTIC' TASK ---------------------------------- */
#if OS_TASK_STAT_EN > 0
    #if OS_TASK_CREATE_EXT_EN > 0
        #if OS_STK_GROWTH == 1
        (void)OSTaskCreateExt(OS_TaskStat,
                              (void *)0,                                   /* No args passed to OS_TaskStat()*/
                              &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Top-Of-Stack               */
                              OS_STAT_PRIO,                                /* One higher than the idle task  */
                              OS_TASK_STAT_ID,
                              &OSTaskStatStk[0],                           /* Set Bottom-Of-Stack            */
                              OS_TASK_STAT_STK_SIZE,
                              (void *)0,                                   /* No TCB extension               */
                              OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
        #else
        (void)OSTaskCreateExt(OS_TaskStat,
                              (void *)0,                                   /* No args passed to OS_TaskStat()*/
                              &OSTaskStatStk[0],                           /* Set Top-Of-Stack               */
                              OS_STAT_PRIO,                                /* One higher than the idle task  */
                              OS_TASK_STAT_ID,
                              &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Bottom-Of-Stack            */
                              OS_TASK_STAT_STK_SIZE,
                              (void *)0,                                   /* No TCB extension               */
                              OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
        #endif
    #else
        #if OS_STK_GROWTH == 1
        (void)OSTaskCreate(OS_TaskStat,
                           (void *)0,                                      /* No args passed to OS_TaskStat()*/
                           &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],      /* Set Top-Of-Stack               */
                           OS_STAT_PRIO);                                  /* One higher than the idle task  */
        #else
        (void)OSTaskCreate(OS_TaskStat,
                           (void *)0,                                      /* No args passed to OS_TaskStat()*/
                           &OSTaskStatStk[0],                              /* Set Top-Of-Stack               */
                           OS_STAT_PRIO);                                  /* One higher than the idle task  */
        #endif
    #endif
#endif

#if OS_VERSION >= 204
    OSInitHookEnd();                                                       /* Call port specific init. code  */
#endif
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                              ENTER ISR
*
* Description: This function is used to notify uC/OS-II that you are about to service an interrupt
*              service routine (ISR).  This allows uC/OS-II to keep track of interrupt nesting and thus
*              only perform rescheduling at the last nested ISR.
*
* Arguments  : none
*
* Returns    : none
*
* Notes      : 1) Your ISR can directly increment OSIntNesting without calling this function because
*                 OSIntNesting has been declared 'global'.  You MUST, however, be sure that the increment
*                 is performed 'indivisibly' by your processor to ensure proper access to this critical
*                 resource.
*              2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
*              3) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
*                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
*                 end of the ISR.
*********************************************************************************************************
*/

void  OSIntEnter (void)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    
    
    OS_ENTER_CRITICAL();
    if (OSIntNesting < 255) {
        OSIntNesting++;                          /* Increment ISR nesting level                        */
    }
    OS_EXIT_CRITICAL();
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                               EXIT ISR
*
* Description: This function is used to notify uC/OS-II that you have completed serviving an ISR.  When
*              the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
*              a new, high-priority task, is ready to run.
*
* Arguments  : none
*
* Returns    : none
*
* Notes      : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
*                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
*                 end of the ISR.
*              2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
*********************************************************************************************************
*/

void  OSIntExit (void)
{
#if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
    OS_CPU_SR  cpu_sr;
#endif
    
    
    OS_ENTER_CRITICAL();
    if (OSIntNesting > 0) {                            /* Prevent OSIntNesting from wrapping           */
        OSIntNesting--;
    }
    if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ...     */
        OSIntExitY    = OSUnMapTbl[OSRdyGrp];          /* ... and not locked.                          */
        OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
        if (OSPrioHighRdy != OSPrioCur) {              /* No Ctx Sw if current task is highest rdy     */
            OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
            OSCtxSwCtr++;                              /* Keep track of the number of context switches */
            OSIntCtxSw();                              /* Perform interrupt level context switch       */
        }
    }
    OS_EXIT_CRITICAL();
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                          PREVENT SCHEDULING
*
* Description: This function is used to prevent rescheduling to take place.  This allows your application
*              to prevent context switches until you are ready to permit context switching.
*
* Arguments  : none

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
自拍偷拍欧美激情| 国产真实乱偷精品视频免| 日韩三级电影网址| 精品视频免费看| 欧美日韩一区精品| 欧美制服丝袜第一页| 欧美亚洲禁片免费| 欧美在线免费视屏| 欧美丝袜丝nylons| 欧美精品一二三区| 欧美一区永久视频免费观看| 日韩丝袜情趣美女图片| 日韩一区二区三区在线视频| 日韩精品一区二区三区四区| 欧美大度的电影原声| 久久久夜色精品亚洲| 国产精品久久久一本精品 | 亚洲成人免费影院| 亚洲自拍都市欧美小说| 亚洲成av人**亚洲成av**| 亚洲伊人色欲综合网| 视频一区二区国产| 久久av老司机精品网站导航| 国产成人激情av| 99re这里都是精品| 色偷偷88欧美精品久久久| 欧美另类一区二区三区| 日韩精品中文字幕一区二区三区| 中文字幕免费一区| 亚洲国产欧美一区二区三区丁香婷 | 欧美亚洲国产一卡| 制服丝袜中文字幕亚洲| 国产校园另类小说区| 亚洲男人的天堂在线aⅴ视频| 日韩专区欧美专区| 成人激情免费视频| 欧美精选午夜久久久乱码6080| 欧美成va人片在线观看| 中文字幕成人网| 日韩av在线播放中文字幕| 国产.精品.日韩.另类.中文.在线.播放| 成人晚上爱看视频| 538在线一区二区精品国产| 国产午夜亚洲精品羞羞网站| 亚洲午夜在线视频| 国产麻豆9l精品三级站| 91国产视频在线观看| 久久久777精品电影网影网| 亚洲国产日韩在线一区模特| 国产**成人网毛片九色| 欧美一级在线视频| 亚洲精品国产视频| 成人午夜视频在线| 精品国产一区久久| 亚洲自拍另类综合| 91女神在线视频| 欧美激情综合在线| 国产一区中文字幕| 91精品国产丝袜白色高跟鞋| 亚洲亚洲人成综合网络| 97久久精品人人做人人爽| 久久亚洲综合色一区二区三区| 亚洲综合免费观看高清完整版 | 91蝌蚪porny| 欧美国产精品v| 国产一区二区三区免费看| 欧美理论电影在线| 亚洲一区二区三区中文字幕在线| 成人国产在线观看| 久久九九久久九九| 国产一区二区主播在线| 精品理论电影在线| 久久成人18免费观看| 日韩免费性生活视频播放| 日韩和欧美一区二区| 欧美日韩国产高清一区二区 | 欧美国产欧美综合| 国产91精品欧美| 久久久久久97三级| 国产精品一品视频| 国产欧美久久久精品影院| 国产成人99久久亚洲综合精品| 日韩免费视频一区| 国产伦精一区二区三区| 久久综合资源网| 成人在线视频一区| 1区2区3区精品视频| 93久久精品日日躁夜夜躁欧美| 亚洲丝袜精品丝袜在线| 色综合久久综合网欧美综合网 | 久久国产精品露脸对白| 欧美精品久久久久久久多人混战 | 色综合久久久久综合99| 亚洲一区二区三区四区不卡| 欧美日本一区二区三区| 免费av成人在线| 久久色.com| 99视频精品全部免费在线| 亚洲一区日韩精品中文字幕| 欧美精品一卡两卡| 国产一区二区按摩在线观看| 中文字幕视频一区| 欧美色电影在线| 激情综合色综合久久综合| 国产精品福利在线播放| 欧美色男人天堂| 国产精品自拍在线| 有码一区二区三区| 日韩免费视频线观看| 91一区二区三区在线播放| 日韩高清一区在线| 亚洲国产精品黑人久久久| 欧美在线免费观看视频| 精品在线亚洲视频| 亚洲乱码国产乱码精品精小说| 56国语精品自产拍在线观看| 国产成人av电影在线观看| 亚洲高清免费观看 | 一区二区三区在线高清| 日韩三级视频中文字幕| 91丝袜美腿高跟国产极品老师| 蜜臀精品一区二区三区在线观看| 综合久久久久久| 久久久噜噜噜久久人人看 | 裸体在线国模精品偷拍| 日韩一区欧美小说| 久久久久久97三级| 777色狠狠一区二区三区| av男人天堂一区| 狠狠色丁香婷婷综合| 亚洲一区二区三区国产| 中文字幕一区日韩精品欧美| 久久丝袜美腿综合| 日韩一区二区精品在线观看| 在线视频欧美精品| 99视频超级精品| 国产一区二区三区香蕉| 蜜臀av一区二区在线免费观看| 香蕉成人啪国产精品视频综合网| 中文字幕一区二区三区视频| 国产亚洲一区二区三区四区| 欧美一区二区三区在线观看| 在线国产电影不卡| 91网站在线观看视频| 粉嫩在线一区二区三区视频| 国内欧美视频一区二区| 免费成人av资源网| 日本伊人午夜精品| 免费日本视频一区| 日韩电影在线观看网站| 日韩电影免费一区| 日韩精品久久久久久| 天使萌一区二区三区免费观看| 一区二区高清视频在线观看| 一区二区三区欧美激情| 一区二区三区不卡视频在线观看| 亚洲视频网在线直播| 亚洲男女毛片无遮挡| 亚洲免费成人av| 一区二区成人在线| 亚洲成va人在线观看| 丝袜美腿成人在线| 蜜桃久久av一区| 老司机精品视频导航| 激情综合网av| 国产iv一区二区三区| 北条麻妃一区二区三区| 91在线观看免费视频| 欧美日韩国产综合视频在线观看| 欧美挠脚心视频网站| 精品av久久707| 国产丝袜美腿一区二区三区| 中文字幕一区av| 亚洲福利视频一区| 国产一区二区中文字幕| 99国产精品99久久久久久| 欧美影院午夜播放| 欧美videos大乳护士334| 久久人人超碰精品| 亚洲日本青草视频在线怡红院| 亚洲一区二区在线视频| 日本aⅴ免费视频一区二区三区 | av不卡一区二区三区| 日本精品一级二级| 欧美美女bb生活片| 久久天堂av综合合色蜜桃网| 亚洲欧美另类图片小说| 午夜精品视频一区| 国产精品系列在线播放| 欧美日韩国产免费一区二区 | 亚洲品质自拍视频网站| 亚洲国产日韩av| 丁香六月综合激情| 欧美日本免费一区二区三区| 久久久另类综合| 免费观看30秒视频久久| 色综合久久天天综合网| 亚洲精品一区二区三区影院| 亚洲精品五月天| 国产成人av一区|