XAL

XAL (XtratuM Abstraction Layer) development environment

XAL is a minimal developing environment to create bare “C” applications. It is provided jointly with the XtratuM core.

A XAL partition can:

  • Be specified as ”system” or ”user”.
  • Use all the XtratuM hypercalls according to the type of partition.
  • Use the standard input/output “C” functions: printf, sprintf, etc. The available functions are defined in the include/stdio.h.
  • Define interrupt handlers and all services provided by XtratuM.

Example of a simple XAL partition is

#include <xm.h>
#include <stdio.h>

#define LIMIT 100

void PartitionMain(void) {
  long counter=0;

  printf("[P%d] XAL Partition \n",XM_PARTITION_SELF);
  counter=1;
  while(1) { 
  	counter++;

    /* do something */
    printf("[P%d] Counter %d \n",XM_PARTITION_SELF, counter);
  }
  XM_halt_partition(XM_PARTITION_SELF);
}

Example of a XAL partition that synchronises the execution of internal actions with the partition slot.

#include <xm.h>
#include <stdio.h>


void task1(void) {/* code of task 1 */}
void task2(void) {/* code of task 2 */}

void task3(void) {/* code of task 3 */}

volatile partitionControlTable_t *partitionControlTable;

void PartitionMain(void) {
   xmTime_t secondaryCycle = .....;
   xmTime_t current_clock; 
   int MAF = ....;

   int nSlot;

  partitionControlTable=XM_params_get_PCT(); 
  XM_get_time(XM_HW_CLOCK, &current_clock);

  nSlot = 0;

  /* This partition is scheduled in slots:0, 3, 7 and 10 of the MAF */
  while (1) {

    /* Reads the current slot identifier */
    nSlot = partitionControlTable->schedInfo.id;
    switch (nSlot) {
      case 0: task1(); break;
      case 3: task2(); break;
      case 7: task1(); break;
      case 10: task3(); break;
      default : break;
    }
    XM_idle_self; //Waits next timer event
  }
}