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

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

?? os_core.c

?? 一共40M 不能貼在論壇中。絕對好東西。要得話留下email
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             CORE FUNCTIONS
*
*                          (c) Copyright 1992-2001, 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,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
    4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
};
/*$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) reentrant
{
    INT16U     i;
    INT8U     *prdytbl;
    OS_TCB    *ptcb1;
    OS_TCB    *ptcb2;
#if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 1)
    OS_EVENT  *pevent1;
    OS_EVENT  *pevent2;
#endif


#if OS_VERSION >= 204
    OSInitHookBegin();                                           /* Call port specific initialization code   */
#endif

#if OS_TIME_GET_SET_EN > 0   
    OSTime        = 0L;                                          /* Clear the 32-bit system clock            */
#endif
    OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter      */
    OSLockNesting = 0;                                           /* Clear the scheduling lock counter        */
    OSTaskCtr     = 0;                                           /* Clear the number of tasks                */
    OSRunning     = FALSE;                                       /* Indicate that multitasking not started   */
    OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter            */
#if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
    OSIdleCtrRun  = 0L;
    OSIdleCtrMax  = 0L;
    OSStatRdy     = FALSE;                                       /* Statistic task is not ready              */
#endif
    OSCtxSwCtr    = 0;                                           /* Clear the context switch counter         */
    OSRdyGrp      = 0x00;                                        /* Clear the ready list                     */
    prdytbl       = &OSRdyTbl[0];
    for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
        *prdytbl++ = 0x00;
    }

    OSPrioCur     = 0;
    OSPrioHighRdy = 0;
    OSTCBHighRdy  = (OS_TCB *)0;                                 /* TCB Initialization                       */
    OSTCBCur      = (OS_TCB *)0;
    OSTCBList     = (OS_TCB *)0;
    for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) {                 /* Clear the priority table                 */
        OSTCBPrioTbl[i] = (OS_TCB *)0;
    }
    ptcb1 = &OSTCBTbl[0];
    ptcb2 = &OSTCBTbl[1];
    for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) {  /* Init. list of free TCBs                  */
        ptcb1->OSTCBNext = ptcb2;
        ptcb1++;
        ptcb2++;
    }
    ptcb1->OSTCBNext = (OS_TCB *)0;                              /* Last OS_TCB                              */
    OSTCBFreeList    = &OSTCBTbl[0];

#if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
    #if OS_MAX_EVENTS == 1                                       
    OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block        */
    OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
    OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
    #else
    pevent1 = &OSEventTbl[0];
    pevent2 = &OSEventTbl[1];
    for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control blocks  */
        pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
        pevent1->OSEventPtr  = pevent2;
        pevent1++;
        pevent2++;
    }
    pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
    pevent1->OSEventPtr  = (OS_EVENT *)0;
    OSEventFreeList      = &OSEventTbl[0];
    #endif
#endif

#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    OS_FlagInit();                                               /* Initialize the event flag structures     */
#endif

#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
    OS_QInit();                                                  /* Initialize the message queue structures  */
#endif

#if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
    OS_MemInit();                                                /* Initialize the memory manager            */
#endif

    /* ------------------------------------- CREATION OF 'IDLE' TASK --------------------------------------- */
