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

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

?? os_core.c

?? ucos-ii, 開發環境 c 語言,此代碼很有學習價值.
?? 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) 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
}
/*$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) reentrant
{
    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) reentrant
{

    
    
    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) reentrant
{

    
    
    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) reentrant
{

    
    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()
*              and you MUST have created at least one task.
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色呦呦国产精品| 日韩三区在线观看| 欧美日韩你懂得| 欧美精品第一页| 久久久不卡网国产精品一区| 国产午夜精品久久| 国产精品三级视频| 国产精品欧美综合在线| 一个色在线综合| 亚洲国产人成综合网站| 日韩国产欧美一区二区三区| 美国三级日本三级久久99 | 亚洲午夜私人影院| 日韩不卡一区二区三区| 成人av在线一区二区三区| 欧美亚洲综合在线| 国产亚洲欧美激情| 亚洲va国产天堂va久久en| 精品一区二区三区香蕉蜜桃| 99久久伊人久久99| 91精品国产麻豆| 亚洲精品乱码久久久久久日本蜜臀| 亚洲午夜电影在线观看| 国产激情91久久精品导航 | 五月综合激情婷婷六月色窝| 国产一区二区0| 欧美在线免费视屏| 国产午夜精品理论片a级大结局| 亚洲一级二级在线| 国产福利一区二区三区视频| 欧美日韩精品二区第二页| 日本一区二区不卡视频| 久久99精品久久久| 精品污污网站免费看| 亚洲日本va午夜在线影院| 一区二区三区91| 成人av免费在线| 欧美精品一区二区不卡| 亚洲一区二区在线视频| 国产69精品久久久久毛片| 欧美日韩三级一区二区| 亚洲视频免费看| eeuss鲁一区二区三区| 欧美成人性福生活免费看| 亚洲高清不卡在线观看| 91色婷婷久久久久合中文| 欧美va亚洲va| 亚洲高清三级视频| 激情综合色丁香一区二区| 欧美日韩国产一级| 亚洲一线二线三线视频| 99re热这里只有精品免费视频 | 日本不卡一区二区三区| 欧美日韩一卡二卡| 亚洲成人激情av| 欧美日韩精品欧美日韩精品| 国产精品色哟哟网站| 成人黄色软件下载| 国产精品美女久久久久久久 | 欧美一卡二卡在线| 亚洲一线二线三线视频| 欧美日韩在线播放三区| 日日摸夜夜添夜夜添精品视频| 欧美日韩综合在线| 亚洲国产精品一区二区久久| 欧美午夜寂寞影院| 蜜臀久久99精品久久久久久9| 91麻豆精品国产91久久久| 裸体在线国模精品偷拍| 亚洲精品一区二区精华| 成人一道本在线| 亚洲色图制服丝袜| 欧美日韩国产精品成人| 久久国产精品一区二区| 国产亚洲精品久| 色天天综合色天天久久| 日韩精品福利网| 91麻豆精品国产91久久久资源速度 | 黄色日韩三级电影| 久久亚洲综合av| 亚洲1区2区3区视频| 日韩欧美高清一区| 国产乱码一区二区三区| 欧美一区二区三区四区高清| 国内久久婷婷综合| 亚洲视频 欧洲视频| 91精品综合久久久久久| 国产欧美一区视频| 欧美四级电影网| 麻豆一区二区99久久久久| 欧美韩国日本综合| 欧美日本精品一区二区三区| 国产成人在线免费观看| 亚洲综合色视频| 久久久精品国产99久久精品芒果| 色婷婷一区二区| 日韩福利视频网| 国产欧美一区二区精品忘忧草| 国产成人一级电影| 亚洲欧美电影一区二区| 欧美一区二区福利在线| 91香蕉国产在线观看软件| 欧美aaaaa成人免费观看视频| 国产三区在线成人av| 欧美日韩精品一区二区三区四区| 国产精品资源在线看| 一个色综合网站| 久久亚洲私人国产精品va媚药| 一本大道久久a久久综合婷婷 | 日本高清视频一区二区| 国内精品久久久久影院一蜜桃| 日韩欧美中文字幕公布| 日韩av网站免费在线| 国产精品初高中害羞小美女文| 日韩情涩欧美日韩视频| 欧美一区二区女人| 91在线观看污| 激情图片小说一区| 日本成人在线不卡视频| 一区二区激情视频| 自拍偷拍亚洲欧美日韩| 国产丝袜欧美中文另类| 精品福利在线导航| 在线成人av影院| 91久久精品一区二区| 成人精品小蝌蚪| 日本不卡的三区四区五区| 亚洲一线二线三线视频| 一区二区高清视频在线观看| 亚洲视频一区二区免费在线观看 | 国产激情视频一区二区三区欧美 | 久久久影视传媒| 日韩午夜激情电影| 日本韩国一区二区三区视频| 美国欧美日韩国产在线播放| 99国产精品国产精品久久| 国产精品理伦片| 日韩欧美中文一区| 欧美嫩在线观看| 日本道色综合久久| 91视频.com| 色8久久人人97超碰香蕉987| 成人美女视频在线观看18| 麻豆成人av在线| 久久99国产精品尤物| 国产一区二区三区| 国产一区二区免费在线| 国产999精品久久久久久绿帽| 国产精品一区在线观看你懂的| 国产一区二区伦理| 国产精品66部| 93久久精品日日躁夜夜躁欧美| 99久免费精品视频在线观看| 99国产欧美久久久精品| 欧美曰成人黄网| 91久久精品一区二区三| 欧美曰成人黄网| 91精品中文字幕一区二区三区| 91精品国产免费| 久久久美女毛片| 最新国产の精品合集bt伙计| 一区二区三区不卡视频| 日韩精品国产欧美| 国产大陆精品国产| 色综合久久久久久久久| 欧美日韩一区二区在线观看视频| 777亚洲妇女| 久久久夜色精品亚洲| 自拍偷拍国产精品| 日本系列欧美系列| 丁香另类激情小说| 欧美日韩一区二区三区不卡| 日韩欧美电影一二三| 久久久精品一品道一区| 国产精品久久夜| 亚洲图片自拍偷拍| 成人免费视频caoporn| 东方欧美亚洲色图在线| 777奇米四色成人影色区| 国产精品不卡在线观看| 国产一区二区三区最好精华液| 欧美日韩精品欧美日韩精品一 | 91欧美激情一区二区三区成人| 欧美一区二区三区在| 一区二区欧美国产| 91视频观看视频| 亚洲欧洲日产国产综合网| 精品一区二区久久久| 日韩视频免费观看高清完整版 | 国产精品全国免费观看高清| 韩国成人在线视频| 日韩免费观看2025年上映的电影| 亚洲成人三级小说| 欧美日韩精品免费观看视频| 一区二区三区免费网站| 色综合中文字幕国产| 国产日韩欧美精品综合| 国产综合色视频| 精品成人一区二区三区四区| 美女www一区二区|