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

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

?? os_core.c

?? 基于ARM7處理器的中斷與串口在ucos下切換的演示程序
?? 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一区二区三区免费野_久草精品视频
国产欧美日韩另类视频免费观看| 日韩一区二区三免费高清| 精品一区二区影视| 日韩精品一二区| 日日夜夜免费精品| 亚洲成a人片综合在线| 亚洲精品久久久蜜桃| 免费精品视频最新在线| 伊人色综合久久天天人手人婷| 亚洲欧美区自拍先锋| 亚洲人成网站色在线观看| 亚洲色图19p| 亚洲精品久久7777| 亚洲国产wwwccc36天堂| 天天综合色天天综合| 热久久久久久久| 久久精品国产**网站演员| 国产一区欧美日韩| 成人深夜视频在线观看| 91免费视频观看| 欧美亚洲动漫另类| 5566中文字幕一区二区电影| 日韩视频免费观看高清完整版| 欧美精品一区二区三区蜜桃视频 | 欧美一区二区在线播放| 日韩欧美一级二级三级久久久| 91麻豆精品国产91久久久资源速度| 精品美女在线播放| 亚洲妇熟xx妇色黄| 婷婷开心激情综合| 日韩精品乱码免费| 久久精品国产99国产| 国产精品 欧美精品| av电影在线观看完整版一区二区| 一本久久a久久精品亚洲| 在线成人小视频| 久久日一线二线三线suv| 国产精品狼人久久影院观看方式| 亚洲欧美日韩国产一区二区三区| 亚洲福利电影网| 免费在线观看精品| 成人午夜在线播放| 欧洲日韩一区二区三区| 欧美tk丨vk视频| 成人欧美一区二区三区白人| 三级在线观看一区二区| 国产ts人妖一区二区| 在线一区二区观看| 精品美女被调教视频大全网站| 国产精品久久午夜| 青青草原综合久久大伊人精品| 丰满白嫩尤物一区二区| 欧美人体做爰大胆视频| 免费黄网站欧美| 日韩视频不卡中文| 日本一区二区不卡视频| 亚洲国产精品综合小说图片区| 91美女福利视频| 国产无一区二区| 久久久久久久久岛国免费| 国产精品久久久久一区二区三区 | 91免费版在线看| 91视频www| 精品伦理精品一区| 一级精品视频在线观看宜春院 | 日韩女优毛片在线| 亚洲欧美另类小说视频| 国产一区二区三区蝌蚪| 欧美日韩夫妻久久| 综合激情成人伊人| 国产毛片精品一区| 欧美一区二区性放荡片| 亚洲韩国精品一区| 成人av午夜影院| 久久婷婷一区二区三区| 国产欧美va欧美不卡在线| 亚洲超碰精品一区二区| 99久久精品99国产精品| 2020国产成人综合网| 日韩精品一二三| 欧美日韩一区三区四区| 亚洲人成网站影音先锋播放| 国产不卡视频一区| 精品国产区一区| 奇米一区二区三区av| 日本高清不卡在线观看| 国产精品久久久久久久久动漫| 九九热在线视频观看这里只有精品| 精品1区2区3区| 亚洲精品视频一区| aa级大片欧美| 国产精品高潮呻吟| 成人美女视频在线观看| 久久精品夜色噜噜亚洲aⅴ| 美女精品自拍一二三四| 91精品国产乱| 日韩国产一二三区| 欧美精品vⅰdeose4hd| 亚洲国产精品影院| 在线观看av一区| 一区二区成人在线| 91福利在线看| 亚洲一二三级电影| 欧美日韩精品一区二区三区蜜桃| 一区二区在线观看av| 欧洲中文字幕精品| 国产精品九色蝌蚪自拍| 成人激情综合网站| 中文一区一区三区高中清不卡| 国产精品综合视频| 日本一区免费视频| 成人性视频免费网站| 99riav一区二区三区| 狠狠色综合播放一区二区| 久久久影视传媒| 精品久久一二三区| 亚洲免费电影在线| 欧美性猛片aaaaaaa做受| 一二三四社区欧美黄| 欧美私人免费视频| 日韩av中文字幕一区二区三区| 欧美一区二区人人喊爽| 精品在线一区二区三区| 久久精品亚洲麻豆av一区二区| 成人午夜视频免费看| 亚洲欧美在线高清| 欧美午夜电影一区| 欧美国产日本视频| 亚洲欧美在线视频观看| 国产在线日韩欧美| 欧美国产亚洲另类动漫| 精品福利在线导航| 日韩av网站免费在线| 欧美本精品男人aⅴ天堂| 国产在线国偷精品产拍免费yy| 中文字幕久久午夜不卡| 91蜜桃网址入口| 日韩精品色哟哟| 国产网站一区二区| 色综合久久久久综合体桃花网| 亚洲第一精品在线| 久久这里只精品最新地址| 99国内精品久久| 日韩在线一区二区| 国产欧美精品国产国产专区| 精品视频资源站| 国产高清久久久| 亚洲制服丝袜av| 久久综合狠狠综合久久激情| 91香蕉国产在线观看软件| 日本中文字幕一区二区视频 | 久久亚洲精品国产精品紫薇| 不卡一卡二卡三乱码免费网站| 天堂一区二区在线| 欧美激情一区二区三区在线| 欧美三级蜜桃2在线观看| 国产在线精品一区二区| 亚洲宅男天堂在线观看无病毒| 欧美成人精品3d动漫h| 97久久超碰国产精品| 蜜臀久久99精品久久久久宅男| 亚洲视频在线一区| 精品日韩在线观看| 在线观看中文字幕不卡| 成人午夜私人影院| 另类的小说在线视频另类成人小视频在线| 国产精品第四页| 精品久久五月天| 欧美美女一区二区| 91在线视频官网| 国产一二三精品| 三级一区在线视频先锋| 日韩理论电影院| 久久精品亚洲乱码伦伦中文| 欧美一二三四区在线| 色悠久久久久综合欧美99| 国产精品一区免费视频| 欧美aaaaaa午夜精品| 夜夜夜精品看看| 国产精品青草综合久久久久99| 日韩一级片在线观看| 欧美中文字幕一区二区三区亚洲| 国产91在线看| 国产麻豆午夜三级精品| 另类小说色综合网站| 亚洲国产日韩av| 亚洲欧美一区二区久久| 欧美激情在线一区二区三区| 欧美精品一区二区三| 欧美一级片在线| 欧美精品 日韩| 欧美综合视频在线观看| 一本大道av一区二区在线播放| 国产又黄又大久久| 麻豆国产一区二区| 日韩电影在线看| 爽爽淫人综合网网站| 亚洲一二三区不卡| 亚洲国产毛片aaaaa无费看| 亚洲精品乱码久久久久久黑人|