pico]OS
1.0.4
|
Macros | |
#define | POSCFG_MAX_PRIO_LEVEL 8 |
#define | POSCFG_TASKS_PER_PRIO 8 |
#define | POSCFG_MAX_TASKS 16 |
#define | POSCFG_MAX_EVENTS 16 |
#define | POSCFG_MAX_MESSAGES 8 |
#define | POSCFG_MAX_TIMER 4 |
#define | POSCFG_ROUNDROBIN 1 |
#define | POSCFG_SOFT_MTASK 1 |
#define | POSCFG_CTXSW_COMBINE 10 |
#define | POSCFG_REALTIME_PRIO 0 |
#define | POSCFG_TASKCB_USERSPACE 0 |
#define | POSCFG_MSG_MEMORY 1 |
#define | POSCFG_MSG_BUFSIZE 80 |
#define | POSCFG_SOFTINTERRUPTS 8 |
#define | POSCFG_SOFTINTQUEUELEN 20 |
#define | HZ 18 /* timer ticks per second */ |
#define HZ 18 /* timer ticks per second */ |
Timer tick rate. This define must be set to the tickrate of the timer interrupt (= timer ticks per second).
#define POSCFG_CTXSW_COMBINE 10 |
Soft multitasking context switch combine counter trigger threshold. Sets the number how often an event must be triggered to initiate a context switch. This mechanism takes only effect when soft multitasking is enabled (see definition POSCFG_SOFT_MTASK for details). If the combine threshold is set to 0, a context switch will never occure as result of triggering events.
#define POSCFG_MAX_EVENTS 16 |
Maximum count of events. This define sets the maximum count of event data structures which can be allocated. Semaphores, Mutexes, Flags and Message Boxes are using this event data structures. Keep the value of this define as small as possible to decrease memory usage. Note that there is no maximum value this define can have, the pico]OS supports an unlimmit count of events.
#define POSCFG_MAX_MESSAGES 8 |
Maximum count of message buffers. This definition sets the maximum count of message buffers that can be allocated with posMessageAlloc. Note that if only pointers are posted with posMessageSend (POSCFG_MSG_MEMORY == 0), this define sets the count of internal buffers (=messages) that can be pending in the messaging system. To get maximum performance, the value should be set to twice the count of tasks that are sending messages. If POSCFG_FEATURE_MSGBOXES is set to 0, this define has no effect.
#define POSCFG_MAX_PRIO_LEVEL 8 |
#define POSCFG_MAX_TASKS 16 |
Maximum count of tasks. This define sets the maximum count of task data structures which can be allocated. Even if the define POSCFG_MAX_PRIO_LEVEL allows in conjunction with POSCFG_TASKS_PER_PRIO more tasks, the maximum count of usable tasks is limmited by this define. The value of this define can be in the range 2..(POSCFG_TASKS_PER_PRIO * POSCFG_MAX_PRIO_LEVEL). This define should be set as small as possible to decrease memory usage. Remember that the OS has a built in idle task that also needs a task structure.
#define POSCFG_MAX_TIMER 4 |
Maximum count of timers. This define sets the maximum count of timers that can be allocated with posTimerCreate. If POSCFG_FEATURE_TIMER is set to 0, this define has no effect. Note that the value for this define must be at least 1 if timers are enabled.
#define POSCFG_MSG_BUFSIZE 80 |
Size of message buffers in bytes. If message boxes are enabled and POSCFG_MSG_MEMORY is set to 1, this define sets the size of a message buffer. To keep the operating system as simple as possible, only one fixed buffer size is supported.
#define POSCFG_MSG_MEMORY 1 |
Enable the use of system supported message buffers. By default, only buffer pointers can be posted with the messaging system. If this definition is set to 1 (=enabled), the functions posMessageAlloc and posMessageFree are supported to allow dynamic buffer allocation, and real data with many bytes can be posted into the tasks message boxes. Note: This requires that message boxes are enabled (the defintion POSCFG_FEATURE_MSGBOXES must be set to 1).
#define POSCFG_REALTIME_PRIO 0 |
Realtime priority threshold for soft multitasking. With this define some priority levels can be defined to be hard realtime, even if soft multitasking is enabled. All priority levels equal to or higher this value are scheduled in realtime. If this value is set to 0, no priority levels are scheduled in realtime. Note that this define takes only effect when POSCFG_SOFT_MTASK = 1 and POSCFG_ROUNDROBIN = 1.
#define POSCFG_ROUNDROBIN 1 |
Set scheduling scheme. The pico]OS supports two types of scheduling:
POSCFG_ROUNDROBIN = 0 sets the standard scheduling scheme,
POSCFG_ROUNDROBIN = 1 enables the round robin scheduler.
For real time operation the standard scheduler is the best choice. Standard scheduling means, that every task gets its own priority, at no time two tasks can have the same priority. On a 8bit system you have a maximum count of 8 x 8 = 64 tasks, with priority numbers 0 .. 63 where 0 is the priority of the idle task and 63 is the highest priority.
The round robin scheduler allows several tasks to have the same priority. The number of tasks is limited by the count of bits the machine type variable can hold (see define MVAR_BITS for details). The maximum count of priority levels is also limited by MVAR_BITS. So on an 8bit system you can have 8 priority levels with 8 tasks at each level, making 64 tasks in sum. The priority level 0 is the lowest, and the idle task runs there. On priority 0 is space left for 7 user tasks. Priority 7 is the highest priority. Note that on every priority level is done a round robin scheduling, that means each task has the same right for execution. No task is prefered. If a task gives of processing time, or its time slice has expired, the next task at this priority is scheduled.
#define POSCFG_SOFT_MTASK 1 |
Set soft multitasking. By setting this define to 1, it is possible to soften the hard real time scheduler. That means, a context switch is no more done every time an event (such as semaphores or flags) is triggered, even if the signalled task has a higher priority. The signaled task will first start to run if the time slice of the current task has expired or the task gives of processing time by itself or the maximum count of signaled events is reached (see the definition POSCFG_CTXSW_COMBINE for details, also the define POSCFG_REALTIME_PRIO may interest you). The purpose of soft multitasking is to reduce expensive context switches to a minimum to get more processing time for the main work.
#define POSCFG_SOFTINTERRUPTS 8 |
Set number of software interrupts. pico]OS has a built in mechanism to simulate software interrupts. For example, software interrupts can be used to connect hardware interrupts, that are outside the scope of pico]OS, to the realtime operating system. A hardware interrupt will trigger a software interrupt that can then signalize a semaphore object. This define sets the number of software interrupts pico]OS will support.
#define POSCFG_SOFTINTQUEUELEN 20 |
Set the number of software interrupts pico]OS shall be able to queue. A software interrupt is executed each time the scheduler is called. The scheduler runs at least with a rate of HZ times per second. For example, if in your system 1000 software interrupts can happen within a second, and the system tick rate is HZ = 100, set this define at least to 10, else software interrupts could be lost. Since the queue does not need much memory, it is saver to make the queue longer than needed; I recommend twice the length calculated.
#define POSCFG_TASKCB_USERSPACE 0 |
When this define is set to a non-zero value, some user available space is inserted into each task control block. The user can call the function posTaskGetUserspace to get a pointer to the user memory in the current tcb. Set this define to the number of bytes you need to have in the task control block.
#define POSCFG_TASKS_PER_PRIO 8 |
Maximum number of allowed tasks per priority level. If the standard scheduler is used, this define automatically defaults to 1, since the standard scheduler supports only one task at each priority. If the round robin scheduling scheme is used (the define POSCFG_ROUNDROBIN is set to 1), this define limits the count of tasks that can be at the same priority. The value for this definition must be a power of two and can not exceed the count of bits set by MVAR_BITS.