From: Philippe Gerum <rpm@xenomai.org>
To: Kim De Mey <kim.demey@gmail.com>, xenomai@xenomai.org
Subject: Re: [Xenomai] [PATCH v2] Xenomai-forge: pSOS add priority denormalize
Date: Mon, 25 Nov 2013 15:29:08 +0100 [thread overview]
Message-ID: <52935EB4.9030306@xenomai.org> (raw)
In-Reply-To: <6e5a902f9794c477b1ae.1385378337@devws164.be.alcatel-lucent.com>
On 11/25/2013 12:18 PM, Kim De Mey wrote:
> Add the psos_task_denormalize_priority() and psos_task_get_priority()
> functions. Use psos_task_get_priority() to fill oldprio_r in t_setpri().
Merged, thanks.
>
> Signed-off-by: Kim De Mey <kim.demey@gmail.com>
>
> ---
>
> v2: Removed the psos_task_get_priority() call from task.h
>
> diff --git a/include/psos/psos.h b/include/psos/psos.h
> --- a/include/psos/psos.h
> +++ b/include/psos/psos.h
> @@ -366,6 +366,7 @@ u_long tm_wkwhen(u_long date,
> u_long ticks);
>
> int psos_task_normalize_priority(unsigned long psos_prio);
> +int psos_task_denormalize_priority(unsigned long core_prio);
>
> extern unsigned int psos_long_names;
>
> diff --git a/lib/psos/task.c b/lib/psos/task.c
> --- a/lib/psos/task.c
> +++ b/lib/psos/task.c
> @@ -236,6 +236,21 @@ int psos_task_normalize_priority(unsigne
> return psos_prio;
> }
>
> +/*
> + * Although default pSOS priorities are mapped 1:1 to SCHED_RT,
> + * we do still have to use a denormalize function because these
> + * calls are weak and application code may be override the call
> + * and implement the mapping differently.
> + */
> +
> +__attribute__ ((weak))
> +int psos_task_denormalize_priority(unsigned long core_prio)
> +{
> + /* Map a SCHED_RT priority level to a pSOS one. */
> + return core_prio;
> +}
> +
> +
> static int check_task_priority(u_long psos_prio, int *core_prio)
> {
> if (psos_prio < 1 || psos_prio > 255) /* In theory. */
> @@ -246,6 +261,12 @@ static int check_task_priority(u_long ps
> return SUCCESS;
> }
>
> +static int psos_task_get_priority(struct psos_task *task)
> +{
> + int prio = threadobj_get_priority(&task->thobj);
> + return psos_task_denormalize_priority(prio);
> +}
> +
> u_long t_create(const char *name, u_long prio,
> u_long sstack, u_long ustack, u_long flags, u_long *tid_r)
> {
> @@ -416,7 +437,7 @@ u_long t_setpri(u_long tid, u_long newpr
> if (task == NULL)
> return ret;
>
> - *oldprio_r = threadobj_get_priority(&task->thobj);
> + *oldprio_r = psos_task_get_priority(task);
>
> if (newprio == 0) { /* Only inquires for the task priority. */
> put_psos_task(task);
>
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> http://www.xenomai.org/mailman/listinfo/xenomai
>
--
Philippe.
prev parent reply other threads:[~2013-11-25 14:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 11:18 [Xenomai] [PATCH v2] Xenomai-forge: pSOS add priority denormalize Kim De Mey
2013-11-25 14:29 ` Philippe Gerum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52935EB4.9030306@xenomai.org \
--to=rpm@xenomai.org \
--cc=kim.demey@gmail.com \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.