#if OS_TASK_CREATE_EXT_EN > 0
    #if OS_STK_GROWTH == 1
    (void)OSTaskCreateExt(OS_TaskIdle,
                          (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
                          &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack                     */
                          OS_IDLE_PRIO,                              /* Lowest priority level                */
                          OS_TASK_IDLE_ID,
                          &OSTaskIdleStk[0],                         /* Set Bottom-Of-Stack                  */
                          OS_TASK_IDLE_STK_SIZE,
                          (void *)0,                                 /* No TCB extension                     */
                          OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
    #else
    (void)OSTaskCreateExt(OS_TaskIdle,
                          (void *)0,                                 /* No arguments passed to OS_TaskIdle() */
                          &OSTaskIdleStk[0],                         /* Set Top-Of-Stack                     */
                          OS_IDLE_PRIO,                              /* Lowest priority level                */
                          OS_TASK_IDLE_ID,
                          &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack                  */
                          OS_TASK_IDLE_STK_SIZE,
                          (void *)0,                                 /* No TCB extension                     */
                          OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack  */
    #endif
#else
    #if OS_STK_GROWTH == 1
    (void)OSTaskCreate(OS_TaskIdle,
                       (void *)0,
                       &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
                       OS_IDLE_PRIO);
    #else
    (void)OSTaskCreate(OS_TaskIdle,
                       (void *)0,
                       &OSTaskIdleStk[0],
                       OS_IDLE_PRIO);
    #endif
#endif

    /* ------------------------------- CREATION OF 'STATISTIC' TASK ---------------------------------- */
#if OS_TASK_STAT_EN > 0
    #if OS_TASK_CREATE_EXT_EN > 0
        #if OS_STK_GROWTH == 1
        (void)OSTaskCreateExt(OS_TaskStat,
                              (void *)0,                                   /* No args passed to OS_TaskStat()*/
                              &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Top-Of-Stack               */
                              OS_STAT_PRIO,                                /* One higher than the idle task  */
                              OS_TASK_STAT_ID,
                              &OSTaskStatStk[0],                           /* Set Bottom-Of-Stack            */
                              OS_TASK_STAT_STK_SIZE,
                              (void *)0,                                   /* No TCB extension               */
                              OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
        #else
        (void)OSTaskCreateExt(OS_TaskStat,
                              (void *)0,                                   /* No args passed to OS_TaskStat()*/
                              &OSTaskStatStk[0],                           /* Set Top-Of-Stack               */
                              OS_STAT_PRIO,                                /* One higher than the idle task  */
                              OS_TASK_STAT_ID,
                              &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],   /* Set Bottom-Of-Stack            */
                              OS_TASK_STAT_STK_SIZE,
                              (void *)0,                                   /* No TCB extension               */
                              OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);  /* Enable stack checking + clear  */
        #endif
    #else
        #if OS_STK_GROWTH == 1
        (void)OSTaskCreate(OS_TaskStat,
                           (void *)0,                                      /* No args passed to OS_TaskStat()*/
                           &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],      /* Set Top-Of-Stack               */
                           OS_STAT_PRIO);                                  /* One higher than the idle task  */
        #else
        (void)OSTaskCreate(OS_TaskStat,
                           (void *)0,                                      /* No args passed to OS_TaskStat()*/
                           &OSTaskStatStk[0],                              /* Set Top-Of-Stack               */
                           OS_STAT_PRIO);                                  /* One higher than the idle task  */
        #endif
    #endif
#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) Your ISR can directly increment OSIntNesting without calling this function because
*                 OSIntNesting has been declared 'global'.  You MUST, however, be sure that the increment
*                 is performed 'indivisibly' by your processor to ensure proper access to this critical
*                 resource.
*              2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
*              3) 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.
*********************************************************************************************************
*/

void  OSIntEnter (void) reentrant
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    
    
    OS_ENTER_CRITICAL();
    if (OSIntNesting < 255) {
        OSIntNesting++;                          /* Increment ISR nesting level                        */
    }
    OS_EXIT_CRITICAL();
}
/*$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 OSSchedLock())
*********************************************************************************************************
*/

