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

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

?? os_core.c

?? ucos-ii+lpc123x proteus emulate
?? 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久久久久久老狼| 欧美日韩在线播| 奇米在线7777在线精品| 精品日韩在线一区| 国产一区二区伦理片| 国产精品色呦呦| 色一情一乱一乱一91av| 亚洲一级在线观看| 日韩精品中文字幕一区二区三区 | 亚洲综合av网| 欧美日韩免费电影| 精品一区二区三区在线播放| 中文字幕 久热精品 视频在线| 99国产一区二区三精品乱码| 亚洲a一区二区| 久久精品日韩一区二区三区| 97超碰欧美中文字幕| 亚洲午夜激情av| 久久久亚洲高清| 色呦呦日韩精品| 久久99国产精品麻豆| 国产精品免费视频观看| 欧美日韩在线观看一区二区 | 国内精品伊人久久久久av一坑 | 欧美日韩一区三区| 精品一区二区三区免费观看| 国产精品久久久久影院老司| 91精品欧美综合在线观看最新| 国产一区二区影院| 午夜精品久久久久久久蜜桃app| 26uuu久久综合| 欧美午夜不卡视频| 国产成人99久久亚洲综合精品| 亚洲综合图片区| 国产亚洲综合性久久久影院| 精品视频色一区| 国产91精品在线观看| 香蕉av福利精品导航| 国产精品久久久久久一区二区三区| 欧美美女激情18p| 99久久夜色精品国产网站| 日韩成人av影视| 亚洲精品中文字幕在线观看| 久久一日本道色综合| 欧美亚洲综合久久| 91在线免费视频观看| 韩国成人精品a∨在线观看| 亚洲一区二区三区视频在线| 国产精品免费aⅴ片在线观看| 日韩一区二区在线观看视频| 欧美这里有精品| 色综合天天综合色综合av| 国产一区二区导航在线播放| 日韩精彩视频在线观看| 一区二区三区美女视频| 亚洲视频一区在线| 中文字幕在线观看不卡| 久久精品视频网| 久久久国际精品| 精品国产一二三区| 日韩欧美一区二区在线视频| 日韩一区二区三区免费看| 91成人免费网站| 91在线观看地址| caoporm超碰国产精品| jlzzjlzz亚洲日本少妇| 成人午夜av影视| 国产a级毛片一区| 国产激情视频一区二区三区欧美| 久久国产精品99久久久久久老狼| 日韩—二三区免费观看av| 日韩国产精品91| 日本欧美韩国一区三区| 午夜精品久久久久久久蜜桃app| 亚洲一卡二卡三卡四卡五卡| 亚洲综合在线第一页| 亚洲bt欧美bt精品| 日韩成人一区二区三区在线观看| 无吗不卡中文字幕| 麻豆91小视频| 韩国一区二区在线观看| 国产高清不卡二三区| 成人av集中营| 91美女在线看| 欧美日韩中字一区| 日韩精品综合一本久道在线视频| 精品美女一区二区三区| 久久久亚洲精品石原莉奈| 亚洲国产精华液网站w| 亚洲桃色在线一区| 亚洲一区二区三区在线看| 午夜精品久久久久影视| 久久国产生活片100| 国产成人日日夜夜| 色哟哟在线观看一区二区三区| 欧美色网一区二区| 日韩免费高清av| 国产精品少妇自拍| 亚洲国产精品一区二区久久| 美女视频一区二区三区| 国产麻豆9l精品三级站| 色综合天天综合色综合av| 欧美理论在线播放| 久久久久久夜精品精品免费| 亚洲三级免费电影| 奇米精品一区二区三区四区| 国产精品 欧美精品| 日本韩国欧美在线| 精品精品欲导航| 亚洲免费在线播放| 久久草av在线| 欧美影院一区二区三区| 26uuu精品一区二区| 亚洲另类春色国产| 狠狠色丁香婷婷综合久久片| 97精品国产露脸对白| wwwwww.欧美系列| 最新不卡av在线| 美女在线一区二区| 一道本成人在线| 2欧美一区二区三区在线观看视频| 亚洲人成在线观看一区二区| 麻豆一区二区三| 色综合久久88色综合天天6| 亚洲精品在线免费播放| 亚洲国产成人va在线观看天堂| 国产成人av在线影院| 欧美精品v日韩精品v韩国精品v| 国产精品网站在线观看| 免播放器亚洲一区| 在线视频你懂得一区二区三区| 国产欧美一区二区在线观看| 日本视频一区二区| 色综合久久中文综合久久97| 久久久精品免费网站| 免费久久99精品国产| 在线国产电影不卡| 国产精品少妇自拍| 国产一区不卡在线| 欧美成人aa大片| 日韩精品一级二级| 欧美性xxxxxx少妇| 亚洲精选免费视频| voyeur盗摄精品| 国产精品私人影院| 久久超碰97人人做人人爱| 91.com视频| 午夜精品一区在线观看| 欧美少妇一区二区| 亚洲一区二区精品3399| 91亚洲精品一区二区乱码| 国产视频亚洲色图| 韩国一区二区在线观看| 精品国产一区二区国模嫣然| 免费在线视频一区| 7777精品久久久大香线蕉| 夜夜亚洲天天久久| 91成人网在线| 亚洲永久免费av| 欧美性受极品xxxx喷水| 一区二区三区免费看视频| 91蝌蚪国产九色| 一个色在线综合| 欧美日韩视频在线一区二区| 亚洲尤物视频在线| 欧美日韩中文一区| 午夜精品aaa| 5月丁香婷婷综合| 蜜臀a∨国产成人精品| 日韩一区二区免费在线观看| 蜜桃久久精品一区二区| 日韩一区二区三免费高清| 久久成人免费日本黄色| 久久亚区不卡日本| 成人精品鲁一区一区二区| 欧美国产1区2区| 91免费版在线| 无码av免费一区二区三区试看| 7777精品伊人久久久大香线蕉经典版下载 | 国内精品国产成人| 久久人人爽人人爽| 成人精品gif动图一区| 中文字幕在线一区免费| 色婷婷精品大视频在线蜜桃视频| 亚洲一区在线观看网站| 日韩一区二区三区高清免费看看| 久久国产尿小便嘘嘘尿| 亚洲国产精品高清| 色噜噜狠狠一区二区三区果冻| 五月婷婷综合网| 久久久99久久| 在线欧美日韩国产| 久久电影国产免费久久电影| 中文在线资源观看网站视频免费不卡| 成人av片在线观看| 五月开心婷婷久久| 国产日韩欧美精品一区| 欧美色成人综合|