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

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

?? os_core.c

?? 一步 移植ucosii for c51,ucosii for 51多任務實時操作系統
?? 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 "uCOS_II.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) OS_REENTRANT;
static  void  OS_InitMisc(void) OS_REENTRANT;
static  void  OS_InitRdyList(void) OS_REENTRANT;
static  void  OS_InitTaskIdle(void) OS_REENTRANT;
static  void  OS_InitTaskStat(void) OS_REENTRANT;
static  void  OS_InitTCBList(void) OS_REENTRANT;

/*
*********************************************************************************************************
*                                             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) OS_REENTRANT
{
#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
}
/*
*********************************************************************************************************
*                                              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) OS_REENTRANT
{
    if (OSRunning == TRUE) {
        if (OSIntNesting < 255) {
            OSIntNesting++;                      /* Increment ISR nesting level                        */
        }
    }
}
/*
*********************************************************************************************************
*                                               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) OS_REENTRANT
{
#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();
    }
}
/*
*********************************************************************************************************
*                                          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) OS_REENTRANT
{
#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    

/*
*********************************************************************************************************
*                                          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) OS_REENTRANT
{
#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    

/*
*********************************************************************************************************
*                                          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一区二区三区免费野_久草精品视频
久久精品夜夜夜夜久久| 免费久久精品视频| 免费观看在线综合色| 成人性生交大片免费看中文| 欧美欧美欧美欧美首页| 国产精品日产欧美久久久久| 日本欧美一区二区在线观看| 成人a级免费电影| 日韩三级电影网址| 亚洲国产一二三| 成人丝袜视频网| 精品国产91洋老外米糕| 亚洲444eee在线观看| 91首页免费视频| 久久综合精品国产一区二区三区| 亚洲五码中文字幕| jlzzjlzz亚洲女人18| 久久久久久久综合狠狠综合| 日韩电影在线一区二区| 一本久久精品一区二区| 中文子幕无线码一区tr| 国产裸体歌舞团一区二区| 欧美一级二级在线观看| 爽好多水快深点欧美视频| 97国产一区二区| 国产精品久久久久久久久图文区| 国内外成人在线| 精品免费视频.| 日本在线不卡视频| 欧美一区二区三区视频免费| 国产在线视视频有精品| 欧美变态tickling挠脚心| 日韩精品一级中文字幕精品视频免费观看 | 国产精品久久午夜夜伦鲁鲁| 丁香另类激情小说| 亚洲国产高清aⅴ视频| 国产精品456| 国产亚洲欧美日韩日本| 国产 欧美在线| 日本一二三不卡| 99国产精品久久久久| 亚洲男人的天堂网| 色婷婷av一区二区三区软件| 亚洲精品少妇30p| 日本韩国欧美三级| 亚洲bt欧美bt精品777| 日韩午夜中文字幕| 国产一区二区伦理| 国产精品免费免费| 91老师片黄在线观看| 亚洲电影你懂得| 91精品国产品国语在线不卡| 精品一区二区日韩| 国产午夜精品理论片a级大结局| 国产v日产∨综合v精品视频| 国产精品久久久久四虎| 91高清视频免费看| 奇米777欧美一区二区| 久久精品一区蜜桃臀影院| 99热在这里有精品免费| 亚洲成人自拍一区| 亚洲精品一区二区三区99| 成人高清免费观看| 亚洲综合激情网| 精品国产乱码久久久久久图片 | 中文乱码免费一区二区| 91福利视频网站| 久久精品国产在热久久| 亚洲国产成人午夜在线一区| 欧美在线视频全部完| 九一九一国产精品| 亚洲女同ⅹxx女同tv| 日韩写真欧美这视频| 99精品视频在线观看| 日韩国产精品大片| 国产精品视频免费看| 欧美夫妻性生活| 成人av第一页| 男人操女人的视频在线观看欧美| 中文字幕av资源一区| 91精品在线一区二区| 成人av电影在线网| 六月丁香婷婷色狠狠久久| 国产精品麻豆久久久| 精品少妇一区二区三区在线视频| 丁香桃色午夜亚洲一区二区三区| 亚洲国产精品麻豆| 国产精品视频第一区| 91 com成人网| 色婷婷激情一区二区三区| 国内精品国产成人| 亚洲国产精品一区二区久久 | 欧美一级生活片| 色综合网色综合| 国产一区999| 日韩福利电影在线观看| 亚洲国产日日夜夜| 椎名由奈av一区二区三区| 日韩精品一区二区三区在线观看| 欧美在线视频你懂得| 色呦呦网站一区| 99久久精品国产毛片| 国产一区日韩二区欧美三区| 日本在线不卡视频| 午夜国产精品一区| 亚洲国产精品人人做人人爽| 亚洲欧美日韩精品久久久久| 中文字幕免费不卡在线| 日本一区二区综合亚洲| 久久综合999| 久久久五月婷婷| 精品国产污网站| 亚洲精品一区二区三区福利| 欧美电视剧在线看免费| 日韩欧美国产一二三区| 日韩欧美中文字幕一区| 欧美一级日韩不卡播放免费| 日韩欧美国产精品一区| 91精品国产乱码| 日韩一区二区免费视频| 91精品国产福利在线观看| 欧美高清激情brazzers| 91精品欧美久久久久久动漫 | 国产欧美日韩在线观看| 久久综合国产精品| 国产欧美一区二区精品仙草咪 | 欧美成人a在线| 欧美sm美女调教| 久久久精品免费免费| 欧美国产精品一区| 日韩一区中文字幕| 一区二区三区在线免费观看 | 一级特黄大欧美久久久| 亚洲gay无套男同| 另类小说图片综合网| 国产真实乱对白精彩久久| 成人开心网精品视频| 99re亚洲国产精品| 欧美日韩激情一区| 欧美xxxx老人做受| 亚洲欧洲精品天堂一级| 亚洲成人先锋电影| 精品制服美女丁香| 91欧美一区二区| 欧美日韩在线播放一区| 欧美精品一区二区三区蜜桃| 日本一二三不卡| 午夜不卡在线视频| 国产精品综合一区二区三区| 99视频有精品| 欧美大度的电影原声| 国产精品卡一卡二| 日韩成人免费看| 成人av资源下载| 91精品国产入口| 椎名由奈av一区二区三区| 午夜在线成人av| 成人黄色国产精品网站大全在线免费观看 | 亚洲老司机在线| 久草热8精品视频在线观看| 色综合天天综合色综合av| 欧美一区二区私人影院日本| 中文天堂在线一区| 蜜臀91精品一区二区三区| 91视频观看视频| 久久人人爽人人爽| 日韩中文字幕不卡| a在线播放不卡| 久久婷婷国产综合国色天香| 一区二区三区四区在线| 国产精品亚洲综合一区在线观看| 欧美亚一区二区| 国产精品久线在线观看| 国产精品影视网| 777奇米成人网| 亚洲精品视频在线观看免费 | 老司机午夜精品99久久| 91视频.com| 久久九九久精品国产免费直播| 婷婷一区二区三区| 95精品视频在线| 中文字幕欧美日本乱码一线二线| 精品一二三四在线| 欧美日韩国产天堂| 一个色在线综合| 99视频在线观看一区三区| 国产亚洲一区字幕| 国产在线精品一区二区三区不卡| 9191成人精品久久| 亚洲午夜国产一区99re久久| 色系网站成人免费| 国产精品久久久久aaaa樱花 | 综合分类小说区另类春色亚洲小说欧美 | 99re在线精品| 日韩毛片精品高清免费| av亚洲精华国产精华| 国产精品福利一区| 99精品国产热久久91蜜凸| 国产精品网站导航| 99久久久久久|