Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This section describes each of the #define constants in OS_CFG.H.

Table of Contents

Miscellaneous

OS_APP_HOOKS_EN

When set to 1, this #define specifies that application defined hooks are called from µC/OS-II’s hooks. See also OS_CPU_HOOKS_EN. Specifically:

The µC/OS-II hook…Calls the Application-define hook…
OSTaskCreateHook()App_TaskCreateHook()
OSTaskDelHook()App_TaskDelHook()
OSTaskIdleHook()App_TaskIdleHook()
OSTaskStatHook()App_TaskStatHook()
OSTaskSwHook()App_TaskSwHook()
OSTCBInitHook()App_TCBInitHook()
OSTimeTickHook()App_TimeTickHook()

OS_ARG_CHK_EN

OS_ARG_CHK_EN indicates whether you want most of µC/OS-II functions to perform argument checking. When set to 1, µC/OS-II will ensure that pointers passed to functions are non-NULL, that arguments passed are within allowable range and more. OS_ARG_CHK_EN was added to reduce the amount of code space and processing time required by µC/OS-II. Set OS_ARG_CHK_EN to 0 if you must reduce code space to a minimum. In general, you should always enable argument checking and thus set OS_ARG_CHK_EN to 1.

...

OS_TLS_TBL_SIZE performs two functions. By defining this #define you indicate that you desire to have Thread Local Storage (TLS) support for either the CCES tools from Analog Devices Inc (ADI) or Embedded Workbench from IAR. The value of this #define determines the number of ‘elements’ needed in the TLS table for the desired toolchain. Each entry is typically a pointer size variable. You should specify 5 for both tools.

Event Flags

OS_FLAG_EN

OS_FLAG_EN enables (when set to 1) or disables (when set to 0) code generation of all the event-flag services and data structures, which reduces the amount of code and data space needed when your application does not require the use of event flags. When OS_FLAG_EN is set to 0, you do not need to enable or disable any of the other #define constants in this section.

...

OS_FLAGS_NBITS has been introduced in V2.80 and specifies the number of bits used in event flags and MUST be either 8, 16 or 32.

Message Mailboxes

OS_MBOX_EN

This constant enables (when set to 1) or disables (when set to 0) the code generation of all message-mailbox services and data structures, which reduces the amount of code space needed when your application does not require the use of message mailboxes. When OS_MBOX_EN is set to 0, you do not need to enable or disable any of the other #define constants in this section.

...

OS_MBOX_QUERY_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSMboxQuery().

Memory Management

OS_MEM_EN

OS_MEM_EN enables (when set to 1) or disables (when set to 0) all code generation of the µC/OS-II partition-memory manager and its associated data structures. This feature reduces the amount of code and data space needed when your application does not require the use of memory partitions.

...

OS_MEM_QUERY_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSMemQuery().

Mutual Exclusion Semaphores

OS_MUTEX_EN

OS_MUTEX_EN enables (when set to 1) or disables (when set to 0) the code generation of all mutual-exclusion-semaphore services and data structures, which reduces the amount of code and data space needed when your application does not require the use of mutexes. When OS_MUTEX_EN is set to 0, you do not need to enable or disable any of the other #define constants in this section.

...

OS_MUTEX_QUERY_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSMutexQuery().

Message Queues

OS_Q_EN

OS_Q_EN enables (when set to 1) or disables (when set to 0) the code generation of all message-queue services and data structures, which reduces the amount of code space needed when your application does not require the use of message queues. When OS_Q_EN is set to 0, you do not need to enable or disable any of the other #define constants in this section. Note that if OS_Q_EN is set to 0, the #define constant OS_MAX_QS is irrelevant.

...

OS_Q_QUERY_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSQQuery().

Semaphores

OS_SEM_EN

OS_SEM_EN enables (when set to 1) or disables (when set to 0) all code generation of the µC/OS-II semaphore manager and its associated data structures, which reduces the amount of code and data space needed when your application does not require the use of semaphores. When OS_SEM_EN is set to 0, you do not need to enable or disable any of the other #define constants in this section.

...

OS_SEM_SET_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSSemSet().

Task Management

OS_TASK_TMR_STK_SIZE

OS_TASK_TMR_STK_SIZE specifies the size of the µC/OS-II timer task stack. The size is specified not in bytes but in number of elements. This is because a stack is declared to be of type OS_STK. The size of the timer-task stack depends on the processor you are using, the ‘callback’ functions that will be executed when each of the timer times out and the deepest anticipated interrupt-nesting level.

...

OS_TASK_TMR_PRIO specifies the priority of the timer management task. You can set the priority of the timer task to anything you want. Note that timer callback functions are executed by the timer task.  OS_TASK_TMR_PRIO needs to be set in your application file called APP_CFG.H.

