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

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

?? os_core.c

?? ucos-ii在C8051F020上的移植
?? 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 code 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 code  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) KCREENTRANT
{
    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) KCREENTRANT
{
#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) KCREENTRANT
{
#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.
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品77777| 亚洲成a人v欧美综合天堂| 韩国中文字幕2020精品| 91精品午夜视频| 美女脱光内衣内裤视频久久网站 | 成人一级片在线观看| 久久品道一品道久久精品| 国产福利精品一区| 亚洲私人黄色宅男| 欧美日韩国产高清一区二区| 日韩在线观看一区二区| 精品免费99久久| 成人动漫一区二区三区| 亚洲一卡二卡三卡四卡无卡久久| 欧美在线观看一区| 蜜桃一区二区三区在线观看| 国产欧美va欧美不卡在线| 91麻豆视频网站| 日本午夜精品视频在线观看 | 久久久久久免费网| 成年人网站91| 午夜一区二区三区在线观看| 亚洲精品一区二区三区在线观看| 高清国产一区二区三区| 亚洲激情图片小说视频| 欧美成人一区二区三区| 不卡视频一二三| 天使萌一区二区三区免费观看| 久久综合久久综合久久| 91精品福利在线| 捆绑调教一区二区三区| 综合激情网...| 欧美xxxxxxxx| 欧美性三三影院| 国产麻豆精品久久一二三| 亚洲精品中文在线| 久久久久亚洲综合| 欧美久久久久免费| jizzjizzjizz欧美| 麻豆91小视频| 亚洲午夜在线电影| 中文字幕成人在线观看| 欧美一级精品大片| 91蜜桃在线观看| 国产伦精品一区二区三区在线观看| 亚洲另类一区二区| 欧美国产1区2区| 日韩三级视频中文字幕| 欧美在线一二三四区| 成人精品免费视频| 国精品**一区二区三区在线蜜桃| 亚洲图片欧美色图| 国产精品久久久久久久久动漫 | 精品久久人人做人人爰| 欧美视频一区二区三区| 9l国产精品久久久久麻豆| 国内精品久久久久影院色| 偷拍日韩校园综合在线| 亚洲综合自拍偷拍| 国产精品高潮呻吟| 亚洲国产成人午夜在线一区| 欧美videos大乳护士334| 51精品国自产在线| 精品视频在线免费看| 日本电影亚洲天堂一区| 99精品欧美一区| 成人动漫一区二区三区| 国产+成+人+亚洲欧洲自线| 国产在线精品不卡| 黄色日韩网站视频| 精品一区二区三区久久| 麻豆久久久久久| 麻豆精品在线视频| 奇米精品一区二区三区在线观看| 日韩福利电影在线观看| 日日骚欧美日韩| 日韩国产精品大片| 男男视频亚洲欧美| 蜜臂av日日欢夜夜爽一区| 青青草91视频| 看片网站欧美日韩| 国产一区视频在线看| 国产激情精品久久久第一区二区 | 丰满岳乱妇一区二区三区| 精品一区二区免费视频| 久久66热re国产| 国产一区二区三区电影在线观看| 精品一区二区三区在线播放视频| 激情图区综合网| 韩国欧美国产1区| 丁香六月综合激情| www.日韩大片| 欧美视频一区二区在线观看| 欧美精品高清视频| 欧美大肚乱孕交hd孕妇| 国产午夜亚洲精品午夜鲁丝片| 国产亚洲精久久久久久| 国产精品福利av| 亚洲综合图片区| 男女男精品视频网| 国产精品一区二区不卡| 99久久国产综合精品女不卡| 欧美性猛交xxxxxx富婆| 精品少妇一区二区三区日产乱码| 久久色在线视频| 亚洲另类一区二区| 免费日韩伦理电影| 粉嫩绯色av一区二区在线观看 | 在线一区二区三区四区五区| 777亚洲妇女| 久久理论电影网| 亚洲视频电影在线| 日本三级亚洲精品| 国产成人啪免费观看软件| 日本黄色一区二区| 日韩欧美国产精品| 亚洲欧洲韩国日本视频| 日本vs亚洲vs韩国一区三区二区| 国产成人午夜99999| 色婷婷久久99综合精品jk白丝 | 国产午夜亚洲精品不卡| 亚洲欧美二区三区| 久久99国产精品久久99| 一本色道**综合亚洲精品蜜桃冫| 欧美一级免费观看| 最新欧美精品一区二区三区| 毛片av中文字幕一区二区| 91蜜桃婷婷狠狠久久综合9色| 日韩欧美激情一区| 综合久久给合久久狠狠狠97色| 日韩国产在线一| 97se亚洲国产综合自在线| 欧美一卡在线观看| 亚洲精品国产第一综合99久久 | 久久久久久久久久久久久久久99 | 亚洲国产精品视频| 成人综合婷婷国产精品久久蜜臀| 欧美日韩国产天堂| 国产精品久久久久天堂| 久久精品国产77777蜜臀| 91国偷自产一区二区三区成为亚洲经典| 精品日韩99亚洲| 五月天一区二区三区| 91视频xxxx| 最好看的中文字幕久久| 国产精品18久久久久久vr| 欧美一区二区久久| 亚洲.国产.中文慕字在线| 色综合天天综合网天天看片| 久久久精品中文字幕麻豆发布| 日韩国产在线观看| 欧美精选在线播放| 亚洲在线免费播放| 色婷婷综合久久| 综合色天天鬼久久鬼色| 成人av午夜电影| 久久久精品黄色| 韩国成人精品a∨在线观看| 欧美久久久久中文字幕| 午夜天堂影视香蕉久久| 欧美日韩视频不卡| 亚洲综合色网站| 欧美亚洲综合色| 一区二区三区国产精华| 色婷婷激情一区二区三区| 中文字幕在线一区免费| 不卡一区二区在线| 亚洲欧洲日韩av| 91在线无精精品入口| 成人免费在线观看入口| 91免费国产视频网站| 亚洲免费在线视频一区 二区| 91小视频在线观看| 精品一区二区三区视频| 日韩一区二区麻豆国产| 久久99蜜桃精品| 久久久久国产精品免费免费搜索| 国产超碰在线一区| 亚洲欧洲av色图| 欧美性受xxxx| 日本vs亚洲vs韩国一区三区| 精品国产免费人成电影在线观看四季 | 91天堂素人约啪| 亚洲最大色网站| 欧美一卡二卡在线| 国产综合色在线视频区| 日本一区二区高清| 91福利国产精品| 人人超碰91尤物精品国产| 久久这里只有精品首页| 成人精品高清在线| 一区二区三区欧美激情| 8x福利精品第一导航| 国产精品香蕉一区二区三区| 国产精品不卡视频| 欧美欧美欧美欧美首页| 韩国欧美国产1区| 椎名由奈av一区二区三区| 欧美伦理影视网| 国产精品香蕉一区二区三区|