os_cfg详解

/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* uC/OS-II Configuration File for V2.8x
*
* (c) Copyright 2005-2009, Micrium, Weston, FL
* All Rights Reserved
*
*
* File : OS_CFG.H
* By : Jean J. Labrosse
* Version : V2.91
*
* LICENSING TERMS:
* ---------------
* uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
* If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly license
* its use in your product. We provide ALL the source code for your convenience and to help you experience
* uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
* licensing fee.
*********************************************************************************************************
*/

#ifndef OS_CFG_H
#define OS_CFG_H


/* -------------------- MISCELLANEOUS --杂项------------------- */
#define OS_APP_HOOKS_EN 0u /* Application-defined hooks are called from the uC/OS-II hooks */
//函数执行参数检查功能
#define OS_ARG_CHK_EN 0u /* Enable (1) or Disable (0) argument checking */
//此常量设定是否在文件 OS_CPU_C.C 中声明对外接口函数(hook function)
#define OS_CPU_HOOKS_EN 1u /* uC/OS-II hooks are found in the processor port files */

#define OS_DEBUG_EN 0u /* Enable(1) debug variables */

#define OS_EVENT_MULTI_EN 0u /* Include code for OSEventPendMulti() */
#define OS_EVENT_NAME_EN 0u /* Enable names for Sem, Mutex, Mbox and Q */

//设 定系 统 中的 任务最低优先级 ( 最大优先级数 ), 用户任务的优先级可以从 0 到 OS_LOWEST_PRIO-2
#define OS_LOWEST_PRIO 63u /* Defines the lowest priority that can be assigned ... */
/* ... MUST NEVER be higher than 254! */

//OS_MAX_EVENTS 定义系统中最大的事件控制块的数量。系统中的每一个消息邮箱, 消息队列, 信号量都需要一个事件控制块。
#define OS_MAX_EVENTS 10u /* Max. number of event control blocks in your application */
//事件标志的最大数目,
#define OS_MAX_FLAGS 5u /* Max. number of Event Flag Groups in your application */
//OS_MAX_MEM_PART 定义系统中最大的内存块数
#define OS_MAX_MEM_PART 5u /* Max. number of memory partitions

*/
//OS_MAX_QS 定义系统中最大的消息队列数。要使用消息队列,常量 OS_Q_EN 也要同时置 1
#define OS_MAX_QS 4u /* Max. number of queue control blocks in your application */
//定义用户程序中最大的任务数, 设定的太大则会浪费内存
#define OS_MAX_TASKS 20u /* Max. number of tasks in your application, MUST be >= 2 */
//==1时,使用OSSchedLock() and OSSchedUnlock()
#define OS_SCHED_LOCK_EN 1u /* Include code for OSSchedLock() and OSSchedUnlock() */

#define OS_TICK_STEP_EN 1u /* Enable tick stepping feature for uC/OS-View */
//常量标识调用 OSTimeTick()函数的频率。用户需要在自己的初始化程序中保证 OSTimeTick()按所设定的频率调用
#define OS_TICKS_PER_SEC 1000u /* Set the number of ticks in one second */


/* --------------------- TASK STACK SIZE ---------------------- */
#define OS_TASK_TMR_STK_SIZE 128u /* Timer task stack size (# of OS_STK wide entries) */
//OS_TASK_STAT_STK_SIZE 设置μC/OS-II 中统计任务(statistic task堆栈的容量,统计任务堆栈的容量取决于所使用的处理器类型
#define OS_TASK_STAT_STK_SIZE 128u /* Statistics task stack size (# of OS_STK wide entries) */
//OS_TASK_IDLE_STK_SIZE 设置μC/OS-II 中空闲任务(Idle task堆栈的容量
#define OS_TASK_IDLE_STK_SIZE 128u /* Idle task stack size (# of OS_STK wide entries) */