void  OSIntExit (void) reentrant
{
#if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
    OS_CPU_SR  cpu_sr;
#endif
    
    
    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 context switches */
            OSIntCtxSw();                              /* Perform interrupt level context 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜亚洲精品午夜鲁丝片| 精品一区中文字幕| 日韩精品一卡二卡三卡四卡无卡| 国产在线精品一区二区| 色婷婷综合五月| 久久久久久久综合狠狠综合| 亚洲va韩国va欧美va精品| 成人动漫在线一区| 2024国产精品| 日韩电影在线免费看| 99综合电影在线视频| 久久色视频免费观看| 免费在线成人网| 欧美视频一区在线观看| 亚洲男同性恋视频| 成人深夜福利app| 国产三级精品三级在线专区| 麻豆精品视频在线观看免费| 欧美片在线播放| 亚洲精品视频一区| 99精品视频中文字幕| 国产日本一区二区| 成人一级片网址| 久久免费看少妇高潮| 国产一区二区视频在线播放| 精品国产亚洲一区二区三区在线观看| 日日骚欧美日韩| 7777精品伊人久久久大香线蕉超级流畅 | 99天天综合性| 久久精品视频在线免费观看| 国内成人免费视频| 久久精品一区二区三区不卡 | 欧美国产一区在线| 国产福利91精品一区二区三区| 久久综合网色—综合色88| 久久99精品久久只有精品| 精品少妇一区二区三区在线视频| 蜜臀av性久久久久av蜜臀妖精 | 激情图区综合网| 欧美精品一区二区三区很污很色的 | 日韩福利视频网| 精品免费国产二区三区 | 欧美在线三级电影| 亚洲一区av在线| 51精品视频一区二区三区| 蜜桃视频在线一区| 国产欧美精品区一区二区三区| 粉嫩aⅴ一区二区三区四区| 国产精品天干天干在观线| 91老师片黄在线观看| 亚洲午夜精品在线| 日韩欧美一区在线| 岛国精品在线观看| 亚洲综合色区另类av| 91精品在线一区二区| 激情综合色综合久久| 国产精品久久久久婷婷| 欧美影院午夜播放| 狠狠色伊人亚洲综合成人| 国产欧美一区二区精品忘忧草| 一本色道a无线码一区v| 免费人成网站在线观看欧美高清| 国产婷婷色一区二区三区四区 | 国产成人免费视频| 一区二区三区在线免费观看| 欧美一区二区三区视频免费| 处破女av一区二区| 午夜精品在线视频一区| 国产人妖乱国产精品人妖| 欧美日韩精品免费| 成人av网址在线| 久久精品99久久久| 亚洲在线视频网站| 欧美韩国一区二区| 欧美一区二区三区不卡| 成人午夜精品在线| 狂野欧美性猛交blacked| 自拍av一区二区三区| 欧美不卡一区二区三区四区| 成人高清视频在线| 麻豆成人91精品二区三区| 亚洲少妇屁股交4| 久久综合九色综合欧美98| 精品视频免费看| 97se狠狠狠综合亚洲狠狠| 国模套图日韩精品一区二区 | 91精品国产高清一区二区三区蜜臀| 国产激情精品久久久第一区二区 | 久久久99久久| 欧美精品精品一区| 色噜噜久久综合| 顶级嫩模精品视频在线看| 麻豆久久一区二区| 午夜精品成人在线视频| 亚洲图片激情小说| 日本一区二区免费在线观看视频 | 6080亚洲精品一区二区| 91亚洲男人天堂| 国产成人精品免费在线| 经典一区二区三区| 久久99九九99精品| 麻豆国产欧美日韩综合精品二区| 调教+趴+乳夹+国产+精品| 亚洲大片在线观看| 亚洲一区二区三区四区五区中文| 亚洲色图在线看| 亚洲欧美欧美一区二区三区| 中文字幕乱码亚洲精品一区| 国产亚洲一区二区在线观看| 精品国精品国产| 久久久高清一区二区三区| 久久久电影一区二区三区| 国产日韩影视精品| 国产精品污污网站在线观看 | 久久久无码精品亚洲日韩按摩| 日韩一区二区在线观看视频| 欧美一二三区精品| 精品国产1区二区| 久久精品一区二区三区不卡 | 日本高清不卡一区| 一本一本久久a久久精品综合麻豆| 99久久综合99久久综合网站| 92国产精品观看| 欧美在线观看一二区| 欧美日韩高清在线| 日韩一区二区视频在线观看| 精品久久久久久综合日本欧美 | 一区二区三区免费| 偷窥少妇高潮呻吟av久久免费| 蜜桃av一区二区| 国产成人精品一区二区三区四区| 成人av免费在线播放| 欧美性大战久久久| 精品欧美黑人一区二区三区| 国产欧美日韩在线| 亚洲国产日韩一区二区| 久久91精品国产91久久小草| 成人免费毛片嘿嘿连载视频| 欧美自拍偷拍午夜视频| 欧美大尺度电影在线| 国产精品水嫩水嫩| 亚洲h在线观看| 国产呦萝稀缺另类资源| 91蜜桃免费观看视频| 在线不卡中文字幕| 欧美国产日本韩| 亚洲成人久久影院| 国产91丝袜在线播放九色| 色哟哟国产精品免费观看| 欧美大片日本大片免费观看| 1024亚洲合集| 精品一区二区三区久久久| 91老师片黄在线观看| 2021中文字幕一区亚洲| 亚洲欧美偷拍三级| 精品一区二区成人精品| 欧洲一区二区三区在线| 久久久www成人免费毛片麻豆| 亚洲精品日日夜夜| 高清不卡在线观看| 日韩欧美在线观看一区二区三区| 最近中文字幕一区二区三区| 精品一区免费av| 欧美日韩免费不卡视频一区二区三区 | 亚洲欧洲在线观看av| 美国三级日本三级久久99| 色婷婷综合激情| 久久综合久久鬼色| 日韩激情视频网站| 色香蕉成人二区免费| 国产蜜臀av在线一区二区三区| 蜜桃av一区二区| 4438成人网| 一区二区三国产精华液| 床上的激情91.| 国产亚洲精品久| 国产一区二区日韩精品| 欧美一区二区三区视频| 午夜激情一区二区| 欧美在线观看一区二区| 亚洲免费观看在线视频| av电影在线观看不卡| 欧美激情资源网| 国产在线国偷精品免费看| 日韩欧美中文字幕精品| 麻豆国产精品视频| 日韩美女视频一区二区在线观看| 亚洲成av人影院| 欧美男人的天堂一二区| 亚洲成人先锋电影| 欧美日韩日本视频| 一区二区免费在线播放| 91免费视频大全| 亚洲一区在线电影| 欧美乱妇15p| 天天影视色香欲综合网老头| 欧美精品自拍偷拍| 欧美a一区二区| 精品久久国产97色综合| 国产麻豆精品在线观看|