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

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

?? os_core.c

?? LPC2104/5/6嵌入式系統程序實例,帶有PROTUES7.1仿真文件,適合做入門指導
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             CORE FUNCTIONS
*
*                          (c) Copyright 1992-2002, 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,       /* 0x00 to 0x0F                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x10 to 0x1F                             */
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x20 to 0x2F                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x30 to 0x3F                             */
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x40 to 0x4F                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x50 to 0x5F                             */
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x60 to 0x6F                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x70 to 0x7F                             */
    7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x80 to 0x8F                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x90 to 0x9F                             */
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xA0 to 0xAF                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xB0 to 0xBF                             */
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xC0 to 0xCF                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xD0 to 0xDF                             */
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xE0 to 0xEF                             */
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0        /* 0xF0 to 0xFF                             */
};

/*
*********************************************************************************************************
*                                       FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static  void  OS_InitEventList(void);
static  void  OS_InitMisc(void);
static  void  OS_InitRdyList(void);
static  void  OS_InitTaskIdle(void);
static  void  OS_InitTaskStat(void);
static  void  OS_InitTCBList(void);

/*$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)
{
#if OS_VERSION >= 204
    OSInitHookBegin();                                           /* Call port specific initialization code   */
#endif

    OS_InitMisc();                                               /* Initialize miscellaneous variables       */

    OS_InitRdyList();                                            /* Initialize the Ready List                */
    OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
    OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */

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

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

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

    OS_InitTaskIdle();                                           /* Create the Idle Task                     */
#if OS_TASK_STAT_EN > 0
    OS_InitTaskStat();                                           /* Create the Statistic Task                */
#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) This function should be called ith interrupts already disabled
*              2) Your ISR can directly increment OSIntNesting without calling this function because
*                 OSIntNesting has been declared 'global'.  
*              3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
*              4) 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.
*              5) You are allowed to nest interrupts up to 255 levels deep.
*              6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
*                 OSIntEnter() is always called with interrupts disabled.
*********************************************************************************************************
*/

void  OSIntEnter (void)
{
    if (OSRunning == TRUE) {
        if (OSIntNesting < 255) {
            OSIntNesting++;                      /* Increment ISR nesting level                        */
        }
    }
}
/*$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 OS_SchedLock())
*********************************************************************************************************
*/

void  OSIntExit (void)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;
#endif
    
    
    if (OSRunning == TRUE) {
        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 ctx switches */
                OSIntCtxSw();                              /* Perform interrupt level ctx 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
*
* Returns    : none
*
* Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
*                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
*********************************************************************************************************
*/

#if OS_SCHED_LOCK_EN > 0
void  OSSchedLock (void)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    
    
    if (OSRunning == TRUE) {                     /* Make sure multitasking is running                  */
        OS_ENTER_CRITICAL();
        if (OSLockNesting < 255) {               /* Prevent OSLockNesting from wrapping back to 0      */
            OSLockNesting++;                     /* Increment lock nesting level                       */
        }
        OS_EXIT_CRITICAL();
    }
}
#endif    

/*$PAGE*/
/*
*********************************************************************************************************
*                                          ENABLE SCHEDULING
*
* Description: This function is used to re-allow rescheduling.
*
* Arguments  : none
*
* Returns    : none
*
* Notes      : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair.  In other words, for every
*                 call to OSSchedLock() you MUST have a call to OSSchedUnlock().
*********************************************************************************************************
*/

#if OS_SCHED_LOCK_EN > 0
void  OSSchedUnlock (void)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;
#endif    
    
    
    if (OSRunning == TRUE) {                                   /* Make sure multitasking is running    */
        OS_ENTER_CRITICAL();
        if (OSLockNesting > 0) {                               /* Do not decrement if already 0        */
            OSLockNesting--;                                   /* Decrement lock nesting level         */
            if ((OSLockNesting == 0) && (OSIntNesting == 0)) { /* See if sched. enabled and not an ISR */
                OS_EXIT_CRITICAL();
                OS_Sched();                                    /* See if a HPT is ready                */
            } else {
                OS_EXIT_CRITICAL();
            }
        } else {
            OS_EXIT_CRITICAL();
        }
    }
}
#endif    

