亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩欧美一区二区免费| 日韩欧美一级特黄在线播放| 天堂精品中文字幕在线| 综合色天天鬼久久鬼色| 精品国产欧美一区二区| 欧美日韩黄色一区二区| 91久久香蕉国产日韩欧美9色| 国产一区视频网站| 国内精品伊人久久久久av影院| 日本欧美在线观看| 亚洲一区二区精品久久av| 日本一区二区三区电影| 欧美国产一区二区| 欧美一区二区三区免费| 亚洲成人资源在线| 亚洲成a人v欧美综合天堂| 亚洲国产综合色| 亚洲免费看黄网站| 欧美日韩一区久久| 国产一区二区三区黄视频 | 亚洲一区二区欧美日韩 | 欧美放荡的少妇| 精品国产伦一区二区三区观看方式| 午夜影视日本亚洲欧洲精品| 中文字幕一区二区三区四区| 欧美大片在线观看一区二区| 日韩欧美123| 精品久久久久久久人人人人传媒| 欧美精品高清视频| 欧美人与禽zozo性伦| 91精品一区二区三区久久久久久| 日本国产一区二区| 欧美日韩精品系列| 欧美日韩高清一区| 精品国产精品网麻豆系列| 久久综合成人精品亚洲另类欧美 | 国产成人精品免费| 国产成人精品综合在线观看| 色综合久久中文综合久久97| 91精品国产91综合久久蜜臀| 国产精品护士白丝一区av| 亚洲777理论| 色综合久久久久久久久久久| 欧美一级在线视频| 亚洲欧美另类在线| 国产成人在线视频免费播放| 欧美日韩国产在线观看| 中文字幕中文字幕中文字幕亚洲无线| 日本伊人午夜精品| 93久久精品日日躁夜夜躁欧美| 欧美精品一区二区三区四区| 亚洲成人免费视频| 色婷婷国产精品| 自拍偷拍国产精品| 成av人片一区二区| 国产精品三级在线观看| 51久久夜色精品国产麻豆| 99在线热播精品免费| 欧美色图天堂网| 视频一区视频二区在线观看| 欧美xxx久久| 一本色道久久综合亚洲精品按摩| 亚洲一二三区在线观看| 久久麻豆一区二区| 国产精品99久久久久久有的能看| 久久婷婷成人综合色| 国内精品久久久久影院薰衣草| 久久久不卡网国产精品一区| 国产在线播放一区三区四| 欧美国产一区二区| 色偷偷久久人人79超碰人人澡| 一二三区精品视频| 91精品福利在线一区二区三区| 婷婷开心激情综合| 久久精子c满五个校花| 不卡一区在线观看| 亚洲一区在线看| 日韩免费观看高清完整版| 国产一区二区三区久久久| 久久精品亚洲精品国产欧美| 波多野结衣中文字幕一区二区三区| 中文子幕无线码一区tr| 欧美日韩亚洲丝袜制服| 国产精品99久久久久| 久久综合久久综合久久| 成人一区二区视频| 亚洲综合精品久久| 国产亚洲欧美激情| 93久久精品日日躁夜夜躁欧美| 视频一区在线视频| 国产欧美1区2区3区| 欧美精品高清视频| 成人黄色av网站在线| 人人精品人人爱| 国产精品理论片在线观看| 欧美日韩高清一区二区三区| 国产999精品久久久久久绿帽| 亚洲欧美视频一区| 久久婷婷国产综合精品青草| 色综合久久久久久久久| 国产电影一区二区三区| 喷白浆一区二区| 日韩高清在线不卡| 亚洲一二三专区| 一区二区成人在线观看| 国产精品久久久久9999吃药| 国产欧美一区二区三区在线看蜜臀| 欧美日韩精品久久久| 欧美在线你懂的| 日本久久精品电影| 欧美亚洲一区三区| 欧美日韩免费一区二区三区视频| 91国偷自产一区二区开放时间| 欧美中文一区二区三区| 欧美日韩精品欧美日韩精品一综合| 3751色影院一区二区三区| 精品国一区二区三区| 中文字幕的久久| 亚洲综合免费观看高清完整版| 天堂久久久久va久久久久| 韩国女主播成人在线| 香蕉久久一区二区不卡无毒影院 | 久久综合狠狠综合久久综合88| 日韩欧美国产1| 国产午夜亚洲精品理论片色戒| www精品美女久久久tv| 久久一二三国产| 国产精品毛片久久久久久久| 最新中文字幕一区二区三区 | 九九在线精品视频| 国产精品12区| 国产suv精品一区二区三区| 国产精品一区二区在线播放| 成人av电影免费观看| 福利一区二区在线| 欧美优质美女网站| 欧美不卡激情三级在线观看| 久久精品男人的天堂| 亚洲免费在线播放| 日韩电影一区二区三区四区| 国产中文字幕精品| 在线观看欧美黄色| 欧美成人一区二区三区| 1024成人网| 国产毛片一区二区| 欧美日精品一区视频| 久久久精品天堂| 日韩中文字幕不卡| 在线观看国产91| 国产精品天天看| 国产美女视频91| 这里只有精品电影| 亚洲欧美日韩中文播放| 懂色av中文字幕一区二区三区| 91精品在线一区二区| 一区二区欧美在线观看| 成人av电影在线观看| 欧美精品一区二区三区蜜臀| 丝袜亚洲另类欧美| 欧美区在线观看| 亚洲国产乱码最新视频 | 欧美在线免费视屏| 国产精品美女久久久久久久久久久 | 91免费观看视频| 亚洲国产精华液网站w| 国产精品18久久久久久久网站| 精品sm捆绑视频| 韩国精品在线观看| 精品国产一区二区亚洲人成毛片| 男女男精品视频网| 久久综合色8888| 成人小视频免费在线观看| 久久免费偷拍视频| 成人综合在线网站| 亚洲欧洲中文日韩久久av乱码| 成人aa视频在线观看| 亚洲欧美韩国综合色| 欧美人牲a欧美精品| 日本午夜精品一区二区三区电影| 51精品秘密在线观看| 久久国产综合精品| 国产无一区二区| 色综合中文综合网| 成人黄色小视频| 一区二区三区在线观看欧美| 在线中文字幕不卡| 青娱乐精品视频| 国产精品萝li| 精品免费日韩av| 99久久99久久免费精品蜜臀| 亚洲乱码一区二区三区在线观看| 在线观看国产一区二区| 国内成+人亚洲+欧美+综合在线| 欧美经典一区二区三区| 欧美日韩国产在线观看| 成人福利视频网站| 久久99国产精品麻豆| 亚洲成a人片在线不卡一二三区| 精品国产伦理网| 精品美女一区二区|