Hi, Our legacy code has two functions to disable and enable interrupts going to the CPU core like cli() and sti() in the Linux kernel. Those function pairs are used to avoid interruptions in critical code sections by the scheduler or interrupts. Interruptions in those code sections can potentially cause race conditions and the failing of the application.
Xenomai doesn't have any equivalent API calls although those API calls should be easy to implement: Assuming that the ISR Tasks have an priority of XNCORE_MAX_PRIO-1 (currently it is XNCORE_MAX_PRIO) we could protect critical code sections by temporarily raising the priority of the task with the critical code section to XNCORE_MAX_PRIO. Furthermore assuming that the critical code doesn't cause a switch to secondary mode, no one prevents the critical code from running. After that code section the priority is lowered to the previous level. As one cannot prevent ppl from writing critical code which causes a mode switch, one can only check if a mode switch occured at the end of the critical sections and issue a warning if that was the case. I already have a version which works for me. I have some questions though: 1) If Priority -1 is assigned to Linux (ROOT) what is priority 0 for? 2) For what are priorities 100...257 reserved? 3) Why did u pick the odd number of 257 as the max. priority? I also found out that rt_task_set_priority() returns the old priority and not 0 (as described in the documentation) if the call succeeds. If you issue rt_task_set_priority() in an ISR Task it even returns 257. Regards, Andreas _______________________________________________ Xenomai-core mailing list [email protected] https://mail.gna.org/listinfo/xenomai-core
