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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_core.c

?? 移植好的UCOS2.86版
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                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[8]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};    //按位操作的...列表               00000000按位記錄下的信息

/*
*********************************************************************************************************
*                                       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[256] = {
    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                             */
};

/*$PAGE*/

/*
*********************************************************************************************************
*                                       FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static  void  OS_InitEventList(void);
static  void  OS_InitMisc(void);
static  void  OS_InitRdyList(void);
static  void  OS_InitTaskIdle(void);
#if OS_TASK_STAT_EN > 0
static  void  OS_InitTaskStat(void);
#endif
static  void  OS_InitTCBList(void);

/*$PAGE*/

/*
*********************************************************************************************************
*                         GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
*
* Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
*
* Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a semaphore,
*                        a mutex, a mailbox or a queue.  Where this function is concerned, the actual
*                        type is irrelevant.
*
*              pname     is a pointer to an ASCII string that will receive the name of the semaphore,
*                        mutex, mailbox or queue.  The string must be able to hold at least 
*                        OS_EVENT_NAME_SIZE characters.
*
*              err       is a pointer to an error code that can contain one of the following values:
*
*                        OS_NO_ERR                  if the name was copied to 'pname'
*                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the proper event 
*                                                   control block type.
*                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
*                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pevent'
*
* Returns    : The length of the string or 0 if the 'pevent' is a NULL pointer.
*********************************************************************************************************
*/

#if OS_EVENT_NAME_SIZE > 0
INT8U  OSEventNameGet (OS_EVENT *pevent, char *pname, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    INT8U      len;


    OS_ENTER_CRITICAL();
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
        OS_EXIT_CRITICAL();                      /* Yes                                                */
        *err = OS_ERR_PEVENT_NULL;
        return (0);
    }
    if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
        OS_EXIT_CRITICAL();                      /* Yes                                                */
        *err = OS_ERR_PNAME_NULL;
        return (0);
    }
#endif
    switch (pevent->OSEventType) {
        case OS_EVENT_TYPE_SEM:
        case OS_EVENT_TYPE_MUTEX:
        case OS_EVENT_TYPE_MBOX:
        case OS_EVENT_TYPE_Q:
             break;

        default:
             OS_EXIT_CRITICAL();
             *err = OS_ERR_EVENT_TYPE;
             return (0);
    }
    (void)strcpy(pname, pevent->OSEventName);    /* Yes, copy name from OS_EVENT                       */
    len  = strlen(pname);
    OS_EXIT_CRITICAL();
    *err = OS_NO_ERR;
    return (len);
}
#endif

/*$PAGE*/

/*
*********************************************************************************************************
*                         ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
*
* Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
*
* Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a semaphore,
*                        a mutex, a mailbox or a queue.  Where this function is concerned, it doesn't
*                        matter the actual type.
*
*              pname     is a pointer to an ASCII string that will be used as the name of the semaphore,
*                        mutex, mailbox or queue.  The string must be able to hold at least 
*                        OS_EVENT_NAME_SIZE characters.
*
*              err       is a pointer to an error code that can contain one of the following values:
*
*                        OS_NO_ERR                  if the requested task is resumed
*                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the proper event 
*                                                   control block type.
*                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
*                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pevent'
*
* Returns    : None
*********************************************************************************************************
*/

#if OS_EVENT_NAME_SIZE > 0
void  OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif
    INT8U      len;


    OS_ENTER_CRITICAL();
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
        OS_EXIT_CRITICAL();                      /* Yes                                                */
        *err = OS_ERR_PEVENT_NULL;
        return;
    }
    if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
        OS_EXIT_CRITICAL();                      /* Yes                                                */
        *err = OS_ERR_PNAME_NULL;
        return;
    }
