On Mon, 2011-09-26 at 22:01 +0200, Ronny Meeus wrote:
<snip>
> Next to this I also adapted the task priority automatically using
> following algorithm:
> static int check_task_priority(u_long *psos_prio)
> {
> if (*psos_prio < 1 || *psos_prio > 255) /* In theory. */
> return ERR_PRIOR;
> /* Do not change priorities <=10 and >= 240.
> * Priorities in between are divided by 4 */
> if (*psos_prio > 240)
> *psos_prio = 70 + *psos_prio - 240;
> else if (*psos_prio > 10)
> *psos_prio = 11 + ((*psos_prio-10)/4);
>
> if ((int)(*psos_prio) >= threadobj_max_prio - 1) /* In practice. */
> panic("current implementation restricts pSOS "
> "priority levels to range [1..%d]",
> threadobj_max_prio - 2);
>
> return SUCCESS;
> }
>
> It also works well for our application.
> Please share your thoughts.
Since we cannot generalize the priority mapping rules, a better way may
be to allow your own code to be called by the pSOS emulator when such
mapping is required. So I have committed a tentative solution, defining
psos_task_normalize_priority() as a weak function, which receives the
pSOS priority, and should return the POSIX one.
A default implementation is provided by the emulator which does a
trivial 1:1 mapping.
--
Philippe.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help