Time Management

OS_TIME_DLY_HMSM_EN

OS_TIME_DLY_HMSM_EN enables (when set to 1) or disables (when set to 0) the code generation of the function OSTimeDlyHMSM(), which is used to delay a task for a specified number of hours, minutes, seconds, and milliseconds.

...

Normally, µC/OS-II requires the presence of a function called OSTimeTickHook() which is called at the very beginning of the tick ISR. When set to 0, this constant allows you to omit OSTimeTickHook() from your code. This configuration constant was added to reduce the amount of overhead during a tick ISR in applications that doesn’t require this hook.

Timer Management

Note that timer management requires semaphores and thus, you need to set OS_SEM_EN to 1.

...

This configuration constant determines the rate at which timers are updated (in Hz). Timer updates should be done at a fraction of the tick rate (i.e. OS_TICKS_PER_SEC). We recommend that you update timers at 10 Hz.

Function Summary

Table 17.1 lists each µC/OS-II function by type (Service), indicates which variables enable the code (Set to 1), and lists other configuration constants that affect the function (Other Constants).

...

Table 17.1     µC/OS-II functions and #define configuration constants.

Miscellaneous

ServiceSet to 1Other Constants
Thread Local Storage (TLS)OS_TLS_TBL_SIZE (set to 5)N/A
OSEventNameGet()OS_EVENT_NAME_ENN/A
OSEventNameSet()OS_EVENT_NAME_ENN/A
OSEventPendMulti()OS_EVENT_MULTI_EN 
OSInit()N/AOS_MAX_EVENTS
OS_Q_EN and OS_MAX_QS
OS_MEM_EN
OS_TASK_IDLE_STK_SIZE
OS_TASK_STAT_EN
OS_TASK_STAT_STK_SIZE
OSSafetyCriticalStart()OS_SAFETY_CRITICAL_IEC61508 
OSSchedLock()OS_SCHED_LOCK_ENN/A
OSSchedUnlock()OS_SCHED_LOCK_ENN/A
OSStart()N/AN/A
OSStatInit()OS_TASK_STAT_EN &&
OS_TASK_CREATE_EXT_EN
OS_TICKS_PER_SEC
OSVersion()N/AN/A

Interrupt Management

ServiceSet to 1Other Constants
OSIntEnter()N/AN/A
OSIntExit()N/AN/A

Event Flags

ServiceSet to 1Other Constants
OSFlagAccept()OS_FLAG_ENOS_FLAG_ACCEPT_EN
OSFlagCreate()OS_FLAG_ENOS_MAX_FLAGS
OSFlagDel()OS_FLAG_ENOS_FLAG_DEL_EN
OSFlagNameGet()OS_FLAG_ENOS_FLAG_NAME_EN
OSFlagNameSet()OS_FLAG_ENOS_FLAG_NAME_EN
OSFlagPend()OS_FLAG_ENOS_FLAG_WAIT_CLR_EN
OSFlagPost()OS_FLAG_ENN/A
OSFlagQuery()OS_FLAG_ENOS_FLAG_QUERY_EN

Message Mailboxes

ServiceSet to 1Other Constants
OSMboxAccept()OS_MBOX_ENOS_MBOX_ACCEPT_EN
OSMboxCreate()OS_MBOX_ENOS_MAX_EVENTS
OSMboxDel()OS_MBOX_ENOS_MBOX_DEL_EN
OSMboxPend()OS_MBOX_ENN/A
OSMboxPendAbort()OS_MBOX_ENOS_MBOX_PEND_ABORT_EN
OSMboxPost()OS_MBOX_ENOS_MBOX_POST_EN
OSMboxPostOpt()OS_MBOX_ENOS_MBOX_POST_OPT_EN
OSMboxQuery()OS_MBOX_ENOS_MBOX_QUERY_EN

Memory Partition Management

ServiceSet to 1Other Constants
OSMemCreate()OS_MEM_ENOS_MAX_MEM_PART
OSMemGet()OS_MEM_ENN/A
OSMemNameGet()OS_MEM_ENOS_MEM_NAME_EN
OSMemNameSet()OS_MEM_ENOS_MEM_NAME_EN
OSMemPut()OS_MEM_ENN/A
OSMemQuery()OS_MEM_ENOS_MEM_QUERY_EN

Mutex Management

