pico]OS  1.0.4
Macros
Architecture / CPU Specific Settings
Configuration: Pico Layer

Macros

#define MVAR_t   char
#define MVAR_BITS   8 /* = (sizeof(MVAR_t) * 8) */
#define MPTR_t   long
#define POSCFG_ALIGNMENT   2
#define POSCFG_ISR_INTERRUPTABLE   0
#define POSCFG_TASKSTACKTYPE   0
#define POSCFG_CALLINITARCH   1
#define POSCFG_PORTMUTEX   0
#define POSCFG_DYNAMIC_MEMORY   0
#define POSCFG_DYNAMIC_REFILL   0
#define POS_MEM_ALLOC(bytes)   nosMemAlloc(bytes)

Detailed Description


Macro Definition Documentation

#define MPTR_t   long

Integer variable type used for memory pointers. This define must be set to an integer type that has the same bit width like a memory pointer (e.g. void*) on the target architecture. On a 32bit architecture you would usually define this to long, for a 8 bit architecture short would be sufficient.

#define MVAR_BITS   8 /* = (sizeof(MVAR_t) * 8) */

Machine variable width. This define tells the Operating System how much bits can be stored in the machine variable type MVAR_t. Some compilers support the sizeof(MVAR_t)-macro at this position, but some others don't. For example, set this define to 8 (bits) if MVAR_t is defined to char.

#define MVAR_t   char

Machine variable type. This define is set to the variable type that best matches the target architecture. For example, define this to char if the architecture has 8 bit, or to int / long for a 32 bit architecture. Note that the variable must fit into a single memory cell of the target architecture. (For a 32 bit architecture you can define MVAR_t to char, short or int / long, whereas at a 8 bit architecure you can only define it to char). This define is responsible for the maximum count of tasks the operating system can manage. For example: char = 8 bit, 8 * 8 = 64 tasks; long = 32 bit, 32 * 32 = 1024 tasks.

#define POS_MEM_ALLOC (   bytes)    nosMemAlloc(bytes)

Define optional memory allocation function. If POSCFG_DYNAMIC_MEMORY is set to 1, this definition must be set to a memory allocation function such as "malloc". The memory allocation function may not be reentrant when POSCFG_DYNAMIC_REFILL is set to 0, since the multitasking system is not yet started when the function is called.

#define POSCFG_ALIGNMENT   2

Required memory alignment on the target CPU. To reach maximum speed, some architecures need correctly aligned memory patterns. Set this define to the memory alignment (in bytes) your architecture requires. Note that this value must be a power of 2. If your architecture does not require memory alignment, set this value to 0 or 1.

#define POSCFG_CALLINITARCH   1

Enable call to function p_pos_initArch. When this define is set to 1, the operating system will call the user supplied function p_pos_initArch to initialize the architecture specific portion of the operating system.

#define POSCFG_DYNAMIC_MEMORY   0

Enable dynamic memory. If this define is set to 1, the memory for internal data structures is allocated dynamically at startup. The define POS_MEM_ALLOC must be set to a memory allocation function that shall be used. Otherwise, when this define is set to 0, the memory is allocated statically.

#define POSCFG_DYNAMIC_REFILL   0

Dynamic memory management. If this define is set to 1, the system will refill its volume of system structures for tasks, events, timers and messages when the user requests more structures than the amount that was preallocated (see defines POSCFG_MAX_TASKS, POSCFG_MAX_EVENTS, POSCFG_MAX_MESSAGES and POSCFG_MAX_TIMER ). To be able to use this feature, you must also set the define POSCFG_DYNAMIC_MEMORY to 1. But attention: The define POS_MEM_ALLOC must be set to a memory allocation function that is thread save. Please set the define POS_MEM_ALLOC to nosMemAlloc to use the nano layer memory allocator.

#define POSCFG_ISR_INTERRUPTABLE   0

Interruptable interrupt service routines. This define must be set to 1 (=enabled) when an interrupt service routine is interruptable on the machine. E.g. some PowerPCs support critical interrupts that can interrupt currently running noncritical interrupts. If your machine configuration does not support interruptable ISRs, you can set this define to 0 to save some execution time in ISRs.

#define POSCFG_PORTMUTEX   0

Enable the call of the functions p_pos_lock and p_pos_unlock. In some really rare and special cases it may be required that Pico]OS must acquire a mutex before it can call the functions p_pos_initTask and p_pos_freeStack. If you need such a mutex for your port please define this option to 1 and implement the appropriate functions.

#define POSCFG_TASKSTACKTYPE   0

Set the mechanism of stack memory handling. There are three types of stack memory handling defined.

Type 0
The stack memory is allocated by the user and a pointer to the stack memory is passed to the functions posTaskCreate, posInit and p_pos_initTask.

Type 1
The stack memory will be allocated by the platform port when a new task is created. The memory will be freed when the task is destroyed. The functions posTaskCreate, posInit and p_pos_initTask are called with a parameter that specifies the stack size. The function p_pos_freeStack is used to free the stack memory again when the task is destroyed.

Type 2
Like type 1, but the size of the stack is fixed. The functions posTaskCreate, posInit and p_pos_initTask do not take any stack parameters.

Note:
the functions posTaskCreate, posInit and p_pos_initTask have different prototypes for each stack handling type.