/* ------------ TASK MANAGEMENT --任务管理-------------------- */
//此常量控制是否使用μC/OS-II 中的 OSTaskChangePrio()函数,设为 1 为使用。 如果在应用程序中不需要改变运行任务的优先级, 则将此常量设为 0 节省内存。
#define OS_TASK_CHANGE_PRIO_EN 1u /* Include code for OSTaskChangePrio() */
//此常量控制是否使用μC/OS-II 中的 OSTaskCreate()函数,设为 1 为使用。在μC/OS-II 中推荐用户使用 OSTaskCreateExt()函数建立任务。
#define OS_TASK_CREATE_EN 1u /* Include code for OSTaskCreate() */
//此常量控制是否使用μC/OS-II 中的 OSTaskCreateExt () 函数, 设为 1 为使用。该函数为扩展的,功能更全的任务建立函数。
#define OS_TASK_CREATE_EXT_EN 1u /* Include code for OSTaskCreateExt() */
//此常量控制是否使用μC/OS-II 中的 OSTaskDel()函数,设为 1 为使用。
#define OS_TASK_DEL_EN 1u /* Include code for OSTaskDel() */
#define OS_TASK_NAME_EN 1u /* Enable task names */
#define OS_TASK_PROFILE_EN 1u /* Include vari

ables in OS_TCB for profiling */
#define OS_TASK_QUERY_EN 1u /* Include code for OSTaskQuery() */
#define OS_TASK_REG_TBL_SIZE 1u /* Size of task variables array (#of INT32U entries) */
//OS_TASK_STAT_EN 设定系统是否使用μC/OS-II 中的统计任务 (statistic task)及其初始化函数。如果设为 1,则使用统计任务 OSTaskStat()
#define OS_TASK_STAT_EN 1u /* Enable (1) or Disable(0) the statistics task */
#define OS_TASK_STAT_STK_CHK_EN 1u /* Check task stacks from statistic task */
//此常量控制是否使用μC/OS-II 中的OSTaskSuspend()和OSTaskResume()函数,设为1为使用.如果在应用程序中不使用任务挂起-唤醒函数,将OS_TASK_SUSPEND_EN 设为 0 可以节省内存
#define OS_TASK_SUSPEND_EN 1u /* Include code for OSTaskSuspend() and OSTaskResume() */
#define OS_TASK_SW_HOOK_EN 1u /* Include code for OSTaskSwHook() */


/* -------------- EVENT FLAGS --事件标志---------------------- */
//==1,使用事件标志函数及其结构体
#define OS_FLAG_EN 0u /* Enable (1) or Disable (0) code generation for EVENT FLAGS */
#define OS_FLAG_ACCEPT_EN 1u /* Include code for OSFlagAccept() */
#define OS_FLAG_DEL_EN 1u /* Include code for OSFlagDel() */
#define OS_FLAG_NAME_EN 1u /* Enable names for event flag group */
#define OS_FLAG_QUERY_EN 1u /* Include code for OSFlagQuery() */
//==1,允许生成用于等待事件标志清零的代码
#define OS_FLAG_WAIT_CLR_EN 1u /* Include code for Wait on Clear EVENT FLAGS */
#define OS_FLAGS_NBITS 16u /* Size in #bits of OS_FLAGS data type (8, 16 or 32) */


/* ---------------- MESSAGE MAILBOXES 消息邮箱--------------- */
//OS_MBOX_EN 控制是否使用μC/OS-II 中的消息邮箱函数及其相关数据结构,设为 1 为使用。如果不使用,则关闭此常量节省内存。
#define OS_MBOX_EN 0u /* Enable (1) or Disable (0) code generation for MAILBOXES */
#define OS_MBOX_ACCEPT_EN 1u /* Include code for OSMboxAccept() */
#define OS_MBOX_DEL_EN 1u /* Include code for OSMboxDel() */
#define OS_MBOX_PEND_ABORT_EN 1u /* Include code for OSMboxPendAbort() */
#define OS_MBOX_POST_EN 1u /* Include code for OSMboxPost() */
#define OS_MBOX_POST_OPT_EN 1u /* Include code for OSMboxPostOpt()

*/
#define OS_MBOX_QUERY_EN 1u /* Include code for OSMboxQuery() */


