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

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

?? os_core.c

?? uCOS在Cortex-M3芯片上的移植
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             CORE FUNCTIONS
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_CORE.C
* By      : Jean J. Labrosse
* Version : V2.83
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#define  OS_GLOBALS
#include <ucos_ii.h>
#endif

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

static  void  OS_SchedNew(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_EN && (OS_EVENT_NAME_SIZE > 1)
INT8U  OSEventNameGet (OS_EVENT *pevent, INT8U *pname, INT8U *err)
{
    INT8U      len;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return (0);
    }
    if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
        *err = OS_ERR_PEVENT_NULL;
        return (0);
    }
    if (pname == (INT8U *)0) {                   /* Is 'pname' a NULL pointer?                         */
        *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:
             *err = OS_ERR_EVENT_TYPE;
             return (0);
    }
    OS_ENTER_CRITICAL();
    len  = OS_StrCopy(pname, pevent->OSEventName);    /* Copy name from OS_EVENT                       */
    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_EN && (OS_EVENT_NAME_SIZE > 1)
void  OSEventNameSet (OS_EVENT *pevent, INT8U *pname, INT8U *err)
{
    INT8U      len;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (err == (INT8U *)0) {                     /* Validate 'err'                                     */
        return;
    }
    if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
        *err = OS_ERR_PEVENT_NULL;
        return;
    }
    if (pname == (INT8U *)0) {                    /* Is 'pname' a NULL pointer?                         */
        *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:
             *err = OS_ERR_EVENT_TYPE;
             return;
    }
    OS_ENTER_CRITICAL();
    len = OS_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)OS_StrCopy(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_TMR_EN > 0
    OSTmr_Init();                                                /* Initialize the Timer Manager             */
#endif

#if OS_VERSION >= 204
    OSInitHookEnd();                                             /* Call port specific init. code            */
#endif

#if OS_VERSION >= 270 && OS_DEBUG_EN > 0
    OSDebugInit();
#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 == OS_TRUE) {
        if (OSIntNesting < 255u) {
            OSIntNesting++;                      /* Increment ISR nesting level                        */
        }
    }
}
/*$PAGE*/
/*
*********************************************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲综合在线| 人禽交欧美网站| 亚洲妇女屁股眼交7| 国产91露脸合集magnet| 欧美日韩另类一区| 成人欧美一区二区三区| 久久精品国产久精国产| 日本精品视频一区二区三区| 久久久www免费人成精品| 婷婷一区二区三区| 色88888久久久久久影院按摩| 国产亚洲一区二区三区| 日韩av中文在线观看| 欧美综合一区二区三区| 国产日韩欧美精品综合| 精东粉嫩av免费一区二区三区 | 亚洲视频免费观看| 美脚の诱脚舐め脚责91 | 一区二区国产盗摄色噜噜| 国产乱码精品一区二区三区忘忧草| 欧美在线一区二区| 亚洲欧美日韩在线不卡| 菠萝蜜视频在线观看一区| 欧美精品一区二区三区高清aⅴ | 欧美电视剧免费全集观看| 香蕉久久夜色精品国产使用方法| 91传媒视频在线播放| 亚洲欧美日韩一区二区三区在线观看| 成人午夜免费视频| 国产精品久久网站| 97久久久精品综合88久久| 国产精品高清亚洲| 91小视频在线观看| 一区二区三区四区中文字幕| 91网站黄www| 自拍偷拍欧美激情| 一本大道av一区二区在线播放| 国产精品久久毛片av大全日韩| 成人高清视频免费观看| 欧美国产日韩a欧美在线观看| 国产成人av资源| 国产精品二三区| 91福利国产成人精品照片| 亚洲午夜激情网站| 在线播放欧美女士性生活| 日本sm残虐另类| 国产亚洲制服色| 色综合久久88色综合天天免费| 亚洲一区电影777| 91麻豆精品91久久久久同性| 久久se这里有精品| 国产精品理论片在线观看| 91免费看视频| 午夜精品国产更新| 久久综合久久综合久久综合| 高清久久久久久| 亚洲精品亚洲人成人网| 欧美精品久久一区| 国产一区二区三区四| 欧美激情综合五月色丁香小说| 99久久精品国产网站| 亚洲午夜在线观看视频在线| 日韩一级黄色片| 成人综合在线观看| 天天综合网天天综合色| 久久久三级国产网站| 91高清视频在线| 久久国产生活片100| 亚洲色图19p| 日韩一区国产二区欧美三区| 成人永久免费视频| 亚洲第一会所有码转帖| 久久精品一区二区三区不卡| 色欧美乱欧美15图片| 久久精品国产久精国产| 亚洲免费成人av| 久久嫩草精品久久久久| 欧美色电影在线| 懂色av一区二区三区蜜臀| 午夜精品久久久久久久蜜桃app| 中文在线一区二区| 在线电影国产精品| 在线观看一区二区视频| 国产精品1024| 日本午夜精品视频在线观看| 亚洲男人天堂av| 国产女人18毛片水真多成人如厕 | 国产精品 日产精品 欧美精品| 亚洲午夜私人影院| 中文字幕av一区二区三区高 | 国产精品99久久不卡二区| 日韩综合一区二区| 亚洲精品你懂的| 中文天堂在线一区| 精品久久久久久最新网址| 精品视频在线视频| 色综合久久综合网欧美综合网| 国产福利一区二区三区视频在线| 午夜久久电影网| 亚洲精品免费播放| 亚洲欧美怡红院| 国产精品理论片| 国产精品久久久久三级| 国产午夜精品福利| 欧美xxx久久| 日韩美女主播在线视频一区二区三区| 欧美日韩三级一区二区| 欧美日韩精品系列| 在线观看一区不卡| 久久久久久久免费视频了| 亚洲桃色在线一区| 国产精品成人一区二区艾草 | 69av一区二区三区| 精品视频999| 欧美日韩一区二区三区高清| 99精品视频在线播放观看| 成人av网址在线观看| 丁香啪啪综合成人亚洲小说| 精品一区二区三区在线播放视频 | 久久国内精品自在自线400部| 亚洲国产精品视频| 亚洲成精国产精品女| 亚洲国产欧美日韩另类综合| 亚洲国产色一区| 亚洲午夜电影网| 视频一区视频二区中文| 石原莉奈一区二区三区在线观看| 三级在线观看一区二区| 日韩影院免费视频| 青青草一区二区三区| 老司机精品视频一区二区三区| 国产综合久久久久影院| 免费在线一区观看| 国产伦精品一区二区三区免费迷 | 一区二区在线看| 亚洲高清免费一级二级三级| 一区二区三区四区不卡视频| 亚洲激情图片qvod| 日韩av在线免费观看不卡| 激情五月婷婷综合| 成人综合婷婷国产精品久久蜜臀| 成人毛片老司机大片| 色八戒一区二区三区| 欧美一级爆毛片| 国产亚洲女人久久久久毛片| 国产精品理伦片| 日韩和欧美一区二区| 国产精品自拍毛片| 91香蕉视频污| 日韩三级视频在线看| 国产精品沙发午睡系列990531| 综合在线观看色| 午夜日韩在线电影| 国产乱人伦精品一区二区在线观看| 风间由美一区二区三区在线观看 | 欧美影院精品一区| 精品成人一区二区三区| 亚洲精品视频在线观看免费 | 亚洲国产日韩综合久久精品| 精品一区二区三区蜜桃| 色偷偷成人一区二区三区91| 精品视频999| 国产精品传媒视频| 韩国三级电影一区二区| 欧美亚洲禁片免费| 久久久久久久久蜜桃| 一区二区欧美在线观看| 69堂精品视频| 亚洲视频一区二区在线观看| 裸体健美xxxx欧美裸体表演| 91片在线免费观看| 日本一区二区不卡视频| 久久99国产精品久久| 欧美羞羞免费网站| 中文字幕中文乱码欧美一区二区| 免费高清在线一区| 欧美麻豆精品久久久久久| 18欧美乱大交hd1984| 国产精品影视在线| 日韩一级大片在线观看| 亚洲超丰满肉感bbw| 色呦呦网站一区| 中文字幕一区二区三| 国产高清不卡一区二区| 精品国产欧美一区二区| 日本色综合中文字幕| 777xxx欧美| 污片在线观看一区二区| 精品视频在线免费观看| 亚洲三级在线免费| av激情亚洲男人天堂| 国产精品久久久久久久午夜片| 国产成人av资源| 国产精品无遮挡| 成人精品gif动图一区| 国产精品美女久久久久av爽李琼| 国产成人亚洲综合a∨婷婷| 国产午夜精品一区二区三区视频| 国产一区91精品张津瑜| 久久精品在这里|