/*$PAGE*/
/*
*********************************************************************************************************
*                                          START MULTITASKING
*
* Description: This function is used to start the multitasking process which lets uC/OS-II manages the
*              task that you have created.  Before you can call OSStart(), you MUST have called OSInit()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲伦在线观看| 久久精品国产秦先生| 午夜欧美大尺度福利影院在线看| 九九**精品视频免费播放| 不卡的电视剧免费网站有什么| 在线观看国产91| 久久久精品人体av艺术| 丝袜美腿一区二区三区| 成人av在线资源网站| 日韩欧美一区在线观看| 亚洲欧美日韩系列| 日本一区中文字幕| 99re在线精品| 国产欧美一区二区在线| 蜜臀99久久精品久久久久久软件 | youjizz久久| 337p日本欧洲亚洲大胆精品| 亚洲国产精品综合小说图片区| 成人综合日日夜夜| 欧美精品一区二区久久久| 亚洲一区二区四区蜜桃| 色综合中文字幕国产| 中文字幕乱码久久午夜不卡 | 欧美刺激午夜性久久久久久久| 一区二区三区日韩精品| 不卡欧美aaaaa| 一区精品在线播放| 成人精品亚洲人成在线| 国产无人区一区二区三区| 麻豆成人综合网| 日韩一级片在线观看| 日本亚洲三级在线| 日韩视频免费观看高清完整版在线观看 | 欧美三级中文字幕| 亚洲精品写真福利| 色噜噜狠狠一区二区三区果冻| 亚洲欧美日韩国产综合| 色综合天天综合狠狠| 亚洲欧美日韩国产中文在线| 日本电影欧美片| 亚洲午夜精品久久久久久久久| 在线精品国精品国产尤物884a| 亚洲国产精品久久久男人的天堂| 欧美怡红院视频| 日韩有码一区二区三区| 日韩小视频在线观看专区| 久久不见久久见免费视频7| 精品1区2区在线观看| 风间由美中文字幕在线看视频国产欧美| 久久久久久久av麻豆果冻| 国产一区欧美日韩| 国产精品白丝在线| 91激情五月电影| 视频一区二区不卡| 久久综合久久久久88| 成人av资源下载| 国产精品国产精品国产专区不蜜 | 日韩精品一二三四| 精品女同一区二区| 成人av影视在线观看| 亚洲免费在线观看视频| 在线视频国产一区| 久久精品国产精品亚洲综合| 久久精品人人做人人综合| 91网站最新地址| 蜜臀av国产精品久久久久| 久久久www免费人成精品| 99精品欧美一区二区三区小说| 亚洲亚洲精品在线观看| 久久综合色播五月| 欧美在线一二三| 久久综合综合久久综合| 最近中文字幕一区二区三区| 欧美一区在线视频| 成人免费看的视频| 久久国产剧场电影| 成人欧美一区二区三区1314| 欧美福利一区二区| eeuss影院一区二区三区| 午夜电影久久久| 国产精品福利一区| 欧美日韩高清不卡| 99久久婷婷国产| 狠狠狠色丁香婷婷综合激情| 亚洲精品一卡二卡| 国产女同性恋一区二区| 欧美日韩和欧美的一区二区| 国产精品一级二级三级| 亚洲欧洲日韩一区二区三区| 国产乱人伦偷精品视频不卡| 欧美午夜精品久久久久久孕妇| 国产精品乱码妇女bbbb| 韩日欧美一区二区三区| 精品少妇一区二区三区免费观看| 日本一区二区高清| 成人一区二区三区中文字幕| 日韩欧美成人激情| 亚洲综合精品自拍| 亚洲18色成人| 久久久久久免费| 久久久久久久久99精品| 麻豆成人av在线| 久久综合狠狠综合久久综合88| 欧美色视频在线| 91视频在线观看| 国产成人精品aa毛片| 麻豆精品国产传媒mv男同| 亚洲综合在线第一页| 1区2区3区国产精品| 国产成人午夜高潮毛片| 欧美视频在线一区二区三区 | 91美女福利视频| 不卡的av中国片| 成人午夜av影视| 成人美女视频在线观看18| 国产精品一区二区在线看| 激情都市一区二区| 国产做a爰片久久毛片| 精彩视频一区二区三区| 久久福利视频一区二区| 蜜臀av性久久久久蜜臀av麻豆| 免费人成在线不卡| 蜜臀av性久久久久蜜臀av麻豆| 免费欧美日韩国产三级电影| 九色综合狠狠综合久久| 国产综合色视频| 成人一区二区三区中文字幕| av电影在线观看一区| 日本高清免费不卡视频| 欧美日韩在线三级| 337p亚洲精品色噜噜| 日韩一级免费一区| 国产色爱av资源综合区| 国产精品国产三级国产普通话99| 亚洲日本在线天堂| 一区二区三区不卡在线观看| 亚洲成人午夜电影| 老司机午夜精品99久久| 国产精品一区不卡| 色婷婷精品久久二区二区蜜臀av| 欧美羞羞免费网站| 91精品国产91久久久久久最新毛片| 精品免费国产一区二区三区四区| 久久精品网站免费观看| 综合色中文字幕| 日本欧美肥老太交大片| 国产精品一区二区三区网站| 99久久精品国产一区二区三区| 欧美色视频一区| 日韩美女天天操| 国产精品国产三级国产| 日韩精品免费视频人成| 国产精品99久久久久久久女警 | 中文字幕中文字幕一区| 亚洲一区二区黄色| 国产精品996| 91久久精品一区二区三| 日韩一级二级三级精品视频| 国产欧美日本一区二区三区| 亚洲va中文字幕| 国产剧情一区二区| 在线观看三级视频欧美| 精品99999| 午夜视频在线观看一区二区三区| 国产老妇另类xxxxx| 精品视频免费看| 国产精品超碰97尤物18| 九一九一国产精品| 欧美日本一区二区三区| 日本一区二区三区四区在线视频| 玉米视频成人免费看| 美美哒免费高清在线观看视频一区二区 | 欧美浪妇xxxx高跟鞋交| 日韩精品一区二区三区在线| 国产精品久久久久四虎| 日本最新不卡在线| 91免费版在线看| 久久九九影视网| 舔着乳尖日韩一区| 91污片在线观看| 国产亚洲精品7777| 免费高清在线视频一区·| 在线免费不卡电影| 亚洲视频你懂的| av网站免费线看精品| 久久影视一区二区| 乱中年女人伦av一区二区| 欧美日韩免费视频| 亚洲综合色噜噜狠狠| 91视频com| 最新国产の精品合集bt伙计| 国产成人一级电影| 精品国产伦一区二区三区免费| 亚洲国产综合人成综合网站| 色综合天天综合给合国产| 国产精品免费aⅴ片在线观看| 国产一区二区三区四区五区美女| 日韩一区二区三区免费看| 日本在线不卡视频一二三区| 91麻豆精品国产无毒不卡在线观看|