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

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

?? os_core.c

?? avr ucos 代碼 測試環境:source insight WINAVR 4個進程
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*
*********************************************************************************************************
*                                                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//防止一些文件加入到includes.h當中
#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
*********************************************************************************************************
*/
/*
*********************************************************************************************************
                                                映射位位置映射到位掩碼的映射表  
備注:表的索引是想得到的位的位置(0到7)
                 索引得到的值是位的掩碼
*********************************************************************************************************
*/


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)
*********************************************************************************************************
*/
/*
**********************************************************************************************
                                       優先級分辨表
備注:索引表是最高優先級的位模式
                 索引值對應于最高優先級的位位置(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                             */
};//256個東東,干嘛呢?

/*
*********************************************************************************************************
*                                       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
*********************************************************************************************************
*/
/*
*********************************************************************************************************
                                                             初始化
 功能:要先在調用  OSStart()后,再初始化uxosII內核,要先建立ucos任何一個任務                                                        
*********************************************************************************************************
*/



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      */
//初始化TCB空閑鏈表
    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.
                                             進入中斷服務程序
描述:通知ucosII將進入中斷服務程序,它允許ucos跟蹤中斷嵌套,所以只有
                 //在最后一層中斷嵌套才重新安排。
參數:無
返回:無
注意:1、只有在關中斷的時候才調用
                 2、因為中斷嵌套定義為全局變量,所以在沒有調用此函數的時候
                         也可以增加中斷嵌套數
                 3、即使你增加了中斷嵌套數,你也要調用OSIntExit()
                 4、你必須成對調用OSIntEnter() and OSIntExit(),即:每次在ISR開始時調用OSIntEnter() 
                        你將在ISR結束時調用OSIntExit()
                 5、你可以嵌套255層深
                 6、因為每次調用時中斷是關的,所以我去掉了OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL()
*********************************************************************************************************
*/

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())
                                       退出中斷
描述:通知ucos你已經完成中斷服務程序,當最后一層嵌套完成后,ucos將
                 重新調度看是否一個新的,高優先級任務將就緒。
