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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_core.c

?? 基于LPC2134的在ucos2操作系統(tǒng)下的源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號(hào):
/*
*********************************************************************************************************
*                                                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()

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲乱码中文字幕综合| 亚洲国产日日夜夜| 欧美日韩视频在线一区二区| 国产麻豆成人精品| 午夜精品一区二区三区免费视频| 国产亚洲精品免费| 日韩一级二级三级精品视频| 色综合视频一区二区三区高清| 久久99精品久久久久久久久久久久| 一区二区三区精品视频| 国产精品久久毛片a| 日韩欧美激情一区| 欧美久久久久久蜜桃| 91尤物视频在线观看| 国产精品亚洲视频| 激情六月婷婷久久| 天堂影院一区二区| 一区二区三区四区乱视频| 国产日韩av一区| 欧美精品一区二区三区蜜桃| 69av一区二区三区| 欧美日韩国产123区| 日本久久精品电影| 色综合一区二区三区| 成人国产一区二区三区精品| 高清日韩电视剧大全免费| 久久国产精品色| 奇米一区二区三区av| 性欧美疯狂xxxxbbbb| 亚洲午夜羞羞片| 亚洲一区二区视频| 亚洲国产一区二区三区| 夜夜嗨av一区二区三区中文字幕| 亚洲人成7777| 亚洲一区二区在线观看视频| 亚洲黄色免费电影| 一片黄亚洲嫩模| 亚洲宅男天堂在线观看无病毒| 一区二区三区国产豹纹内裤在线| 亚洲欧美另类小说| 一区二区三区不卡视频| 亚洲在线视频一区| 亚洲3atv精品一区二区三区| 亚洲成人精品一区二区| 亚洲aaa精品| 久久国产精品无码网站| 国内精品伊人久久久久av一坑| 国产一区二区在线观看视频| 国产乱码精品一区二区三区av| 国产精品影视天天线| 成人免费观看av| 一本一道久久a久久精品| 日本韩国欧美一区| 欧美精品免费视频| 精品免费视频一区二区| 国产性色一区二区| 亚洲精品免费在线播放| 午夜久久电影网| 国产在线精品免费| 成人在线视频一区| 色88888久久久久久影院野外| 欧美日韩成人在线| 欧美成人综合网站| 国产精品久久久久久久久久免费看 | 精品一区在线看| 国产成a人亚洲| 91搞黄在线观看| 91精品麻豆日日躁夜夜躁| 精品国产制服丝袜高跟| 国产精品视频yy9299一区| 亚洲精品乱码久久久久久久久| 偷偷要91色婷婷| 国产精品一二二区| 欧美色综合影院| 久久麻豆一区二区| 亚洲综合激情网| 国产麻豆精品一区二区| 一本色道久久加勒比精品 | 欧美日韩视频在线一区二区| 精品国产免费一区二区三区香蕉| 中文幕一区二区三区久久蜜桃| 夜夜嗨av一区二区三区四季av| 久久精品99国产精品日本| 99国产精品国产精品久久| 69精品人人人人| 国产精品另类一区| 日产国产欧美视频一区精品| 丁香六月综合激情| 91精品一区二区三区在线观看| 国产精品久99| 另类小说一区二区三区| 在线观看视频欧美| 国产欧美日韩精品a在线观看| 香蕉乱码成人久久天堂爱免费| 国产精品影视在线| 欧美伦理影视网| 亚洲欧洲日韩女同| 国产精品中文字幕日韩精品| 欧美日韩成人综合天天影院| 日韩一区在线播放| 国产精品中文字幕一区二区三区| 欧美日韩精品三区| 亚洲欧美日韩一区二区 | 久久精品国产免费| 欧美综合色免费| 国产精品欧美综合在线| 国产一区二区在线观看视频| 欧美伦理影视网| 一区二区日韩电影| eeuss鲁片一区二区三区| 精品免费99久久| 日韩av二区在线播放| 欧美日韩在线免费视频| 亚洲精品视频免费观看| 春色校园综合激情亚洲| 精品不卡在线视频| 美女视频黄 久久| 在线综合亚洲欧美在线视频 | 国产传媒一区在线| 精品国产123| 日本在线观看不卡视频| 91精品福利视频| 亚洲视频资源在线| a亚洲天堂av| 国产精品久久夜| eeuss鲁一区二区三区| 国产精品久久久久久久久快鸭| 成人小视频在线| 国产午夜三级一区二区三| 久久精品国产成人一区二区三区| 在线不卡免费欧美| 日韩黄色免费网站| 日韩欧美美女一区二区三区| 欧美a级理论片| 日韩三区在线观看| 国模娜娜一区二区三区| 精品国产一区二区三区忘忧草| 久久99国产精品免费| 欧美成人官网二区| 国产在线视频一区二区| 久久久久国产一区二区三区四区 | 夜夜亚洲天天久久| 欧美天堂一区二区三区| 亚洲va中文字幕| 欧美电影免费观看完整版| 国内精品不卡在线| 国产日韩欧美激情| www.日韩在线| 一区二区日韩av| 欧美一区二区三区的| 国产一区二区免费视频| 亚洲国产精品ⅴa在线观看| 91网站视频在线观看| 亚洲一区免费视频| 欧美一区二区三区喷汁尤物| 极品美女销魂一区二区三区免费| 久久久久久久久久久久久久久99 | 色素色在线综合| 午夜视频在线观看一区| 日韩欧美中文字幕精品| 国产黄色91视频| 一区二区三区色| 精品剧情v国产在线观看在线| 丁香婷婷综合五月| 一区二区三区在线观看欧美| 欧美精品久久久久久久多人混战| 免费久久精品视频| 国产女同互慰高潮91漫画| 色综合久久久久| 久久精品国产第一区二区三区| 国产精品盗摄一区二区三区| 欧美探花视频资源| 狠狠网亚洲精品| 艳妇臀荡乳欲伦亚洲一区| 日韩精品一区二区三区中文精品| 成人高清伦理免费影院在线观看| 一区二区三区高清不卡| 精品国精品国产尤物美女| 色综合久久久网| 国模冰冰炮一区二区| 亚洲一区二区精品久久av| 久久精品亚洲麻豆av一区二区 | 亚洲人午夜精品天堂一二香蕉| 欧美性猛交xxxxxxxx| 国产一区二区三区久久悠悠色av| 亚洲靠逼com| 久久久综合激的五月天| 欧美日韩一区二区在线视频| 国产激情偷乱视频一区二区三区| 亚洲bt欧美bt精品777| 国产精品电影一区二区| 欧美不卡一区二区| 欧美在线观看视频一区二区| 国产一区二区三区久久久| 午夜精品久久久久久久99水蜜桃 | 日韩精品一区二区在线观看| 色8久久人人97超碰香蕉987| 国产福利一区在线观看| 男男视频亚洲欧美| 亚洲国产一区二区a毛片|