REXIS Startup

This fragment is needed for the basic REXIS startup:

 

#define REXIS_MEMORY_POOL_SIZE      (1024*8)    // 8K bytes

static unsigned char rexis_memory[REXIS_MEMORY_POOL_SIZE];

 

extern void task1(unsigned);

 

void main(void)

      {

      …

      REXIS_SysInit(rexis_memory, REXIS_MEMORY_POOL_SIZE);

      …

      REXIS_TaskCreate(“task 1”, task1, 0, 0, 0);

      …

      REXIS_SysStart();

      // never return

      }

 

There are only three API functions that you must call to get REXIS started:

 

1.    REXIS_SysInit is called with a memory block. The memory is used by REXIS to allocate task structures, stacks, and other internal usage such as mailboxes, semaphores, etc. This code fragment uses a memory block of 8K bytes. The size of the memory pool should be adjusted to reflect your program’s usage requirements.

2.    REXIS_TaskCreate is called to create a task. Its arguments (from left to right) are: the name of the task, the task function, the task priority, the task stack size, and the task function initial argument. If zero (0) is specified for the task priority and/or the task stack size, default values will be used. At least one task must be created prior to the REXIS_SysStart call. Other tasks can be created either in main() or in other tasks as needed.

3.    REXIS_SysStart is called to start the REXIS kernel. Once started, REXIS never returns to the original calling function.

 

In the examples below, tasks are assumed to have been created by REXIS_TaskCreate call(s) prior to calling REXIS_SysStart.

 

NOTE: the supplied example code may look slightly different from the code excerpts below.