ServiceSet to 1Other Constants
OSMutexAccept()OS_MUTEX_ENOS_MUTEX_ACCEPT_EN
OSMutexCreate()OS_MUTEX_ENOS_MAX_EVENTS
OSMutexDel()OS_MUTEX_ENOS_MUTEX_DEL_EN
OSMutexPend()OS_MUTEX_ENN/A
OSMutexPost()OS_MUTEX_ENN/A
OSMutexQuery()OS_MUTEX_ENOS_MUTEX_QUERY_EN

Message Queues

ServiceSet to 1Other Constants
OSQAccept()OS_Q_ENOS_Q_ACCEPT_EN
OSQCreate()OS_Q_ENOS_MAX_EVENTS
OS_MAX_QS
OSQDel()OS_Q_ENOS_Q_DEL_EN
OSQFlush()OS_Q_ENOS_Q_FLUSH_EN
OSQPend()OS_Q_ENN/A
OSQPendAbort() OS_Q_EN OS_Q_PEND_ABORT_EN
OSQPost()OS_Q_ENOS_Q_POST_EN
OSQPostFront()OS_Q_ENOS_Q_POST_FRONT_EN
OSQPostOpt()OS_Q_ENOS_Q_POST_OPT_EN
OSQQuery()OS_Q_ENOS_Q_QUERY_EN

Semaphore Management

ServiceSet to 1Other Constants
OSSemAccept()OS_SEM_ENOS_SEM_ACCEPT_EN
OSSemCreate()OS_SEM_ENOS_MAX_EVENTS
OSSemDel()OS_SEM_ENOS_SEM_DEL_EN
OSSemPend()OS_SEM_ENN/A
OSSemPendAbort()OS_SEM_ENOS_SEM_PEND_ABORT_EN
OSSemPost()OS_SEM_ENN/A
OSSemQuery()OS_SEM_ENOS_SEM_QUERY_EN
OSSemSet()OS_SEM_ENOS_SEM_SET_EN

Task Management

ServiceSet to 1Other Constants
OSTaskChangePrio()OS_TASK_CHANGE_PRIO_ENOS_LOWEST_PRIO
OSTaskCreate()OS_TASK_CREATE_ENOS_MAX_TASKS
OSTaskCreateExt()OS_TASK_CREATE_EXT_ENOS_MAX_TASKS
OS_TASK_STK_CLR
OSTaskDel()OS_TASK_DEL_ENOS_MAX_TASKS
OSTaskDelReq()OS_TASK_DEL_ENOS_MAX_TASKS
OSTaskRegGet()OS_TASK_REG_TBL_SIZEN/A
OSTaskRegGetID()OS_TASK_REG_TBL_SIZEN/A
OSTaskRegSet()OS_TASK_REG_TBL_SIZEN/A
OSTaskResume()OS_TASK_SUSPEND_ENOS_MAX_TASKS
OSTaskNameGet()OS_TASK_NAME_ENN/A
OSTaskNameSet()OS_TASK_NAME_ENN/A
OSTaskStkChk()OS_TASK_CREATE_EXT_ENOS_MAX_TASKS
OSTaskSuspend()OS_TASK_SUSPEND_ENOS_MAX_TASKS
OSTaskQuery()OS_TASK_QUERY_ENOS_MAX_TASKS
OS_TaskStatStkChk()OS_TASK_STAT_STK_CHK_ENN/A

Time Management

ServiceSet to 1Other Constants
OSTimeDly()N/AN/A
OSTimeDlyHMSM()OS_TIME_DLY_HMSM_ENOS_TICKS_PER_SEC
OSTimeDlyResume()OS_TIME_DLY_RESUME_ENOS_MAX_TASKS
OSTimeGet()OS_TIME_GET_SET_ENN/A
OSTimeSet()OS_TIME_GET_SET_ENN/A
OSTimeTick()N/AN/A

Timer Management

ServiceSet to 1Other Constants
OSTmrCreate()OS_TMR_ENN/A
OSTmrDel()OS_TMR_ENN/A
OSTmrNameGet()OS_TMR_EN && OS_TMR_CFG_NAME_ENN/A
OSTmrRemainGet()OS_TMR_ENN/A
OSTmrStart()OS_TMR_ENN/A
OSTmrStop()OS_TMR_ENN/A
OSTmrSignal()OS_TMR_ENOS_TMR_CFG_TICKS_PER_SEC

User-Defined Functions

ServiceSet to 1Other Constants
OSTaskCreateHook()OS_CPU_HOOKS_ENN/A
OSTaskDelHook()OS_CPU_HOOKS_ENN/A
OSTaskStatHook()OS_CPU_HOOKS_ENN/A
OSTaskSwHook()OS_CPU_HOOKS_ENOS_TASK_SW_HOOK_EN
OSTimeTickHook()OS_CPU_HOOKS_ENOS_TIME_TICK_HOOK_EN