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

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

?? os_core.c

?? PIC18F452下的uCOS2移植成功代碼+MPLAB IDE V8.0的項目文件。結構非常精簡
?? 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
*********************************************************************************************************
*/

/* Microchip PIC18xxx specific - lookup in program memory because of limited RAM space */
rom INT8U  const  OSMapTbl[]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
/* End Microchip PIC18xxx specific */

/*
*********************************************************************************************************
*                                       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)
*********************************************************************************************************
*/

/* Microchip PIC18xxx specific - lookup in program memory because of limited RAM space */
rom INT8U  const  OSUnMapTbl[] = {
/* End Microchip PIC18xxx specific */
    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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区免费在线观看视频| 日韩av电影免费观看高清完整版 | 亚洲不卡在线观看| 久久成人免费网| 欧美性猛交xxxx乱大交退制版| 久久综合给合久久狠狠狠97色69| 一区二区三区四区亚洲| 国产夫妻精品视频| 欧美一级日韩免费不卡| 亚洲精品免费在线| 成人晚上爱看视频| 国产亚洲一区二区三区四区| 香蕉成人啪国产精品视频综合网| 成人一道本在线| 欧美成人a视频| 午夜精品一区二区三区三上悠亚 | 欧美丰满嫩嫩电影| 一区在线观看视频| 成人午夜免费电影| 久久久久久亚洲综合影院红桃| 午夜精品久久久久久久| 一本色道久久综合亚洲91| 中文字幕一区二区三区视频| 国产成人综合亚洲91猫咪| 欧美一级日韩免费不卡| 日本不卡免费在线视频| 欧美日韩中字一区| 亚洲国产另类av| 日本二三区不卡| 亚洲乱码国产乱码精品精的特点 | 欧美日韩综合色| 一区二区三区中文在线| 91豆麻精品91久久久久久| 亚洲欧美综合网| av一区二区三区在线| 中文字幕视频一区| 91亚洲国产成人精品一区二区三| 中文字幕日本乱码精品影院| www.66久久| 亚洲精品菠萝久久久久久久| 色婷婷av一区二区三区之一色屋| 中文字幕亚洲不卡| 欧美在线你懂得| 日韩高清不卡在线| 欧美成人vr18sexvr| 国产一区二区毛片| 国产亚洲综合在线| 日本电影欧美片| 视频一区二区不卡| 精品国产一区二区三区忘忧草 | 精品成a人在线观看| 国产精品一线二线三线| 亚洲欧洲成人自拍| 欧美日韩电影在线播放| 日韩不卡一二三区| 国产日韩欧美高清| 91在线视频官网| 天堂在线亚洲视频| 久久综合久久综合九色| 99免费精品在线| 日韩黄色片在线观看| 精品国产百合女同互慰| 国产91精品免费| 亚洲午夜久久久久久久久电影网 | 欧美偷拍一区二区| 美女在线观看视频一区二区| 精品av久久707| 成人一区二区视频| 午夜视频在线观看一区| 久久婷婷久久一区二区三区| 91亚洲精品一区二区乱码| 日韩精品视频网| 日本一区二区三区电影| 欧美日韩国产一区| 国产aⅴ综合色| 午夜精品福利一区二区蜜股av| 欧美一级二级三级蜜桃| 国产 日韩 欧美大片| 亚洲专区一二三| 国产香蕉久久精品综合网| 欧美日韩国产a| 国产福利精品一区二区| 精品sm在线观看| 一区二区三区波多野结衣在线观看| av在线不卡电影| 日韩欧美在线综合网| 国产成人精品免费网站| 91精品国产91热久久久做人人| 国产日产欧产精品推荐色 | 国产成人午夜视频| 亚洲一区免费观看| 亚洲国产精品v| 26uuu亚洲| 欧美日韩亚洲综合在线 | 国内欧美视频一区二区| 亚洲午夜免费福利视频| 中文字幕欧美一| 日本一二三不卡| 26uuu国产日韩综合| 欧美蜜桃一区二区三区| 色婷婷综合在线| 不卡视频在线观看| 国产成人精品一区二| 久久99热这里只有精品| 日日夜夜精品视频免费| 亚洲成av人片一区二区| 一区二区三区免费网站| 亚洲欧美日韩一区二区三区在线观看| 精品欧美乱码久久久久久| 91精品婷婷国产综合久久竹菊| 在线观看日韩av先锋影音电影院| 成人午夜私人影院| 国产成人免费视频网站高清观看视频| 婷婷丁香激情综合| 婷婷激情综合网| 免费成人小视频| 久久9热精品视频| 国产精品中文字幕日韩精品| 九九精品视频在线看| 蜜臀av性久久久久蜜臀aⅴ| 日本怡春院一区二区| 麻豆精品精品国产自在97香蕉| 日韩高清一区在线| 激情综合色播五月| 豆国产96在线|亚洲| 国产制服丝袜一区| 三级欧美在线一区| 亚洲影院在线观看| 亚洲精品国产无天堂网2021 | 国产成人精品aa毛片| 精品一区二区三区免费观看| 裸体健美xxxx欧美裸体表演| 美女高潮久久久| 国产成人一区二区精品非洲| 国产69精品久久久久777| 国产一区二区在线视频| 成人精品国产一区二区4080| 91在线一区二区| 欧美军同video69gay| 日韩丝袜美女视频| 国产亚洲成aⅴ人片在线观看 | 日韩中文字幕不卡| 麻豆91精品视频| 成人黄色国产精品网站大全在线免费观看 | 欧美绝品在线观看成人午夜影视| 欧美刺激午夜性久久久久久久| 久久一区二区视频| 一区二区在线看| 日本不卡在线视频| 成人h精品动漫一区二区三区| 欧美在线一区二区三区| 精品国产自在久精品国产| 国产精品国产三级国产三级人妇 | 欧美一级理论片| 国产亚洲一区二区三区四区| 亚洲免费在线电影| 国产一区二区免费视频| 在线观看不卡一区| 国产亚洲一区二区三区在线观看| 一区二区三区不卡视频在线观看| 麻豆91在线播放免费| 色综合咪咪久久| 久久久精品一品道一区| 性做久久久久久久免费看| 国产精品99久久久久久宅男| 欧美丝袜丝交足nylons| 中文av字幕一区| 日本在线不卡一区| 色天天综合色天天久久| 久久这里只有精品6| 丝袜美腿一区二区三区| 成人激情午夜影院| 久久综合久久综合亚洲| 午夜国产精品影院在线观看| 一本一道综合狠狠老| 中文字幕高清一区| 国产在线精品一区二区不卡了| 欧美精品三级在线观看| 亚洲精品亚洲人成人网在线播放| 国产aⅴ精品一区二区三区色成熟| 欧美日韩大陆在线| 一区二区三区 在线观看视频| 成人av手机在线观看| 国产日韩影视精品| 九色|91porny| 日韩亚洲国产中文字幕欧美| 亚洲图片欧美一区| 91久久香蕉国产日韩欧美9色| 中文欧美字幕免费| 成人美女视频在线观看18| 久久久久久久综合| 久久99精品久久久久久久久久久久| 欧美高清视频在线高清观看mv色露露十八 | 国产一区在线看| 日韩免费高清av| 日韩在线卡一卡二| 欧美精品在线一区二区| 亚洲一区视频在线| 欧美视频中文一区二区三区在线观看 | 日韩精品1区2区3区|