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

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

?? os_core._c

?? ucos如何移植到單片機mega128
?? _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 "..\ucos2_application\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);


/*
*********************************************************************************************************
*                                             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
}

/*
*********************************************************************************************************
*                                              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                        */
        }
    }
}

/*
*********************************************************************************************************
*                                               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();
    }
}

/*
*********************************************************************************************************
*                                          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    


/*
*********************************************************************************************************
*                                          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    


/*
*********************************************************************************************************
*                                          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片免费| 亚洲精品五月天| 欧美国产精品一区二区三区| 日韩免费成人网| 欧美日韩免费观看一区二区三区 | 久久精品人人做人人爽97| 欧美二区乱c少妇| 在线观看国产一区二区| 韩国成人在线视频| 蜜桃视频在线观看一区二区| 视频一区免费在线观看| 亚洲国产精品久久人人爱| 亚洲六月丁香色婷婷综合久久 | 亚洲伦理在线免费看| 亚洲精品在线观看网站| 日韩免费成人网| 日韩欧美的一区二区| 91精品国产色综合久久不卡电影| 在线观看日韩高清av| 在线视频亚洲一区| 在线免费视频一区二区| 欧美日韩一区 二区 三区 久久精品| 91麻豆精品91久久久久同性| 日韩欧美国产三级电影视频| 精品第一国产综合精品aⅴ| 国产亚洲婷婷免费| 亚洲男人的天堂一区二区| 五月综合激情网| 韩国三级电影一区二区| kk眼镜猥琐国模调教系列一区二区| 91国偷自产一区二区三区观看 | 国产精品亚洲成人| 99精品一区二区| 91.com在线观看| 日本一区免费视频| 亚洲国产精品精华液网站| 另类综合日韩欧美亚洲| 成人福利视频在线| 5月丁香婷婷综合| 国产人久久人人人人爽| 一区二区成人在线观看| 久久精品国产一区二区| 成人av影视在线观看| 欧美午夜一区二区三区| 久久婷婷色综合| 亚洲精品免费电影| 精品在线播放午夜| 91丨porny丨在线| 日韩欧美黄色影院| 亚洲人成小说网站色在线| 日韩综合小视频| 91丝袜美腿高跟国产极品老师| 6080yy午夜一二三区久久| 国产精品日产欧美久久久久| 日日骚欧美日韩| 9久草视频在线视频精品| 欧美一级精品在线| 亚洲欧美日韩久久精品| 国产一区二区中文字幕| 欧美日韩视频在线第一区| 欧美国产精品专区| 麻豆精品久久精品色综合| 色婷婷av一区二区三区之一色屋| 26uuu欧美| 天天色综合成人网| 色哟哟一区二区| 久久99精品国产麻豆婷婷| 色婷婷亚洲婷婷| 国产精品欧美经典| 另类小说图片综合网| 欧美色精品天天在线观看视频| 国产精品三级视频| 国产一区二区三区视频在线播放| 色综合色综合色综合色综合色综合| 欧美精品一区视频| 日韩中文字幕区一区有砖一区 | 国产精品一品二品| 欧美一个色资源| 亚洲高清视频的网址| 91免费小视频| 国产精品久线观看视频| 国产精品18久久久久久久久久久久| 91麻豆精品国产91久久久久久| 亚洲少妇30p| 成人免费观看视频| 久久久久国产精品麻豆ai换脸| 美女在线视频一区| 日韩欧美一区二区三区在线| 日本欧美在线观看| 欧美丰满少妇xxxbbb| 亚洲成a人片在线观看中文| 91在线免费播放| 亚洲欧洲制服丝袜| 99视频有精品| 中文字幕在线不卡| 波多野结衣中文一区| 国产精品久久二区二区| 丁香五精品蜜臀久久久久99网站| 久久综合九色综合97婷婷女人| 玖玖九九国产精品| 精品欧美黑人一区二区三区| 麻豆91免费看| 精品国产乱码久久久久久图片| 蜜桃av一区二区| 日韩电影在线一区| 777午夜精品视频在线播放| 亚洲成va人在线观看| 欧美精品日韩一区| 日韩av不卡在线观看| 欧美一区二区三区电影| 久久电影网站中文字幕| 精品黑人一区二区三区久久| 国产综合成人久久大片91| 欧美zozozo| 国产999精品久久| 中文字幕av一区 二区| www.99精品| 亚洲一区免费视频| 欧美日韩不卡一区| 美国毛片一区二区三区| 亚洲精品在线观| 成人av在线一区二区| 亚洲精品国产一区二区精华液 | 亚洲午夜精品一区二区三区他趣| 欧美日本一区二区| 毛片av一区二区三区| 国产亚洲精久久久久久| 成人免费毛片a| 亚洲一区影音先锋| 日韩一区二区免费在线观看| 国产毛片精品视频| 亚洲欧洲精品一区二区三区| 欧美亚洲综合色| 久久精品99国产国产精| 国产欧美精品一区aⅴ影院| 91麻豆福利精品推荐| 日韩电影免费在线观看网站| 久久久久9999亚洲精品| 91麻豆国产在线观看| 奇米四色…亚洲| 中文字幕+乱码+中文字幕一区| 色乱码一区二区三区88| 免费高清视频精品| 国产精品美女久久久久aⅴ| 欧美性猛片xxxx免费看久爱| 裸体一区二区三区| 国产精品久线观看视频| 日韩一区二区三区在线观看| av在线播放一区二区三区| 丝袜美腿一区二区三区| 中文久久乱码一区二区| 欧美精品久久一区二区三区| 国产成人精品亚洲777人妖| 午夜视频一区在线观看| 久久久91精品国产一区二区精品| 一本一道综合狠狠老| 国产一区二区h| 亚洲国产成人va在线观看天堂| 久久综合久久综合亚洲| 欧美日韩在线播放三区四区| 国产另类ts人妖一区二区| 亚洲地区一二三色| 国产精品动漫网站| 日韩午夜三级在线| 色噜噜狠狠色综合中国| 国产成人精品三级| 蜜乳av一区二区| 亚洲第一综合色| 亚洲欧美在线aaa| 久久青草国产手机看片福利盒子 | 91久久奴性调教| 国产成人丝袜美腿| 美腿丝袜在线亚洲一区| 亚洲一级在线观看| 亚洲天堂精品视频| 国产色综合久久| 欧美白人最猛性xxxxx69交| 欧美乱熟臀69xxxxxx| 色综合欧美在线| 国产69精品久久777的优势| 美日韩一区二区| 丝袜国产日韩另类美女| 亚洲综合久久久| 亚洲欧美日韩在线播放| 国产女人aaa级久久久级| 精品sm捆绑视频| 欧美tickling网站挠脚心| 欧美猛男gaygay网站| 在线一区二区三区做爰视频网站| 成人网在线播放| 懂色av中文一区二区三区 | 欧美亚洲愉拍一区二区| 色综合久久久久综合99| 91亚洲精品久久久蜜桃| 99国产精品久久久久久久久久久 | 3d动漫精品啪啪一区二区竹菊| 欧美亚洲高清一区二区三区不卡|