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

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

?? os_core.c

?? LPC2104/5/6嵌入式系統程序實例,帶有PROTUES7.1仿真文件,適合做入門指導
?? 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一区二区三区免费野_久草精品视频
日韩三级中文字幕| 极品美女销魂一区二区三区| 欧美一区二区二区| 国产91丝袜在线18| 日韩电影网1区2区| 中文字幕亚洲在| 欧美一卡2卡3卡4卡| 一本一道久久a久久精品| 久久激情综合网| 亚洲超丰满肉感bbw| 中文字幕一区在线| 久久影院午夜论| 91麻豆精品国产91久久久使用方法 | 911精品国产一区二区在线| 国产乱人伦偷精品视频免下载 | 欧美亚一区二区| 中文字幕在线不卡一区| 久久国产麻豆精品| 欧美精品久久一区二区三区| 一区二区三区日韩欧美| 99久久99精品久久久久久| 国产日韩欧美高清在线| 麻豆高清免费国产一区| 日韩欧美一级二级三级久久久| 亚洲图片欧美视频| 欧美在线视频日韩| 亚洲最大的成人av| 在线观看精品一区| 亚洲午夜羞羞片| 欧美午夜电影一区| 亚洲高清视频中文字幕| 欧美日韩国产首页在线观看| 一区二区三区欧美亚洲| 91福利资源站| 五月婷婷欧美视频| 91精品国产91热久久久做人人| 视频一区二区三区在线| 欧美一级淫片007| 久久精品国产77777蜜臀| 欧美不卡一区二区三区四区| 久久精品国产亚洲高清剧情介绍| 亚洲bdsm女犯bdsm网站| 欧美日韩国产天堂| 美国精品在线观看| 国产亚洲欧美在线| 91在线免费视频观看| 亚洲激情校园春色| 欧美日韩成人在线一区| 精彩视频一区二区| 欧美激情在线免费观看| 91蝌蚪porny九色| 日韩国产精品久久| 欧美精品一区二| 91日韩精品一区| 丝瓜av网站精品一区二区| 欧美成人欧美edvon| aaa国产一区| 亚洲一二三区不卡| 精品国产乱码久久久久久浪潮| 成人午夜碰碰视频| 亚洲va天堂va国产va久| 久久人人爽人人爽| 色偷偷88欧美精品久久久| 蜜芽一区二区三区| 自拍偷拍国产精品| 日韩欧美精品在线| 91免费视频网| 精品系列免费在线观看| 亚洲激情综合网| 国产校园另类小说区| 欧美亚洲丝袜传媒另类| 国产精品一二三在| 午夜电影一区二区三区| 国产精品国产三级国产有无不卡| 欧美日韩色综合| 不卡在线观看av| 免费在线观看一区二区三区| 国产精品毛片大码女人| 日韩欧美高清dvd碟片| 99久久综合精品| 激情深爱一区二区| 亚洲成人在线网站| 亚洲人午夜精品天堂一二香蕉| 91麻豆精品国产| 色狠狠色狠狠综合| 丁香亚洲综合激情啪啪综合| 色偷偷久久人人79超碰人人澡| 美女一区二区视频| 亚洲一区二区高清| 亚洲天堂网中文字| 欧美国产视频在线| 精品美女一区二区| 欧美高清dvd| 色狠狠色噜噜噜综合网| 成人一区二区三区在线观看| 久久国产麻豆精品| 奇米亚洲午夜久久精品| 亚洲一二三区在线观看| 中文字幕在线不卡一区| 国产午夜精品理论片a级大结局| 日韩欧美高清一区| 91精品国产综合久久久久久久久久 | wwwwww.欧美系列| 在线成人免费观看| 欧美日韩在线三级| 91久久精品一区二区二区| 成人av午夜电影| 国产成人福利片| 国产精品中文有码| 国产精品白丝jk白祙喷水网站| 激情图区综合网| 国产一区二区三区四区五区美女| 男女视频一区二区| 91欧美激情一区二区三区成人| 成人一级片网址| 成人aa视频在线观看| 成人av在线播放网站| 成人黄动漫网站免费app| 国产成人免费在线观看不卡| 懂色av中文一区二区三区| 国产丶欧美丶日本不卡视频| 国产一区二区美女| 国v精品久久久网| 成人激情免费网站| 一本到一区二区三区| 欧美综合天天夜夜久久| 欧美日韩亚洲不卡| 91麻豆精品国产| 久久久国产精品不卡| 日本一区二区免费在线| 亚洲欧洲精品成人久久奇米网| 亚洲美女免费在线| 亚洲成a人片在线不卡一二三区 | 日韩欧美一区中文| 日韩免费视频一区| 国产亚洲成av人在线观看导航| 中文字幕亚洲不卡| 亚洲一区二区三区四区中文字幕| 无吗不卡中文字幕| 激情成人午夜视频| 91在线porny国产在线看| 欧美亚洲高清一区| 久久综合五月天婷婷伊人| 中文在线免费一区三区高中清不卡| 亚洲女人****多毛耸耸8| 午夜精品福利一区二区三区蜜桃| 精品一区二区精品| 91蜜桃免费观看视频| 欧美一区二区三区视频在线| 国产偷国产偷精品高清尤物| 一区二区三区资源| 久久精品国产77777蜜臀| 99精品视频在线观看| 欧美三级午夜理伦三级中视频| 精品国产乱码久久久久久1区2区 | 色噜噜狠狠色综合欧洲selulu| 欧美一区二区福利在线| 国产欧美在线观看一区| 亚洲国产精品一区二区久久 | 欧美日韩中文另类| 91影院在线观看| 欧美系列一区二区| 亚洲午夜电影在线| 春色校园综合激情亚洲| 欧美男人的天堂一二区| 亚洲大片免费看| 国产在线精品视频| 在线不卡中文字幕| 亚洲自拍偷拍图区| 成人午夜av电影| 久久久影视传媒| 久久97超碰国产精品超碰| 色先锋资源久久综合| 久久精品在线免费观看| 久久综合久色欧美综合狠狠| 亚洲一区二区三区在线播放| 成人免费观看视频| 久久久久久9999| 美女视频免费一区| 欧美午夜不卡视频| 亚洲欧美日韩一区二区 | 91国偷自产一区二区三区成为亚洲经典| 日韩一区二区三区免费看| 一区二区三区中文字幕电影| 懂色一区二区三区免费观看| 久久色.com| 蜜臀a∨国产成人精品| 欧美日韩高清一区二区三区| 亚洲精选一二三| 99国产欧美久久久精品| 亚洲国产精品传媒在线观看| 国产美女主播视频一区| 精品久久久久久久久久久久久久久 | 欧美日韩一卡二卡| 自拍偷拍亚洲综合| 99精品偷自拍| 一区二区三区在线视频观看| 91免费精品国自产拍在线不卡| 国产精品国产三级国产有无不卡 | 日韩视频在线永久播放|