#endif
    switch (pevent->OSEventType) {
        case OS_EVENT_TYPE_SEM:
        case OS_EVENT_TYPE_MUTEX:
        case OS_EVENT_TYPE_MBOX:
        case OS_EVENT_TYPE_Q:
             break;

        default:
             OS_EXIT_CRITICAL();
             *err = OS_ERR_EVENT_TYPE;
             return;
    }
    len = strlen(pname);                         /* Can we fit the string in the storage area?         */
    if (len > (OS_EVENT_NAME_SIZE - 1)) {        /* No                                                 */
        OS_EXIT_CRITICAL();
        *err = OS_ERR_EVENT_NAME_TOO_LONG;
        return;
    } 
    (void)strcpy(pevent->OSEventName, pname);    /* Yes, copy name to the event control block          */
    OS_EXIT_CRITICAL();
    *err = OS_NO_ERR;
}
#endif

/*$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 < 255u) {
            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) {                           /* Reschedule only if all ISRs complete ... */
            if (OSLockNesting == 0) {                      /* ... and not locked.                      */
                OSIntExitY    = OSUnMapTbl[OSRdyGrp];          
                OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
                if (OSPrioHighRdy != OSPrioCur) {          /* No Ctx Sw if current task is highest rdy */
                    OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy];
#if OS_TASK_PROFILE_EN > 0
                    OSTCBHighRdy->OSTCBCtxSwCtr++;         /* Inc. # of context switches to this task  */
#endif
                    OSCtxSwCtr++;                          /* Keep track of the number of ctx switches */
                    OSIntCtxSw();                          /* Perform interrupt level ctx switch       */
                }
            }
        }
        OS_EXIT_CRITICAL();
    }
}
/*$PAGE*/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女一区二区| 欧美三级视频在线播放| 亚洲精品ww久久久久久p站| 日韩精品一区二区在线观看| 97久久超碰国产精品| 久久精工是国产品牌吗| 亚洲国产三级在线| 中文字幕欧美一| 久久久久国产免费免费| 69堂亚洲精品首页| 一本大道av一区二区在线播放| 久久精品国产亚洲高清剧情介绍| 亚洲精品欧美二区三区中文字幕| 久久久久久久精| 精品国产一区二区三区忘忧草 | 精品国产1区二区| 在线视频一区二区免费| 成+人+亚洲+综合天堂| 国模套图日韩精品一区二区 | 精品成人私密视频| 欧美丰满美乳xxx高潮www| 色婷婷av一区二区三区之一色屋| 国产夫妻精品视频| 国产乱色国产精品免费视频| 日韩av高清在线观看| 亚洲图片欧美视频| 一区二区三区高清| 一区二区三区影院| 亚洲精品午夜久久久| 成人免费一区二区三区视频| 欧美国产禁国产网站cc| 国产亚洲精品aa| 国产亚洲美州欧州综合国| 久久久国产精品不卡| 久久这里只有精品视频网| 欧美成va人片在线观看| 日韩精品一区二区三区视频播放| 欧美一区二区福利视频| 日韩欧美国产综合在线一区二区三区| 欧美午夜精品一区二区三区| 亚洲视频综合在线| 亚洲色图欧美激情| 亚洲精品高清在线观看| 一区二区三区国产精华| 亚洲国产精品久久久久秋霞影院| 亚洲国产视频一区| 日韩高清不卡一区二区三区| 免费在线观看视频一区| 精品一区二区在线视频| 国产九九视频一区二区三区| 懂色av一区二区夜夜嗨| 91色乱码一区二区三区| 日本韩国一区二区| 欧美欧美午夜aⅴ在线观看| 在线播放欧美女士性生活| 丁香婷婷综合色啪| 91麻豆精品一区二区三区| 一道本成人在线| 欧美日韩成人激情| 精品国产自在久精品国产| 国产日韩av一区| 亚洲女人的天堂| 午夜电影一区二区| 国内久久精品视频| 不卡av免费在线观看| 在线观看免费视频综合| 日韩一区二区三区高清免费看看| 久久综合九色欧美综合狠狠| 日本一区二区三区dvd视频在线| 亚洲色图欧洲色图婷婷| 欧美视频一区在线| 欧美一区二区三区在线| 国产日韩欧美制服另类| 亚洲影视资源网| 精品无人码麻豆乱码1区2区 | 日韩专区一卡二卡| 国产麻豆9l精品三级站| 91蝌蚪porny九色| 欧美一区二区精品久久911| 欧美高清在线视频| 五月激情六月综合| 成人美女视频在线看| 欧美精品777| 国产精品久久久久久亚洲毛片| 调教+趴+乳夹+国产+精品| 从欧美一区二区三区| 欧美日韩美女一区二区| 欧美国产激情二区三区| 日韩国产高清在线| 91婷婷韩国欧美一区二区| 欧美mv日韩mv国产网站| 亚洲激情六月丁香| 国产精品一区二区91| 欧美日韩黄视频| 国产精品全国免费观看高清 | 亚洲欧美在线视频观看| 日本成人在线不卡视频| 97精品超碰一区二区三区| 日韩欧美一级在线播放| 一区二区三区在线视频观看58| 国产剧情av麻豆香蕉精品| 欧美日韩国产综合一区二区| 国产精品国产三级国产三级人妇| 天天免费综合色| 一本久久a久久精品亚洲| 久久精品网站免费观看| 男女男精品网站| 欧美三区在线观看| 亚洲人123区| 国产成人在线色| 精品成人免费观看| 日韩在线观看一区二区| 色吧成人激情小说| 亚洲欧美一区二区在线观看| 国产91精品精华液一区二区三区| 日韩视频免费观看高清在线视频| 亚洲午夜一二三区视频| 色综合久久中文综合久久牛| 欧美韩日一区二区三区| 国产电影一区二区三区| xfplay精品久久| 蓝色福利精品导航| 日韩欧美一区中文| 日本美女一区二区三区视频| 欧美男生操女生| 午夜久久电影网| 欧美揉bbbbb揉bbbbb| 亚洲一区电影777| 欧美色图一区二区三区| 夜色激情一区二区| 欧美无砖专区一中文字| 亚洲国产一区二区三区青草影视| 日本高清不卡一区| 亚洲一区二区三区影院| 欧洲亚洲国产日韩| 99久久精品费精品国产一区二区| 中文一区一区三区高中清不卡| 福利一区在线观看| 国产精品另类一区| 一本色道久久综合精品竹菊| 亚洲精品视频在线观看网站| 色素色在线综合| 亚洲大尺度视频在线观看| 欧美日韩免费电影| 麻豆国产欧美一区二区三区| 欧美成人精品高清在线播放| 国产综合成人久久大片91| 久久久久久久综合| 成人不卡免费av| 亚洲精品久久嫩草网站秘色| 精品污污网站免费看| 日本不卡视频在线观看| 精品国产乱码久久| 成人国产精品视频| 亚洲一区免费在线观看| 欧美精品一级二级| 国内成+人亚洲+欧美+综合在线| 国产欧美精品一区aⅴ影院| 99vv1com这只有精品| 午夜在线成人av| 精品奇米国产一区二区三区| 国产大陆a不卡| 亚洲精品日韩综合观看成人91| 欧美区一区二区三区| 激情久久五月天| 成人欧美一区二区三区小说| 欧美日韩一级黄| 国产麻豆91精品| 一区二区三区不卡在线观看| 日韩欧美你懂的| 不卡一区二区中文字幕| 五月激情综合婷婷| 国产欧美日韩中文久久| 欧美三级在线看| 国产精品一区二区黑丝 | 欧美一区二区视频网站| 精品在线一区二区| 亚洲日穴在线视频| 日韩三级伦理片妻子的秘密按摩| 成人短视频下载| 免费av成人在线| 亚洲老妇xxxxxx| 久久一二三国产| 欧美日韩国产一级二级| 国产一区视频网站| 亚洲aaa精品| 国产精品久久久久aaaa樱花| 日韩一级大片在线观看| 91亚洲精品久久久蜜桃网站| 美女诱惑一区二区| 亚洲乱码国产乱码精品精小说| 2021久久国产精品不只是精品| 色屁屁一区二区| 国产一区二区导航在线播放| 亚洲国产综合人成综合网站| 国产精品午夜在线观看| 欧美成人免费网站| 欧美日韩精品欧美日韩精品一 | 91精品国产91综合久久蜜臀| 99久久er热在这里只有精品66|