Table of Contents

Configuration file OSAcfg.h

The file OSAcfg.h must be created for each project. (It is recommended that you place this file in the project folder.) This file is automatically included by the file osa.h. It contains operating system setup data.

In the simplest case this file can be empty.

To simplify creating/modifying OSAcfg.h, you can use the program OSAcfg_Tool

System constants

Constant name Description
OS_ENABLE_ALL Includes all services and all system types except user timers (see below)
OS_ENABLE_CSEM Enables counting semaphores
OS_ENABLE_QUEUE Enables queues of pointers to messages
OS_ENABLE_SQUEUE Enables queues of simple messages
OS_QUEUE_SQUEUE_IDENTICAL This constant can be defined to reduce memory usage when sizes of OST_MSG and OST_SMSG are identical. This can be useful for PIC10, PIC12 and PIC16
OS_ENABLE_CRITICAL_SECTION Includes codes for using critical sections

Priority control constants

OS_PRIORITY_LEVEL OS_PRIORITY_NORMAL (defaul) Normal priority mode with checking tasks in order of creation
OS_PRIORITY_DISABLED Disables task priorities. This reduces RAM and ROM usage
OS_PRIORITY_EXTENDED In this mode all task will get the control according to their priority
OS_DISABLE_PRIORITY old style consant Same as OS_PRIORITY_DISABLE

Timers control constants

Constant name Description
OS_ENABLE_TTIMERS Enables task timers and functions to use them
OS_ENABLE_DTIMERS Enables functions to use dynamic timers
OS_ENABLE_QTIMERS Enables functions to use queue of timers
OS_STIMERS Number of static timers. Enables array of static timers
OS_STIMERS_ENABLE_ALLOCATION Enables functions to assign static timers at run time
OS_STIMERS_OPTIMIZATION_SIZE Optimizes size of code for processing static timers in OS_Timer (by default it is optimized for speed)
OS_TTIMERS_OPTIMIZATION_SIZE Optimizes size of code for processing task timers in OS_Timer (by default it is optimized for speed)

Services in interrupts

Constant name Description
OS_ENABLE_INT_CSEM Allows the use of binary semaphore services within interrupts
OS_ENABLE_INT_CSEM Allows the use of counting semaphore services within interrupts
OS_ENABLE_INT_FLAGS Allows the use of flags within interrupts
OS_ENABLE_INT_MSG Allows the use of pointer to message services within interrupts
OS_ENABLE_INT_SMSG Allows the use of simple message services within interrupts
OS_ENABLE_INT_QUEUE Allows the use of queue services within interrupts
OS_ENABLE_INT_ALL Enables all constants above

Data contents

Constant name Description RAM usage
OS_TASKS Maximum number of active tasks 2 bytes per task for PIC12 and PIC10
3 bytes per task for PIC16
4 bytes per task for PIC18
20 bytes per task for PIC24 and dsPIC
5 bytes per task for AVR
The number of bytes per task will be increased when OS_ENABLE_TTIMERS is defined.
OS_BSEMS Number of binary semaphores One byte per eight semaphores (for 8-bit controllers); two bytes per 16 semaphores (for 16-bit controllers)
OS_TIMERS8 (old style)* Number of 8-bit static timers 1 byte per timer
OS_TIMERS16 (old style)* Number of 16-bit static timers 2 bytes per timer
OS_TIMERS24 (old style)* Number of 24-bit static timers 2 bytes per timer
OS_TIMERS32 (old style)* Number of 32-bit static timers 4 bytes per timer

* - this type of timer is not recommended for use

Data types

Constant name Default value Description
OS_TIMER_SIZE 2 Number of bytes per timer (can be 1, 2 or 4)
OS_STIMER_SIZE OS_TIMER_SIZE Number of bytes per static timer (can be 1, 2 or 4)
OS_TTIMER_SIZE OS_TIMER_SIZE Number of bytes per task timer (can be 1, 2 or 4)
OS_DTIMER_SIZE OS_TIMER_SIZE Number of bytes per dynamic timer (can be 1, 2 or 4)
OS_QTIMER_SIZE OS_TIMER_SIZE Number of bytes per timer in queue of timers (can be 1, 2 or 4)
OS_CSEM_SIZE 1 Number of bytes per counting semaphore (can be 1, 2 or 4)
OS_SMSG_TYPE* unsigned char Type of simple message
OS_MSG_TYPE* void * Type of message

* - these types can't be redefined for PIC12.

Data allocation for PIC10, PIC12, PIC16 and PIC18

Allowed OS_BANK_xxx values:

Constant name Default value Description
OS_BANK_OS(1) 0 To allocate all system varables except those individually allocated (see below)
OS_BANK_BSEMS(1) OS_BANK_OS To allocate binary semaphores
OS_BANK_TASKS(1) OS_BANK_OS To allocate task descriptors
OS_BANK_STIMERS(1) OS_BANK_TIMERS To allocate new style static timers
OS_ADDRESS_TASK - For mikroC PRO for PIC16: Used to allocate task descriptors at specified address (e.g. 0x120, or 0x190)
OS_BANK_TIMERS (old style)(1),(2) OS_BANK_OS To allocate all static timers (old style and new style)
OS_BANK_TIMERS8 (old style)(1),(2) OS_BANK_TIMERS To allocate 8-bit timers
OS_BANK_TIMERS16 (old style)(1),(2) OS_BANK_TIMERS To allocate 16-bit timers
OS_BANK_TIMERS24 (old style)(1),(2) OS_BANK_TIMERS To allocate 24-bit timers
OS_BANK_TIMERS32 (old style)(1),(2) OS_BANK_TIMERS To allocate 32-bit timers
OS_BANK_TIMEOUTS (old style)(1),(2) OS_BANK_TIMERS To allocate timeout bits for old style static timers

(1) - has no effect when using CCS, mikroC PRO, or AVR
(2) - this type of timer is not recommended for use