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

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

?? os_core.c

?? 基于LPC2134的在ucos2操作系統下的源代碼
?? 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一区二区三区免费野_久草精品视频
97精品久久久午夜一区二区三区| 色狠狠桃花综合| 色综合中文字幕| 91精品国产福利在线观看| 国产精品无码永久免费888| 免费一级欧美片在线观看| 色成年激情久久综合| 中文字幕av资源一区| 黄页视频在线91| 911精品国产一区二区在线| 亚洲乱码国产乱码精品精98午夜| 国产v综合v亚洲欧| 日韩欧美aaaaaa| 日韩精品一级二级| 精品视频在线免费观看| 17c精品麻豆一区二区免费| 国产精品1区2区3区| 欧美不卡一区二区三区四区| 午夜av一区二区| 91黄色激情网站| 亚洲精品日日夜夜| 色八戒一区二区三区| 亚洲欧洲av在线| aa级大片欧美| 综合久久综合久久| 91免费精品国自产拍在线不卡| 久久午夜国产精品| 国产很黄免费观看久久| 久久品道一品道久久精品| 国产一区二区三区视频在线播放| 8v天堂国产在线一区二区| 无吗不卡中文字幕| 在线综合视频播放| 免费在线看成人av| 日韩欧美一卡二卡| 国产一区二区视频在线| 久久久久久久久久久久电影 | 91精品在线观看入口| 尤物在线观看一区| 欧美日韩不卡一区| 日本强好片久久久久久aaa| 日韩欧美aaaaaa| 国产成人综合亚洲91猫咪| 国产精品三级av在线播放| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲欧洲日韩av| 在线看一区二区| 日本欧美一区二区三区| xnxx国产精品| av一二三不卡影片| 午夜欧美在线一二页| 精品国产百合女同互慰| 福利视频网站一区二区三区| 亚洲精品国产精华液| 欧美日韩成人一区| 国产盗摄精品一区二区三区在线 | 久久精品人人做| 91麻豆免费看片| 五月综合激情网| 国产亚洲欧洲997久久综合 | 97精品国产露脸对白| 一区二区三区四区五区视频在线观看| 欧美日韩久久久久久| 精品一区二区影视| 亚洲精品免费电影| 精品粉嫩超白一线天av| 99精品国产视频| 日本午夜一区二区| 亚洲天堂网中文字| 日韩精品一区二区三区四区视频| 成人午夜免费电影| 日韩极品在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 欧美亚洲一区二区在线观看| 国产乱色国产精品免费视频| 一区二区在线免费| 欧美激情在线观看视频免费| 欧美日高清视频| 91网站最新地址| 韩国女主播一区| 天天综合色天天综合| 国产精品美女久久久久久久久 | 亚洲成人综合在线| 中文在线资源观看网站视频免费不卡| 欧美视频一区二区在线观看| 国产白丝网站精品污在线入口| 亚洲成av人片一区二区| 国产精品久久精品日日| 欧美mv日韩mv亚洲| 欧美精品九九99久久| 99在线精品观看| 国产成人鲁色资源国产91色综 | 亚洲成国产人片在线观看| 欧美激情一区在线| 久久亚洲二区三区| 日韩一区二区精品葵司在线| 欧美网站一区二区| 色综合久久久久网| 91丨九色丨尤物| 成人三级伦理片| 九九视频精品免费| 麻豆精品在线视频| 日韩成人一级片| 日韩在线观看一区二区| 亚洲成人免费看| 亚洲成人动漫在线观看| 一区二区三区四区不卡在线 | 大尺度一区二区| 国产精品自在在线| 国产精品自拍一区| 国产一区二区精品久久91| 久草热8精品视频在线观看| 蜜臀av一区二区在线免费观看| 丝袜美腿亚洲综合| 日本亚洲免费观看| 激情av综合网| 国产v日产∨综合v精品视频| 国内成+人亚洲+欧美+综合在线| 精品影院一区二区久久久| 国产一区二区三区四区在线观看| 国产一区二区三区| 国产91丝袜在线播放九色| 国产精品一二一区| 成人免费高清在线| 色婷婷综合久久久| 欧美日韩在线精品一区二区三区激情| 欧美亚洲免费在线一区| 91精品国产综合久久精品图片| 9191久久久久久久久久久| 精品福利av导航| 国产精品高潮呻吟久久| 一区二区三区在线免费视频| 日韩精品一二三区| 国产精品综合二区| 91国偷自产一区二区三区成为亚洲经典 | 不卡av在线免费观看| 91精品91久久久中77777| 欧美一区二区三区在线观看视频| 精品久久国产字幕高潮| 国产视频一区二区在线| 一区二区视频在线看| 日韩av在线播放中文字幕| 国产一区二区精品久久99| 91理论电影在线观看| 欧美一级二级三级乱码| 中文在线一区二区| 亚洲成av人片在线观看| 国产精品香蕉一区二区三区| 91麻豆精东视频| 欧美α欧美αv大片| 亚洲同性gay激情无套| 美女视频一区在线观看| 不卡一二三区首页| 91精品国产一区二区人妖| 欧美国产日韩精品免费观看| 天堂影院一区二区| 成人aaaa免费全部观看| 日韩欧美一级精品久久| 亚洲人xxxx| 国产精品1区2区3区在线观看| 欧美网站大全在线观看| 国产精品免费aⅴ片在线观看| 午夜精品久久一牛影视| eeuss鲁片一区二区三区| 日韩一级欧美一级| 亚洲一区二区三区在线| 成人免费电影视频| 精品日产卡一卡二卡麻豆| 一区二区三区免费观看| 国产精品影视网| 欧美成人一区二区| 亚洲电影欧美电影有声小说| av电影天堂一区二区在线 | 一级中文字幕一区二区| 国产很黄免费观看久久| 欧美成人福利视频| 免费人成精品欧美精品| 欧美无人高清视频在线观看| 中文字幕欧美一| 国产很黄免费观看久久| 精品91自产拍在线观看一区| 日本不卡在线视频| 555夜色666亚洲国产免| 亚洲综合区在线| 在线观看网站黄不卡| 亚洲欧美另类在线| 成人小视频在线| 国产精品视频观看| 成人激情免费视频| 欧美国产日本韩| 成人精品电影在线观看| 国产网红主播福利一区二区| 国产一区在线不卡| 欧美精品一区二区三| 久久草av在线| 久久婷婷成人综合色| 国产乱人伦偷精品视频不卡| 国产欧美一区在线| 99麻豆久久久国产精品免费优播| 国产精品久久一卡二卡|