资源简介

一款免费并开源的嵌入式实时多任务操作系统,最小系统内核小于1KB。 具有高度可裁剪性,支持优先级抢占和时间片轮转两种任务调度机制,自适应任务调度算法,中断延时时间几乎为0,可检测堆栈溢出,支持信号量、邮箱、队列、事件标志、互斥等多种同步通信方式。 CoOS还支持ICCARM、ARMCC、GCC多种编译器,故不仅可以在CoIDE中通过勾选直接使用,还能独立应用于MDK和IAR中。官网提供了大量可直接使用的示例及应用代码。

资源截图

代码片段和文件信息

 /**
 *******************************************************************************
 * @file       core.c
 * @version   V1.1.4    
 * @date      2011.04.20
 * @brief      Core implementation code of CooCox CoOS kernel.
 *******************************************************************************
 * @copy
 *
 * INTERNAL FILEDON‘T PUBLIC.
 * 
 * 

© COPYRIGHT 2009 CooCox 


 *******************************************************************************
 */ 

/*---------------------------- Include ---------------------------------------*/
#include 

/*---------------------------- Variable Define -------------------------------*/
volatile U8     OSIntNesting  = 0;         /*!< Use to indicate interrupt nesting level*/
volatile U8     OSSchedLock   = 0;         /*!< Task Switch lock.                      */
volatile BOOL   TaskSchedReq  = Co_FALSE;


/**
 *******************************************************************************
 * @brief      Enter a ISR.    
 * @param[in]  None  
 * @param[out] None   
 * @retval     None  
 *
 * @par Description
 * @details    This function is called to notify OS when enter to an ISR.
 *
 * @note       When you call API in ISRyou must call CoEnterISR() before your
 *             interrupt handler codeand call CoExitISR() after your handler
 *             code and before exiting from ISR.  
 *******************************************************************************
 */
void CoEnterISR(void)
{
    Inc8(&OSIntNesting);                /* OSIntNesting increment             */
}


/**
 *******************************************************************************
 * @brief      Exit a ISR.  
 * @param[in]  None  
 * @param[out] None   
 * @retval     None  
 *
 * @par Description
 * @details    This function is called when exit from a ISR.   
 *
 * @note 
 *******************************************************************************
 */
void CoExitISR(void)
{
    Dec8(&OSIntNesting);                /* OSIntNesting decrease              */
    if( OSIntNesting == 0)              /* Is OSIntNesting == 0?              */
    {
        if(TaskSchedReq == Co_TRUE)
        {
OSSchedLock++;
            Schedule();                 /* Call task schedule                 */
OSSchedLock--;
        }
    }
}



/**
 *******************************************************************************
 * @brief      Unlock schedule    
 * @param[in]  None  
 * @param[out] None   
 * @retval     None  
 *
 * @par Description
 * @details   This function is called to unlock schedule(i.e.enable schedule again)   
 *
 * @note 
 *******************************************************************************
 */
void OsSchedUnlock(void)
{
    if(OSSchedLock == 1)                /* Is OSSchedLock == 0?               */
    {
#if CFG_TASK_WAITTING_EN > 0
        if(IsrReq == Co_TRUE)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-04-29 10:00  CoOS\
     目录           0  2010-11-04 16:32  CoOS\Document\
     文件       23640  2010-10-22 10:43  CoOS\Document\CooCox CoOS‘s TERMS AND CONDITIONS.pdf
     文件     1415680  2010-11-04 16:32  CoOS\Document\CooCox CoOS用户手册英文完整版.doc
     文件      749166  2010-09-09 08:44  CoOS\Document\CooCox_CoOS_User_Guide.pdf
     文件     1411072  2010-11-04 16:32  CoOS\Document\CoOS_User_Guide_CH.doc
     文件         896  2010-04-29 10:00  CoOS\Document\readme.txt
     目录           0  2011-04-20 11:10  CoOS\kernel\
     文件        1357  2011-04-20 10:46  CoOS\kernel\coocox.h
     文件        9052  2011-04-20 10:57  CoOS\kernel\CoOS.h
     文件        8099  2011-04-20 10:46  CoOS\kernel\core.c
     文件       16663  2011-04-20 10:46  CoOS\kernel\event.c
     文件       23980  2011-04-20 10:46  CoOS\kernel\flag.c
     文件        1714  2011-04-20 10:46  CoOS\kernel\hook.c
     文件       16387  2011-04-20 10:46  CoOS\kernel\kernelHeap.c
     文件       10737  2011-04-20 10:46  CoOS\kernel\mbox.c
     文件        9884  2011-04-20 10:46  CoOS\kernel\mm.c
     文件       12062  2011-04-20 10:46  CoOS\kernel\mutex.c
     文件        6802  2011-04-20 10:46  CoOS\kernel\OsConfig.h
     文件         685  2011-04-20 10:46  CoOS\kernel\OsCore.h
     文件        2077  2011-04-20 10:46  CoOS\kernel\OsError.h
     文件        2566  2011-04-20 10:46  CoOS\kernel\OsEvent.h
     文件        2011  2011-04-20 10:46  CoOS\kernel\OsFlag.h
     文件        1149  2011-04-20 10:46  CoOS\kernel\OsKernelHeap.h
     文件         936  2011-04-20 10:46  CoOS\kernel\OsMM.h
     文件        2045  2011-04-20 10:46  CoOS\kernel\OsMutex.h
     文件        1284  2011-04-20 10:46  CoOS\kernel\OsQueue.h
     文件        1271  2011-04-20 10:46  CoOS\kernel\OsServiceReq.h
     文件        4189  2011-04-20 10:46  CoOS\kernel\OsTask.h
     文件        1098  2011-04-20 10:46  CoOS\kernel\OsTime.h
     文件        2116  2011-04-20 10:46  CoOS\kernel\OsTimer.h
............此处省略20个文件信息

评论

共有 条评论