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

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

?? os_core.c

?? uCOS開發(fā)與源碼
?? 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一区二区三区免费野_久草精品视频
亚洲日本丝袜连裤袜办公室| 男人的天堂亚洲一区| 欧美三级一区二区| 国产精品乡下勾搭老头1| 一级女性全黄久久生活片免费| 日韩精品一区二区三区swag | 99视频一区二区| 奇米四色…亚洲| 亚洲精品乱码久久久久久| 久久久久国产精品人| 日韩一二三区不卡| 欧美优质美女网站| 99久久精品国产导航| 国内一区二区在线| 麻豆精品一区二区三区| 亚洲自拍偷拍麻豆| 日韩美女啊v在线免费观看| 国产欧美日韩久久| wwwwww.欧美系列| 91精品国产欧美一区二区18 | 麻豆国产91在线播放| 亚洲伊人色欲综合网| 亚洲色图欧美激情| 中文字幕欧美激情| 国产视频视频一区| 久久久久久97三级| 久久婷婷国产综合国色天香| 精品久久免费看| 3d成人动漫网站| 在线成人免费观看| 欧美精品乱人伦久久久久久| 欧美日韩一区成人| 欧美猛男男办公室激情| 欧美猛男超大videosgay| 91麻豆产精品久久久久久| 成人a区在线观看| av在线不卡网| 91老司机福利 在线| 色呦呦一区二区三区| 色诱视频网站一区| 欧美视频一区在线| 在线播放/欧美激情| 亚洲欧美日韩一区二区三区在线观看| 国产精品伦理在线| 国产精品久久久一本精品 | 美女脱光内衣内裤视频久久网站| 三级影片在线观看欧美日韩一区二区| 午夜精品视频一区| 日韩影院免费视频| 精品一区二区综合| 国产成人免费视频网站| 91在线看国产| 欧美日韩三级一区| 日韩女优av电影在线观看| 亚洲精品一区二区三区福利| 久久精品视频网| 国产精品伦理一区二区| 亚洲精品v日韩精品| 视频在线在亚洲| 国产一区二区在线看| 9i在线看片成人免费| 一本一道综合狠狠老| 欧美日韩二区三区| 精品国产成人系列| 亚洲天堂中文字幕| 视频一区二区三区在线| 国产精品中文有码| 在线精品视频一区二区| 日韩一区二区在线免费观看| 久久亚洲私人国产精品va媚药| 国产精品私人影院| 亚州成人在线电影| 国产精品资源站在线| 欧美伊人久久大香线蕉综合69| 欧美一区二区日韩| 国产精品卡一卡二| 日产欧产美韩系列久久99| 国产大陆精品国产| 欧美欧美欧美欧美首页| 日本一二三四高清不卡| 亚洲成人av一区二区三区| 国产精品综合视频| 欧美剧在线免费观看网站| 精品av久久707| 成人高清视频在线| 欧美午夜电影网| 欧美激情综合五月色丁香| 亚洲高清久久久| 国产69精品久久久久777| 欧美日韩成人在线| 国产精品日韩成人| 裸体健美xxxx欧美裸体表演| 91天堂素人约啪| 久久婷婷久久一区二区三区| 亚洲成在线观看| 成人av影视在线观看| 日韩欧美成人激情| 亚洲第一狼人社区| av亚洲产国偷v产偷v自拍| 日韩欧美激情四射| 一区二区不卡在线播放 | 欧美日韩电影在线播放| 国产精品久久久久久亚洲毛片| 蜜桃视频免费观看一区| 欧美三级乱人伦电影| 亚洲色欲色欲www| 国产成人丝袜美腿| 精品久久久久久无| 日本午夜精品一区二区三区电影| 91年精品国产| 中文字幕电影一区| 国产在线播精品第三| 日韩一级二级三级精品视频| 亚洲无人区一区| 一本色道久久综合精品竹菊| 中国av一区二区三区| 国产乱码字幕精品高清av| 欧美一个色资源| 日韩高清国产一区在线| 欧美少妇xxx| 亚洲国产美国国产综合一区二区| 91亚洲资源网| 日韩毛片高清在线播放| 成人av网在线| 中文字幕一区三区| 99在线精品视频| 亚洲人成网站色在线观看| 91丝袜高跟美女视频| 极品美女销魂一区二区三区| 欧美一区二区三区性视频| 午夜精品久久久久久久99樱桃| 欧美四级电影在线观看| 亚洲国产中文字幕在线视频综合 | 2023国产精品自拍| 精品一区二区三区视频在线观看 | 久久精品免费看| 日韩欧美色综合网站| 蜜臂av日日欢夜夜爽一区| 日韩一区二区影院| 久久99精品一区二区三区三区| 精品日本一线二线三线不卡| 韩国v欧美v日本v亚洲v| 久久久久国产精品人| 成人高清视频在线观看| 亚洲另类中文字| 欧美综合欧美视频| 日本色综合中文字幕| 日韩精品一区二区三区四区| 国产精品1区2区3区| 国产精品欧美精品| 欧美自拍偷拍午夜视频| 视频精品一区二区| 精品国产人成亚洲区| 成人激情开心网| 一个色妞综合视频在线观看| 欧美乱熟臀69xxxxxx| 久久福利资源站| 国产精品久久久久久户外露出 | 亚洲日本在线视频观看| 欧美亚洲一区二区在线观看| 日本va欧美va精品| 国产视频亚洲色图| 欧美在线|欧美| 韩国女主播成人在线观看| 亚洲欧洲美洲综合色网| 欧美日韩三级视频| 国产一区二区毛片| 亚洲欧美日韩国产手机在线| 51久久夜色精品国产麻豆| 国产不卡一区视频| 一区二区在线看| 亚洲精品在线免费播放| 99国产精品一区| 毛片av一区二区| 中文字幕一区二区三区乱码在线| 精品视频123区在线观看| 国产一区二区在线电影| 一区二区高清视频在线观看| 欧美大度的电影原声| 成人性视频网站| 日本特黄久久久高潮| 国产精品国产三级国产普通话三级 | 青青草成人在线观看| 中文字幕中文字幕在线一区| 欧美日韩黄色影视| 国产不卡视频在线观看| 偷拍亚洲欧洲综合| 亚洲欧洲99久久| 欧美mv日韩mv| 欧美三级中文字幕在线观看| 成人小视频免费在线观看| 视频一区视频二区在线观看| 国产精品夫妻自拍| 欧美大片在线观看一区二区| 一本大道av伊人久久综合| 国产不卡免费视频| 免费高清在线一区| 亚洲综合男人的天堂| 国产视频一区在线观看 | 亚洲三级免费观看|