Difference between revisions of "Technical topic: Manage interface priorities"
m (1 revision imported)
Latest revision as of 21:02, 4 August 2017
It is common to specify systems that can receive more than one message. In TASTE terms, it means functions that have more than one provided interfaces (PI).
When this is the case you may want to give give different levels of priorities to the various PI, so that at runtime, when the function is executed, the PI will be executed according to their priority.
We will explain how this can be done with TASTE.
This simple system contains two functions (Function1 and Function2). Periodically ("pulse" PI) Function 1 will call sequentially PI1 and then PI2 from Function 2. Both are sporadic.
The code of Function1 using SDL: simply calling the two PI in sequence
The code of Function2 using SDL: simple printf when a PI is executed
Assuming that Function 1 as a whole has a higher priority than Function 2 (so that it is not pre-empted immediately by Function 2 when calling PI1) we want to be able to decide which interface of PI1 or PI2 will effectively be executed the first one.
How to do it
Open the Deployment view and then the Concurrency View (from the Tools menu). Click on the top-icon as shown on the picture below: this is where you can define your priorities.
Try to give different values to PI1 and PI2, to figure out first if on your target a small number means a high priority or if it is the opposite.
How to test it
Linux targets cannot be used to validate this feature, as the Linux scheduler is not real-time and will mess up your scheduling. Try a real-time OS (e.g. RTEMS POSIX on a Leon processor) and use the built-in QEmu emulator to quickly check the results.
$ xterm -e /opt/qemu-leon2/bin/qemu-system-sparc -M at697 -nographic -kernel /path/to/leon_binary