參數:無
返回:無
備注:1、你必須成對調用OSIntEnter() and OSIntExit(),即:每次在ISR開始時調用OSIntEnter() 
                        你將在ISR結束時調用OSIntExit()
                 2、當調度上鎖的話,重新調度是不允許的。見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       */
			//防止減到比0還小
            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().
                                                    調度上鎖函數

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人一区二区视频| 91亚洲国产成人精品一区二区三 | 欧美日韩成人综合在线一区二区| 国产精品91xxx| 久久不见久久见免费视频7| 亚洲在线视频网站| 亚洲理论在线观看| 亚洲激情中文1区| 亚洲激情综合网| 一区二区三区高清| 亚洲欧洲韩国日本视频| 国产日韩三级在线| 欧美激情一区二区三区全黄| 国产欧美中文在线| 国产欧美日韩精品在线| 中文字幕一区二区三区精华液 | 18欧美乱大交hd1984| 国产精品水嫩水嫩| √…a在线天堂一区| 亚洲精品国产精品乱码不99 | 亚洲一级电影视频| 亚洲一二三区不卡| 青青草97国产精品免费观看 | 亚洲电影中文字幕在线观看| 日韩极品在线观看| 丁香婷婷深情五月亚洲| 欧美中文字幕一二三区视频| 91精品国产欧美一区二区成人 | 亚洲成av人在线观看| 麻豆91在线播放| av中文字幕不卡| 日韩限制级电影在线观看| 国产清纯美女被跳蛋高潮一区二区久久w | 午夜久久电影网| 国模冰冰炮一区二区| 欧洲中文字幕精品| 日韩欧美久久一区| 中文字幕一区二区三区不卡在线| 亚洲v中文字幕| 不卡视频一二三四| 91精品国产综合久久精品app | 精品日产卡一卡二卡麻豆| 亚洲人成精品久久久久| 国产一区二区在线视频| 欧美日韩国产高清一区| 中文字幕巨乱亚洲| 久久er99精品| 欧美二区在线观看| 国产精品毛片高清在线完整版| 奇米色777欧美一区二区| 在线观看视频一区二区| 国产精品网曝门| 国产精品亚洲第一| 精品粉嫩超白一线天av| 日韩av不卡一区二区| 色噜噜狠狠色综合中国| 国产拍揄自揄精品视频麻豆| 亚洲人成在线播放网站岛国| 在线观看国产91| 欧美mv和日韩mv的网站| 1024成人网| 在线视频一区二区三| 亚洲精品欧美激情| 伊人性伊人情综合网| 日韩中文字幕1| 在线免费观看日韩欧美| 亚洲国产精品久久久男人的天堂| 91久久线看在观草草青青| 国产精品国产三级国产普通话三级| 制服丝袜在线91| 青青草97国产精品免费观看 | 欧美综合欧美视频| 一区二区三区国产精华| 欧美一区二区视频免费观看| 无码av免费一区二区三区试看| 欧美中文字幕一区二区三区亚洲| 成人一级黄色片| 欧美韩日一区二区三区| 国产精品香蕉一区二区三区| 久久久久久久久蜜桃| 国产乱子轮精品视频| 久久久午夜精品理论片中文字幕| 国产成人亚洲精品青草天美| 一区二区三区成人| 制服.丝袜.亚洲.中文.综合| 国产精品一二一区| 亚洲午夜激情网页| 欧美极品少妇xxxxⅹ高跟鞋 | 久久久影院官网| 欧美三电影在线| 国产麻豆午夜三级精品| 亚欧色一区w666天堂| 国产亚洲精品aa| 欧美日本一区二区| 成人av在线资源网站| 免费日本视频一区| 亚洲精品综合在线| 精品成人免费观看| 欧美色国产精品| 91尤物视频在线观看| 国产.欧美.日韩| 国产激情精品久久久第一区二区| 美日韩一区二区| 亚洲成人资源在线| 亚洲狠狠丁香婷婷综合久久久| 久久夜色精品一区| 欧美精品一区二区三区四区| 7777精品伊人久久久大香线蕉经典版下载 | 国产成人在线免费| 国产乱码精品1区2区3区| 久久99久久99| 日本美女一区二区三区| 亚洲第一福利一区| 亚洲bt欧美bt精品777| 亚洲成国产人片在线观看| 亚洲成人精品一区| 日韩电影在线免费看| 日韩中文字幕一区二区三区| 青青草国产精品亚洲专区无| 日韩激情av在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 午夜一区二区三区视频| 日韩精品高清不卡| 国产精品一区二区三区四区 | xvideos.蜜桃一区二区| 国产亚洲欧美日韩俺去了| 国产精品免费久久| 亚洲美女精品一区| 日本三级韩国三级欧美三级| 久久99热这里只有精品| 国产成人精品免费在线| 在线观看国产精品网站| 337p日本欧洲亚洲大胆色噜噜| 久久久久久久久99精品| 亚洲婷婷综合久久一本伊一区 | 99国产精品99久久久久久| 欧美三区在线观看| 国产女人aaa级久久久级| 亚洲一区自拍偷拍| 韩国女主播一区二区三区| 色综合天天综合网天天看片| 日韩欧美在线综合网| 国产日韩精品久久久| 日韩**一区毛片| 99精品欧美一区二区三区综合在线| 欧美精品久久一区| 久久精品视频在线免费观看| 亚洲国产精品一区二区www在线| 国产成人午夜高潮毛片| 精品污污网站免费看| 国产精品免费观看视频| 极品销魂美女一区二区三区| 91一区一区三区| 久久亚区不卡日本| 热久久免费视频| 欧美中文字幕亚洲一区二区va在线| 欧美精品一区二区三区四区| 首页亚洲欧美制服丝腿| 色婷婷综合五月| 国产精品网站导航| 国产伦精品一区二区三区视频青涩 | 欧美精品色一区二区三区| 亚洲最大色网站| 在线观看av不卡| 亚洲自拍偷拍欧美| 欧美视频第二页| 麻豆精品久久久| 欧美哺乳videos| 国产精华液一区二区三区| 久久精品无码一区二区三区| 国产成a人亚洲精品| 中文字幕一区二区三区不卡| av一区二区三区在线| 夜夜嗨av一区二区三区| 欧美男同性恋视频网站| 亚洲国产另类av| 精品少妇一区二区三区在线播放| 久久精品国产成人一区二区三区| 日韩欧美另类在线| 麻豆一区二区三| 国产日韩亚洲欧美综合| 成人免费观看男女羞羞视频| 最新日韩在线视频| 3atv在线一区二区三区| 激情综合网av| 亚洲精品自拍动漫在线| 5566中文字幕一区二区电影| 国产成人在线电影| 亚洲精品一二三四区| 91精品久久久久久久99蜜桃| 成人精品高清在线| 美洲天堂一区二卡三卡四卡视频| 亚洲欧洲精品一区二区三区不卡| 欧美日韩一区小说| 国产成人av资源| 蜜臀av国产精品久久久久| 亚洲精品日产精品乱码不卡| 精品粉嫩aⅴ一区二区三区四区| 欧美日韩三级一区二区| 岛国av在线一区|