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

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

?? os_core.c

?? ucosII操作系統移植源代碼(包括詳細的移植步驟和心得)。
?? 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国产欧美久久久精品| 制服丝袜亚洲网站| 伊人开心综合网| www..com久久爱| 国产亚洲欧美中文| 久久精品国产免费| 欧美日韩不卡在线| 亚洲男人的天堂av| 成人免费av资源| 日韩精品一区二区三区四区| 亚洲一区二区欧美激情| 99久久亚洲一区二区三区青草| 精品欧美一区二区三区精品久久 | 性做久久久久久久久| 91欧美一区二区| 中文字幕亚洲精品在线观看| 欧美中文字幕一区| 国产精品色在线观看| 国产一区二区美女| www亚洲一区| 国精品**一区二区三区在线蜜桃| 6080yy午夜一二三区久久| 亚洲成人黄色小说| 欧美日韩一二三| 午夜精品久久久久久久蜜桃app| 91黄色激情网站| 亚洲黄色免费网站| 欧美最猛性xxxxx直播| 亚洲精品乱码久久久久久| 色狠狠一区二区| 亚洲一线二线三线久久久| 欧洲一区二区av| 午夜亚洲国产au精品一区二区 | 成人av影院在线| 中文在线一区二区| 92国产精品观看| 亚洲精品国产成人久久av盗摄| 91网站视频在线观看| 一级做a爱片久久| 欧美久久久久久久久中文字幕| 五月激情六月综合| 欧美成人在线直播| 国产另类ts人妖一区二区| 亚洲国产精品精华液2区45| jlzzjlzz亚洲女人18| 亚洲日本免费电影| 欧美日韩不卡视频| 久久国产精品一区二区| 中文字幕高清一区| 91福利国产成人精品照片| 亚洲gay无套男同| 精品福利视频一区二区三区| 丁香婷婷综合激情五月色| 亚洲激情自拍视频| 日韩午夜av电影| 成人午夜免费av| 午夜视频一区在线观看| 久久亚洲综合色| 在线免费观看日韩欧美| 免费av成人在线| 国产精品久久一卡二卡| 欧美精品第1页| 风间由美一区二区三区在线观看 | 成人午夜视频福利| 午夜精品成人在线视频| 久久久久99精品国产片| 色婷婷激情久久| 黄一区二区三区| 亚洲欧美一区二区三区国产精品 | 在线亚洲免费视频| 国产尤物一区二区在线| 亚洲黄色小说网站| 久久久精品综合| 精品视频123区在线观看| 粉嫩久久99精品久久久久久夜| 亚洲一区在线观看网站| 国产亚洲一区字幕| 337p亚洲精品色噜噜噜| 97久久超碰国产精品| 国内精品不卡在线| 日韩电影免费一区| 亚洲欧美日韩国产综合在线| 26uuu精品一区二区在线观看| 日本精品视频一区二区| 成人黄色在线视频| 精品在线观看免费| 天天综合色天天综合| 亚洲三级免费电影| 国产精品美女久久久久aⅴ| 日韩欧美一区二区不卡| 欧美天堂一区二区三区| 成人h动漫精品一区二| 国产在线日韩欧美| 久久国产日韩欧美精品| 五月婷婷激情综合网| 又紧又大又爽精品一区二区| 国产精品久久久久婷婷二区次| 日韩美女主播在线视频一区二区三区| 欧美三级日韩三级国产三级| 91网站在线播放| av高清久久久| 不卡av电影在线播放| 成人免费av在线| 福利电影一区二区三区| 国产a精品视频| 国产suv一区二区三区88区| 国产精品123| 国产成人在线电影| 国产伦精品一区二区三区视频青涩 | 欧美成人a视频| 精品精品国产高清a毛片牛牛 | 日韩av不卡在线观看| 亚洲午夜久久久久久久久电影网| 亚洲人成网站影音先锋播放| 成人欧美一区二区三区白人| 中文字幕色av一区二区三区| 国产精品久久久久久久午夜片| 国产欧美日韩不卡免费| 国产精品少妇自拍| 亚洲久草在线视频| 亚洲福利视频一区二区| 日韩高清中文字幕一区| 久久av老司机精品网站导航| 国产在线播放一区三区四| 高清在线观看日韩| 91丨porny丨蝌蚪视频| 欧美在线啊v一区| 欧美一区二区不卡视频| 精品国产一二三| 欧美激情一区在线| 亚洲资源中文字幕| 免费欧美在线视频| 国产一区二区影院| 色婷婷综合激情| 欧美一区二区三区影视| 久久天堂av综合合色蜜桃网| 亚洲欧洲无码一区二区三区| 亚洲一区二区在线播放相泽| 麻豆国产欧美日韩综合精品二区 | 亚洲.国产.中文慕字在线| 日韩黄色一级片| 国产成人在线看| 欧美色涩在线第一页| 精品1区2区在线观看| 国产精品超碰97尤物18| 日韩av中文字幕一区二区| 韩国理伦片一区二区三区在线播放| 成人免费黄色在线| 欧美久久久影院| 中文字幕高清不卡| 天堂在线亚洲视频| 不卡在线视频中文字幕| 欧美视频一区二区在线观看| 久久网这里都是精品| 亚洲国产精品欧美一二99| 国产麻豆9l精品三级站| 欧美三级日韩三级国产三级| 久久久美女艺术照精彩视频福利播放| 亚洲欧美电影一区二区| 国产专区欧美精品| 欧美精品日韩一区| 亚洲欧洲精品一区二区三区不卡| 奇米888四色在线精品| 99精品久久久久久| 久久一夜天堂av一区二区三区| 亚洲风情在线资源站| 成人午夜私人影院| 欧美大片一区二区| 午夜国产精品影院在线观看| 成人国产在线观看| 国产午夜精品一区二区| 秋霞电影网一区二区| 色乱码一区二区三区88| 国产精品伦一区二区三级视频| 九一久久久久久| 欧美日本高清视频在线观看| 亚洲人成人一区二区在线观看 | 国产成人免费视频一区| 日韩一区二区三区免费观看| 依依成人综合视频| www.色综合.com| 欧美国产精品一区| 国产麻豆日韩欧美久久| 日韩欧美色电影| 老司机一区二区| 欧美裸体bbwbbwbbw| 亚洲地区一二三色| 91福利小视频| 一区二区三区中文字幕在线观看| 丁香五精品蜜臀久久久久99网站| 久久久综合激的五月天| 国产一区二三区| 久久综合网色—综合色88| 极品销魂美女一区二区三区| 日韩你懂的在线观看| 久久精品国产一区二区|