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

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

?? os_corex.c

?? 嵌入式操作系統uCos-ii的2.52版源代碼
?? 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  OSUnMapTbl[256];

/*
*********************************************************************************************************
*                                       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)
{
    int i;
    INT8U  const  OSUnMapTbl1[] = {
    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                             */
    };

    INT8U  const  OSUnMapTbl2[] = {
    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                             */
    };

    for(i=0; i<128; i++) {
          OSUnMapTbl[i] = OSUnMapTbl1[i];
          OSUnMapTbl[i+128] = OSUnMapTbl2[i];
    }

#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    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美zozozo| 午夜成人免费视频| 亚洲国产成人av| 国产综合久久久久久鬼色| 色婷婷av一区二区三区之一色屋| 日韩一区二区三区在线| 亚洲欧美日韩中文字幕一区二区三区| 日韩电影免费一区| 色婷婷亚洲婷婷| 国产无人区一区二区三区| 亚洲一区二区三区不卡国产欧美| 欧美巨大另类极品videosbest| 国产视频不卡一区| 麻豆精品在线观看| 欧美日韩一区二区三区四区五区 | 性久久久久久久久久久久| 国产乱码精品1区2区3区| 亚洲国产欧美在线人成| 精品日韩av一区二区| 色综合久久综合| 91网站在线观看视频| 精品国产麻豆免费人成网站| 国产精品久久久久久久岛一牛影视 | 国产一区二区三区国产| 中文字幕一区免费在线观看 | 精品精品欲导航| 亚洲bt欧美bt精品| 精品视频一区二区三区免费| 亚洲制服丝袜一区| 在线观看网站黄不卡| 一区二区三区欧美日| 91免费版在线| 亚洲一区二区在线播放相泽| 91福利视频网站| 亚洲精品写真福利| 欧美亚洲日本国产| 亚洲一区av在线| 欧美欧美欧美欧美首页| 天天免费综合色| 日韩色视频在线观看| 久久精品国产精品亚洲精品| 精品第一国产综合精品aⅴ| 国产剧情一区二区| 中文在线免费一区三区高中清不卡| 国产福利精品导航| 日韩码欧中文字| 欧美性videosxxxxx| 日韩av二区在线播放| 久久久精品国产99久久精品芒果| 国产1区2区3区精品美女| 国产精品久久久久三级| 色8久久精品久久久久久蜜| 亚洲午夜视频在线观看| 91精品国产欧美一区二区成人| 久久精品国产精品亚洲综合| 国产精品无码永久免费888| 色综合久久中文综合久久97| 亚洲福利国产精品| 精品国产人成亚洲区| 国产.欧美.日韩| 亚洲国产精品久久艾草纯爱 | 日本伊人色综合网| 国产亚洲一二三区| 欧美自拍偷拍一区| 国产综合色在线视频区| 亚洲欧美日韩国产成人精品影院| 6080午夜不卡| 国产乱对白刺激视频不卡| 亚洲精品乱码久久久久久久久 | 91久久精品日日躁夜夜躁欧美| 水野朝阳av一区二区三区| 26uuu色噜噜精品一区| 色久综合一二码| 黄色成人免费在线| 亚洲图片自拍偷拍| 久久久99久久精品欧美| 欧美视频一区在线观看| 国产成人av一区二区| 亚洲国产成人av| 国产精品免费免费| 6080日韩午夜伦伦午夜伦| 成人激情小说网站| 男女男精品网站| kk眼镜猥琐国模调教系列一区二区| 亚洲国产aⅴ天堂久久| 欧美经典一区二区| 欧美一个色资源| 欧美亚洲动漫精品| jizzjizzjizz欧美| 久久不见久久见中文字幕免费| 一区二区三区免费看视频| 亚洲国产精品高清| 精品日韩一区二区三区免费视频| 欧美日韩综合在线免费观看| 97久久人人超碰| 懂色av一区二区夜夜嗨| 美女视频网站久久| 亚洲高清在线视频| 一区二区三区四区不卡在线| 国产精品久久毛片av大全日韩| 精品剧情v国产在线观看在线| 欧美日韩精品综合在线| 91色在线porny| av中文字幕不卡| 国产91综合一区在线观看| 精品在线一区二区三区| 麻豆久久一区二区| 日本中文字幕不卡| 日本欧美在线看| 日韩电影免费在线看| 亚洲成人高清在线| 亚洲成av人片一区二区梦乃| 一区二区三区精品视频在线| 伊人色综合久久天天| 自拍偷拍欧美精品| 亚洲欧美电影一区二区| 最近日韩中文字幕| 亚洲精品乱码久久久久| 亚洲激情校园春色| 性做久久久久久| 免费欧美在线视频| 狠狠色丁香久久婷婷综合丁香| 九九精品一区二区| 国产精品77777| 成人av在线网站| 91美女在线看| 欧美亚洲自拍偷拍| 欧美精品久久一区二区三区| 884aa四虎影成人精品一区| 日韩视频一区二区三区在线播放| 日韩欧美国产不卡| 久久婷婷色综合| 亚洲欧洲日韩在线| 亚洲国产一区二区在线播放| 日韩不卡一区二区| 韩国精品久久久| aaa国产一区| 欧美日韩另类一区| 精品国产sm最大网站免费看| 国产精品色在线| 一色桃子久久精品亚洲| 亚洲成在线观看| 日本一区中文字幕| 成人爽a毛片一区二区免费| 色琪琪一区二区三区亚洲区| 日韩亚洲欧美中文三级| 国产清纯白嫩初高生在线观看91| 亚洲精品菠萝久久久久久久| 免费观看一级特黄欧美大片| 成人av资源站| 制服丝袜中文字幕一区| 国产欧美日韩在线| 亚洲午夜精品在线| 国产精品综合在线视频| 亚洲欧洲在线观看av| 香蕉久久一区二区不卡无毒影院 | 日韩久久精品一区| 亚洲欧洲日产国码二区| 青青草原综合久久大伊人精品优势| 国产很黄免费观看久久| 欧美系列日韩一区| 国产精品三级视频| 老司机一区二区| 欧美视频在线一区二区三区| 国产清纯白嫩初高生在线观看91| 亚洲线精品一区二区三区八戒| 国产精品亚洲午夜一区二区三区 | 日韩精品欧美精品| 97se亚洲国产综合自在线不卡| 日韩欧美中文字幕制服| 中文字幕亚洲区| 国产福利91精品| 日韩一级二级三级| 亚洲国产精品久久久久秋霞影院| 国产91精品欧美| 精品福利一区二区三区| 亚洲成人在线观看视频| 91色视频在线| 国产精品久久久久三级| 国产黄人亚洲片| 精品国产乱码久久久久久久| 日本美女一区二区三区视频| 色播五月激情综合网| 国产精品色哟哟网站| 国产精品资源在线| 精品国精品国产尤物美女| 婷婷久久综合九色综合伊人色| 一本色道**综合亚洲精品蜜桃冫| 国产精品视频免费看| 国产不卡在线一区| 久久综合九色综合97_久久久| 蜜臀久久久99精品久久久久久| 欧美日韩电影在线播放| 一区二区三区在线影院| 91丨porny丨中文| 亚洲图片你懂的| 色综合一个色综合亚洲| 亚洲人成影院在线观看| 在线免费一区三区| 亚洲国产美女搞黄色|