XAL (XtratuM Abstraction Layer) development environment
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, ¤t_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 } } |
|||||