/* --------------------- MEMORY MANAGEMENT -内存管理---------- */
//OS_MEM_EN 控制是否使用μC/OS-II 中的内存块管理函数及其相关数据结构, 设为 1 为使用。如果不使用,则关闭此常量节省内存
#define OS_MEM_EN 0u /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */
#define OS_MEM_NAME_EN 1u /* Enable memory partition names */
#define OS_MEM_QUERY_EN 1u /* Include code for OSMemQuery() */


/* ---- MUTUAL EXCLUSION SEMAPHORES --互斥信号量--------------- */
//==1,使用互斥信号量及其数据结构
#define OS_MUTEX_EN 1u /* Enable (1) or Disable (0) code generation for MUTEX */
#define OS_MUTEX_ACCEPT_EN 1u /* Include code for OSMutexAccept() */
#define OS_MUTEX_DEL_EN 1u /* Include code for OSMutexDel() */
#define OS_MUTEX_QUERY_EN 1u /* Include code for OSMutexQuery() */


/* ------------- MESSAGE QUEUES ---消息队列-------------------- */
//OS_Q_EN 控制是否使用μC/OS-II 中的消息队列函数及其相关数据结构,设为1为使用。如果不使用,则关闭此常量节省内存。
#define OS_Q_EN 0u /* Enable (1) or Disable (0) code generation for QUEUES */
#define OS_Q_ACCEPT_EN 1u /* Include code for OSQAccept() */
#define OS_Q_DEL_EN 1u /* Include code for OSQDel() */
#define OS_Q_FLUSH_EN 1u /* Include code for OSQFlush() */
#define OS_Q_PEND_ABORT_EN 1u /* Include code for OSQPendAbort() */
#define OS_Q_POST_EN 1u /* Include code for OSQPost() */
#define OS_Q_POST_FRONT_EN 1u /* Include code for OSQPostFront() */
#define OS_Q_POST_OPT_EN 1u /* Include code for OSQPostOpt() */
#define OS_Q_QUERY_EN 1u /* Include code for OSQQuery() */


/* --------------- SEMAPHORES --信号量------------------------- */
//OS_SEM_EN 控制是否使用μC/OS-II 中的信号量管理函数及其相关数据结构, 设为 1 为使用。如果不使用,则关闭此常量节省内存。
#define OS_SEM_EN 0u /* Enable (1

) or Disable (0) code generation for SEMAPHORES */
#define OS_SEM_ACCEPT_EN 1u /* Include code for OSSemAccept() */
#define OS_SEM_DEL_EN 1u /* Include code for OSSemDel() */
#define OS_SEM_PEND_ABORT_EN 1u /* Include code for OSSemPendAbort() */
#define OS_SEM_QUERY_EN 1u /* Include code for OSSemQuery() */
#define OS_SEM_SET_EN 1u /* Include code for OSSemSet() */


/* ------------- TIME MANAGEMENT ---时钟管理------------------- */
//==1,对任务延时,以 时、分、秒、毫秒 为单位定义的
#define OS_TIME_DLY_HMSM_EN 1u /* Include code for OSTimeDlyHMSM() */
#define OS_TIME_DLY_RESUME_EN 1u /* Include code for OSTimeDlyResume() */
#define OS_TIME_GET_SET_EN 1u /* Include code for OSTimeGet() and OSTimeSet() */
#define OS_TIME_TICK_HOOK_EN 1u /* Include code for OSTimeTickHook() */


/* ---------- TIMER MANAGEMENT ---软件定时器-------------------- */
//==1,使能软件定时器
#define OS_TMR_EN 0u /* Enable (1) or Disable (0) code generation for TIMERS */
#define OS_TMR_CFG_MAX 16u /* Maximum number of timers */
#define OS_TMR_CFG_NAME_EN 1u /* Determine timer names */
#define OS_TMR_CFG_WHEEL_SIZE 8u /* Size of timer wheel (#Spokes) */
#define OS_TMR_CFG_TICKS_PER_SEC 10u /* Rate at which timer management task runs (Hz) */

#endif


相关文档
最新文档