亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲国产精品激情在线观看| 日韩av午夜在线观看| 亚洲成人av福利| 国产激情一区二区三区| 欧美日韩一区精品| 中文字幕一区二区三中文字幕| 日韩av在线免费观看不卡| 成a人片国产精品| 精品久久久久久综合日本欧美| 亚洲午夜免费视频| 波多野结衣中文字幕一区| 久久婷婷一区二区三区| 日韩国产高清影视| 91福利小视频| 亚洲欧美日韩一区| 成人av网址在线观看| 久久久久国产精品麻豆| 麻豆国产精品官网| 欧美一级专区免费大片| 日日夜夜一区二区| 在线视频一区二区三| 日韩理论片在线| 95精品视频在线| 国产精品丝袜久久久久久app| 国产在线不卡一区| 精品久久久久香蕉网| 精东粉嫩av免费一区二区三区| 91精品国产入口在线| 午夜精品福利视频网站| 欧美人xxxx| 美国一区二区三区在线播放| 欧美一二三区在线观看| 青青草97国产精品免费观看无弹窗版| 欧美图片一区二区三区| 亚洲电影一级黄| 欧美一区二区视频在线观看2020| 性欧美大战久久久久久久久| 在线电影国产精品| 免费成人美女在线观看.| 91麻豆精品国产91久久久资源速度| 视频一区欧美精品| 欧美成人欧美edvon| 国产一区二区不卡在线| 日本一区二区三区在线观看| caoporn国产精品| 一区二区三区丝袜| 欧美高清视频不卡网| 麻豆精品国产91久久久久久| 国产视频一区在线播放| 91免费版在线| 天天色天天操综合| 久久综合一区二区| av中文一区二区三区| 亚洲国产精品久久人人爱| 欧美一区二区网站| 国产成人啪免费观看软件| 亚洲免费观看高清| 在线电影国产精品| 丁香另类激情小说| 亚洲成人www| 久久久精品影视| 欧美亚洲综合一区| 国产一区二区三区免费观看| 国产精品成人免费在线| 91精品视频网| av一二三不卡影片| 男女男精品视频| 中文字幕在线观看一区二区| 欧美日韩黄色影视| 成人一区二区三区中文字幕| 亚洲国产精品一区二区www| 久久久久久久久一| 在线观看亚洲a| 高清日韩电视剧大全免费| 五月天丁香久久| 日本一区二区三区国色天香 | 丝袜亚洲另类欧美| 精品国产乱码久久久久久夜甘婷婷 | 国产精品污网站| 欧美精品久久99久久在免费线| 福利一区二区在线| 天天爽夜夜爽夜夜爽精品视频| 国产精品―色哟哟| 欧美α欧美αv大片| 欧美网站一区二区| 99re在线精品| 国产成a人无v码亚洲福利| 免费的国产精品| 亚洲综合激情另类小说区| 国产精品福利影院| 久久久亚洲精华液精华液精华液| 欧美日本一道本在线视频| 成人免费观看视频| 国产精品一区一区| 蜜桃视频一区二区三区| 偷拍一区二区三区四区| 亚洲免费av网站| 国产精品久久久久久久午夜片| 精品日本一线二线三线不卡| 678五月天丁香亚洲综合网| 欧美怡红院视频| 日本久久一区二区三区| 成人午夜电影久久影院| 国产成人自拍网| 国产精品亚洲午夜一区二区三区 | 久久九九全国免费| 欧美变态口味重另类| 69堂成人精品免费视频| 91精品国产综合久久精品性色| 在线观看欧美黄色| 欧美影视一区在线| 欧美日韩色综合| 5566中文字幕一区二区电影| 欧美女孩性生活视频| 欧美精选在线播放| 欧美一区二区三区免费视频| 91精品国产91久久综合桃花| 91精品在线免费| 欧美一级黄色大片| 日韩无一区二区| 欧美成人一区二区三区片免费| 精品国产电影一区二区| 久久久午夜精品| 国产精品久久午夜| 亚洲精品日产精品乱码不卡| 亚洲国产精品久久一线不卡| 日韩主播视频在线| 美腿丝袜一区二区三区| 国产一区在线观看麻豆| 丁香啪啪综合成人亚洲小说 | 不卡大黄网站免费看| 99精品欧美一区二区蜜桃免费| av一二三不卡影片| 欧美日韩国产影片| 日韩欧美在线123| 国产精品色眯眯| 亚洲国产毛片aaaaa无费看| 麻豆91小视频| 91一区二区三区在线播放| 欧美午夜精品久久久久久超碰| 欧美成人综合网站| 1000精品久久久久久久久| 亚洲va韩国va欧美va精品 | 久久久www成人免费无遮挡大片 | 久久噜噜亚洲综合| 亚洲美腿欧美偷拍| 蜜臀av一区二区在线免费观看| 国产不卡免费视频| 在线观看日韩电影| 久久久影视传媒| 亚洲成人一区二区| 国产精品99久久久久久久女警 | 成人免费黄色在线| 91精品久久久久久久91蜜桃| 国产日本欧洲亚洲| 日日摸夜夜添夜夜添亚洲女人| 国产成人综合网| 制服丝袜亚洲网站| 成人欧美一区二区三区在线播放| 免费成人结看片| 在线视频国产一区| 中文字幕免费不卡| 日本中文字幕一区二区视频| 97se亚洲国产综合自在线观| 精品少妇一区二区三区日产乱码 | 国产一区不卡视频| 欧美日韩国产大片| 1000精品久久久久久久久| 国内精品写真在线观看| 欧美人伦禁忌dvd放荡欲情| 国产精品久99| 国产一区二区三区黄视频| 欧美日韩亚洲综合一区二区三区| 欧美国产日韩亚洲一区| 九九久久精品视频| 欧美精品vⅰdeose4hd| 一区二区三区色| 成人一区二区视频| 久久精品在线观看| 久草这里只有精品视频| 欧美精品123区| 亚洲成a人片在线观看中文| 99久久亚洲一区二区三区青草| 久久综合九色综合欧美98| 青娱乐精品视频| 欧美日韩视频在线一区二区| 一区二区三区在线视频免费观看| 成人免费视频播放| 国产精品少妇自拍| 成人av网站大全| 欧美韩国日本综合| 东方欧美亚洲色图在线| 久久久国产精品不卡| 国产成人欧美日韩在线电影| 国产日韩亚洲欧美综合| 国产麻豆视频一区| 久久丝袜美腿综合| 国产精品2024| 中文欧美字幕免费| 波多野结衣精品在线|