亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一区二区三区四区亚洲| 日本黄色一区二区| 99热精品一区二区| 欧美精品视频www在线观看| 精品国产123| 亚洲综合男人的天堂| 国产精品系列在线观看| 欧美美女网站色| 综合久久国产九一剧情麻豆| 久久国产精品露脸对白| 在线观看三级视频欧美| 国产日韩精品一区二区浪潮av | 成人黄色片在线观看| 日韩一区二区三区视频在线| 亚洲精品视频自拍| 懂色av中文一区二区三区| 日韩精品一区二区三区视频| 日韩高清不卡一区| 色妞www精品视频| 中文无字幕一区二区三区| 美脚の诱脚舐め脚责91| 91精品国产乱码| 亚洲国产中文字幕在线视频综合| 99视频国产精品| 国产精品久久久久婷婷二区次 | 日韩专区欧美专区| 在线免费观看日韩欧美| 亚洲免费电影在线| 色综合中文字幕国产 | 亚洲免费大片在线观看| 99精品国产视频| 自拍av一区二区三区| 粗大黑人巨茎大战欧美成人| 久久久91精品国产一区二区三区| 免费成人性网站| 精品国产1区二区| 国产一区二区三区免费看| 欧美videossexotv100| 麻豆精品视频在线观看视频| 亚洲精品一区二区在线观看| 蜜臀国产一区二区三区在线播放| 91精品国产一区二区三区| 奇米影视在线99精品| 欧美一级专区免费大片| 久久精品二区亚洲w码| 日韩欧美国产一区在线观看| 国产一区二区三区四区五区入口 | 国产精品国产三级国产aⅴ原创| 国产一区二区三区不卡在线观看| 久久亚洲精品国产精品紫薇| 国产激情偷乱视频一区二区三区| 久久久久久久久久久久久女国产乱| 国产曰批免费观看久久久| 中文欧美字幕免费| 91福利在线播放| 久久99蜜桃精品| 日韩精品一区二区三区四区视频| 久久99精品国产麻豆不卡| 欧美tickling挠脚心丨vk| 成人午夜视频网站| 一区二区三区不卡视频在线观看 | 欧美视频完全免费看| 天天综合天天做天天综合| 精品久久久久久久一区二区蜜臀| 国产91精品入口| 一区二区久久久| 日韩欧美在线影院| 成人免费毛片嘿嘿连载视频| 亚洲精品美国一| 日韩欧美亚洲另类制服综合在线| 国产成人h网站| 一级日本不卡的影视| 精品国产网站在线观看| av午夜一区麻豆| 视频在线观看一区| 欧美国产精品v| 欧美精品在线观看播放| 成人性视频网站| 亚洲成a人片在线不卡一二三区| 久久综合久久99| 欧美色手机在线观看| 国产a级毛片一区| 婷婷综合久久一区二区三区| 中文字幕欧美激情一区| 日韩一区二区麻豆国产| 色狠狠综合天天综合综合| 国产一区二区三区四区五区入口 | 欧美日韩一区二区三区免费看| 麻豆91在线播放免费| 一区二区三区免费在线观看| 国产日韩欧美精品在线| 欧美一区二区日韩一区二区| 色天天综合色天天久久| 成人深夜在线观看| 精品一区二区免费视频| 日韩国产欧美在线视频| 一区二区三区四区视频精品免费 | 国产精品99久| 蜜臀久久99精品久久久久久9| 一区二区三区四区国产精品| 国产精品乱人伦中文| 久久这里只精品最新地址| 日韩午夜激情电影| 欧美高清视频不卡网| 在线精品视频一区二区三四| 91蜜桃传媒精品久久久一区二区| 国产经典欧美精品| 国产一区二区精品久久| 激情图片小说一区| 国产一区二区三区四| 国产在线观看免费一区| 激情综合网最新| 国产精品123| 国产成人欧美日韩在线电影| 国产麻豆视频一区二区| 国产精品亚洲专一区二区三区| 麻豆专区一区二区三区四区五区| 日韩福利电影在线| 久久精品国产**网站演员| 欧美国产综合一区二区| 欧美在线短视频| 欧美色视频一区| 欧美久久久久久蜜桃| 在线播放91灌醉迷j高跟美女| 精品视频在线免费看| 在线电影国产精品| 欧美r级电影在线观看| 久久精品夜色噜噜亚洲a∨| 久久亚洲影视婷婷| 国产日韩三级在线| 亚洲少妇最新在线视频| 亚洲美女视频一区| 一区二区三区日韩欧美精品| 亚洲精品成人在线| 日本午夜精品视频在线观看| 人人爽香蕉精品| 久久99精品久久久久久国产越南| 日韩av电影免费观看高清完整版 | 91行情网站电视在线观看高清版| 91美女在线观看| 欧美乱熟臀69xxxxxx| 日韩欧美激情四射| 欧美激情在线一区二区| 中文字幕一区二| 午夜精品久久久久久久蜜桃app| 琪琪一区二区三区| 成人免费视频网站在线观看| 91久久精品国产91性色tv| 欧美一区二区性放荡片| 国产日产欧美一区二区视频| 亚洲欧美激情插| 日本美女一区二区三区| 国产成人精品免费在线| 色综合亚洲欧洲| 欧美变态口味重另类| 国产精品免费观看视频| 天天色天天操综合| 成人少妇影院yyyy| 欧美一个色资源| ㊣最新国产の精品bt伙计久久| 天堂精品中文字幕在线| 国产精品主播直播| 欧美性一二三区| 欧美激情一区二区三区不卡| 亚洲福利国产精品| 国产91丝袜在线播放九色| 欧美日韩不卡在线| 国产精品国产三级国产| 麻豆精品在线播放| 欧洲一区二区av| 国产精品日产欧美久久久久| 日韩—二三区免费观看av| 91传媒视频在线播放| 国产精品视频免费| 国内精品不卡在线| 日韩一区二区三区免费看| 一区二区三区欧美日| 成人激情电影免费在线观看| 2021中文字幕一区亚洲| 免费成人你懂的| 欧美人与性动xxxx| 亚洲少妇屁股交4| 国产高清成人在线| 91精品国产综合久久久蜜臀粉嫩 | 精品免费国产一区二区三区四区| 一区二区视频在线看| 国产成人综合亚洲91猫咪| 欧美日本在线播放| 亚洲图片欧美一区| 色美美综合视频| 亚洲三级在线免费观看| 成人午夜视频在线| 国产精品天干天干在线综合| 国产乱子伦视频一区二区三区| 亚洲人成在线播放网站岛国| 国产美女在线精品| 久久久精品2019中文字幕之3| 青青草精品视频| 日韩一区二区电影在线| 日韩成人免费电影|