xenomai scheduler's ticks period
Quoted 7 lines · Matthieu
Quoted 4 lines · Gilles Chanteperdrix
Quoted 1 line · Matthieu
Let me know if I've done something wrong ...
rt_timer_readbelongs to the native skin, not to the vxworks skin !
Quoted 8 lines
Quoted 2 lines
--
Gilles.Ok, but I don't really see why does mixing vxworks task with a xenomai instruction that not depends on vxworks scheduler is a problem. if I just get time, does the task switch to xenomai scheduler ?. However, if it's really a problem, what can I use to get a pricise time, as I can't use getTick anymore. Philippe suggested xntbase time base services ?
You can use rt_timer_read(), but you should not assume that this returns a nanoseconds count, this depends on the timing configuration of the native skin.
Signature · 1 line
Gilles.
Quoted 18 lines · Gilles Chanteperdrix
Quoted 4 lines · Matthieu
Quoted 1 line · Gilles Chanteperdrix
Matthieu wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Let me know if I've done something wrong ...
rt_timer_readbelongs to the native skin, not to the vxworks skin !--
Gilles.Ok, but I don't really see why does mixing vxworks task with a xenomai instruction that not depends on vxworks scheduler is a problem. if I
just
Quoted 3 lines
get time, does the task switch to xenomai scheduler ?. However, if it's really a problem, what can I use to get a pricise time, as I can't use getTick anymore. Philippe suggested xntbase time base services ?
Quoted 6 lines
You can use
rt_timer_read(), but you should not assume that this returns a nanoseconds count, this depends on the timing configuration of the native skin.--
Gilles.
Ok, but in fact, that's not my problem : I don't understand why the loop doesn't stop on taskDelay(1), as there is no tick on vxworks scheduler (due to tick_arg=0) ?
Matthieu
Quoted 26 lines · Matthieu
Quoted 18 lines · Gilles Chanteperdrix
Quoted 4 lines · Matthieu
Quoted 1 line · Gilles Chanteperdrix
Matthieu wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Let me know if I've done something wrong ...
rt_timer_readbelongs to the native skin, not to the vxworks skin !--
Gilles.Ok, but I don't really see why does mixing vxworks task with a xenomai instruction that not depends on vxworks scheduler is a problem. if I
just
Quoted 3 lines
get time, does the task switch to xenomai scheduler ?. However, if it's really a problem, what can I use to get a pricise time, as I can't use getTick anymore. Philippe suggested xntbase time base services ?
Quoted 6 lines
You can use
rt_timer_read(), but you should not assume that this returns a nanoseconds count, this depends on the timing configuration of the native skin.--
Quoted 9 lines
Gilles.
Ok, but in fact, that's not my problem : I don't understand why the loop doesn't stop on taskDelay(1), as there is no tick on vxworks scheduler (due
to tick_arg=0) ?Matthieu
I've tested a programme with a task that suspend itself, and a main loop that resume the task when it is suspended. The task has to be rescheldue to continue its execution but the tick_arg value has no influence on the time the task waits for rescheduling. That's make me think the vxworks scheduler isn't rhythmed by this tick. Could you explain me what's going on ?
thank you in advance
Matthieu
Hi
Do I have to understand that with no tick taskDelay(xxx) wait xxx nanoseconds ?
Well, I've made other tests, and it's a little confuse to me because I try tickGet() instruction when tick_arg=0 and the result is that tickGet give me an inceasing number, while I should have been a fixe value. Is it the same think : tickGet get nanosecond time since epoch ? I really need to know if I can use tick_arg=0 and tickAnnounce to have a manual tick, in order to use watchdog (wdStart which takes as arguments the number of ticks to delay is going to use nanoseconds ?)
Thak you in advance
Matthieu
Quoted 40 lines · Matthieu
Quoted 18 lines · Gilles Chanteperdrix
Quoted 4 lines · Matthieu
Quoted 1 line · Gilles Chanteperdrix
Matthieu wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Let me know if I've done something wrong ...
rt_timer_readbelongs to the native skin, not to the vxworks skin !--
Gilles.Ok, but I don't really see why does mixing vxworks task with a xenomai instruction that not depends on vxworks scheduler is a problem. if I
just
Quoted 3 lines
get time, does the task switch to xenomai scheduler ?. However, if it's really a problem, what can I use to get a pricise time, as I can't use getTick anymore. Philippe suggested xntbase time base services ?
Quoted 6 lines
You can use
rt_timer_read(), but you should not assume that this returns a nanoseconds count, this depends on the timing configuration of the native skin.--
Gilles.
Ok, but in fact, that's not my problem : I don't understand why the loop doesn't stop on taskDelay(1), as there is no tick on vxworks scheduler (due
to tick_arg=0) ?Matthieu
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Hi,
I finally succeed in using tick_arg=0 : The use of a watchdog (wdStart) is a goog test to show the effect of tick_arg. With tick_arg=0, the watchdog doesn't start the specified routine as no tick has elapsed. When tick_arg=0, I really think that taskDelay and tickGet or tickSet instructions don't use the ticks anymore but a timer for time arguments or returns. For my application, it doesn't matter anyway. I only need watchdogs.
As Philippe suggest me, I tried a tiny RTDM driver, but tickAnnouce() doesn't works. Here is the code of my RTDM driver. Could you tell me what doesn't work ?
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <vxworks/vxworks.h>
#include <rtdm/rtdm_driver.h>
static int major = 0;
int tick_period = 1; // dure d'un tick par dfaut en ms
// RT_TASK vxworks_tick_task;rtdm_task_t vxworks_tick_task;
/* Tache temps reel priodique, qui tick le scheduler vxworks */ void vxworks_tick(void *arg)
{
while (1) {
// dort pendant tick_periode ms
rtdm_task_sleep(tick_period*1000000);
// tick le scheduler vxworks
tickAnnounce();
}
}/* ioctl qui permet d'envoyer a la tache temps reel priodique la valeur de la priode (en ms) */
static int my_ioctl_function(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
//recupere la priode
tick_period = cmd;
printk(KERN_DEBUG "vxworks_tick_mod : modification de la dure d'un tick :
%d ms\n",tick_period);
return 0;
}static struct file_operations fops =
{
ioctl : my_ioctl_function
};
static int __init vxworks_tick_mod_init (void)
{
int ret;
int err;
ret = register_chrdev(major,"vxworks_tick_mod", &fops);
if (ret < 0)
{
printk(KERN_WARNING "vxworks_tick_mod : Problme sur le major\n");
}
printk(KERN_DEBUG "vxworks_tick_mod : Module charg !\n");
err = rtdm_task_init(&vxworks_tick_task, "vxworks_tick_task",
&vxworks_tick, NULL, 99, 0);
if (err) {
printk("vxworks_tick_mod: error rt_task_spawn\n");
return 0;
}
return 0;
}static void __exit vxworks_tick_mod_exit(void)
{
int ret;
unregister_chrdev(major, "vxworks_tick_mod");
rtdm_task_destroy(&vxworks_tick_task);
printk(KERN_DEBUG "vxworks_tick_mod : Module dcharg !\n");
}module_init(vxworks_tick_mod_init);module_exit(vxworks_tick_mod_exit);
Thank you in advance
Matthieu
I tried an other code, but I didn't succeed too. Can anybody help me ?
here is my code :
#include <rtdm/rtdm_driver.h>
#include <vxworks/vxworks.h>
// our driver context struct: used for storing various information struct drv_context {
};
long tick_period=1;
// RT_TASK vxworks_tick_task;rtdm_task_t vxworks_tick_task;
/************************************************************/ /*Tache temps rel priodique, qui tick le scheduler vxworks*/ /************************************************************/ void vxworks_tick(void *arg)
{
while (1) {
// dort pendant tick_periode ms
rtdm_task_sleep(tick_period*1000000);
// tick le scheduler vxworks
tickAnnounce();
// rtdm_printk("TickAnnounce\n");
}
}/**********************************************************/
/* DRIVER OPEN */
/**********************************************************/
void open_rt(struct rtdm_dev_context *context,
rtdm_user_info_t *user_info,
int oflags)
{
}
/**********************************************************/
/* DRIVER CLOSE */
/**********************************************************/
void close_rt(struct rtdm_dev_context *context,
rtdm_user_info_t *user_info)
{
}
/**********************************************************/
/* DRIVER IOCTL */
/**********************************************************/
void ioctl_rt(struct rtdm_dev_context *context,
rtdm_user_info_t *user_info,
int request,
void *arg){
}
/**********************************************************/
/* DRIVER OPERATIONS */
/**********************************************************/ static struct rtdm_device tick_driver = {
struct_version: RTDM_DEVICE_STRUCT_VER,
device_flags: RTDM_NAMED_DEVICE,
context_size: sizeof(struct drv_context),
device_name: "vxworks_tick_mod0",
/* open and close functions are not real-time safe due kmalloc
and kfree. If you do not use kmalloc and kfree, and you made sure that there is no syscall in the open/close handler, you can declare the open_rt and close_rt handler.
*/
open_rt: open_rt,
open_nrt: NULL,
ops: {
close_rt: close_rt,
close_nrt: close_rt,
ioctl_rt: ioctl_rt,
ioctl_nrt: NULL,
read_rt: NULL,
read_nrt: NULL,
write_rt: NULL,
write_nrt: NULL,
recvmsg_rt: NULL,
recvmsg_nrt: NULL,
sendmsg_rt: NULL,
sendmsg_nrt: NULL,
},
device_class: RTDM_CLASS_EXPERIMENTAL,
device_sub_class: 222,
driver_name: "vxworks_tick_mod",
peripheral_name: "vxworks_tick_mod",
provider_name: "-",
proc_name: tick_driver.device_name,
};/**********************************************************/
/* INIT DRIVER */
/**********************************************************/ int init_module(void)
{
rtdm_dev_register(&tick_driver); rtdm_task_init(&vxworks_tick_task, "vxworks_tick_task", &vxworks_tick,
NULL, 99, 0);
return 0;
}/**********************************************************/
/* CLEANUP DRIVER */
/**********************************************************/ void cleanup_module(void)
{
rtdm_task_destroy(&vxworks_tick_task);
rtdm_dev_unregister(&tick_driver, 1000);
}Matthieu.
Hi
As I have no answer to my questions, I would like to know if you have any solution ?
Thank you in advance
Quoted 5 lines · Matthieu
Hi
As I have no answer to my questions, I would like to know if you have any solution ?
Nobody answered likely because nobody actually understands what you are trying to achieve, at least it is still vastly unclear to me. You will find a somewhat fixed version below; this said, using a periodic RTDM task to do that does not bring much value, except perhaps to demonstrate the use of decoupled timebases.
What has been suggested earlier was to use RTDM to relay tick forwarding requests from a userland process to pace the VxWorks skin in kernel space (e.g. using ioctl calls).
Again: read the timebase programming documentation to have a clearer view of the timer core internals.
tickoverride/module.c renamed from orig.c +16 -8
@@ -5,7 +5,7 @@struct drv_context { }; -long tick_period=1 ; +long tick_period=100000000 ;// RT_TASK vxworks_tick_task; rtdm_task_t vxworks_tick_task;
@@ -29,31 +29,31 @@/**********************************************************/ /* DRIVER OPEN */ /**********************************************************/ -void open_rt (struct rtdm_dev_context *context, +int open_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info,int oflags) { - +return 0 ; }/**********************************************************/ /* DRIVER CLOSE */ /**********************************************************/ -void close_rt (struct rtdm_dev_context *context, +int close_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info) { - +return 0 ; }/**********************************************************/ /* DRIVER IOCTL */ /**********************************************************/ -void ioctl_rt (struct rtdm_dev_context *context, +int ioctl_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info, -int request, +unsigned request,void *arg) { - +return 0 ; }
@@ -103,11 +103,19 @@ proc_name: tick_driver.device_name, }; +extern xntbase_t *wind_tbase; +/**********************************************************/ /* INIT DRIVER */ /**********************************************************/ int init_module (void ) { +int ret; + + ret =xntbase_switch ("vxworks" , tick_period, &wind_tbase); +if (ret) +return ret; +rtdm_dev_register (&tick_driver);rtdm_task_init (&vxworks_tick_task,"vxworks_tick_task" , &vxworks_tick,NULL ,99 ,0 );
{[email protected]} diff -u orig.c frags/tickoverride/module.c
tickoverride/module.c renamed from orig.c +16 -8
@@ -5,7 +5,7 @@struct drv_context { }; -long tick_period=1 ; +long tick_period=100000000 ;// RT_TASK vxworks_tick_task; rtdm_task_t vxworks_tick_task;
@@ -29,31 +29,31 @@/**********************************************************/ /* DRIVER OPEN */ /**********************************************************/ -void open_rt (struct rtdm_dev_context *context, +int open_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info,int oflags) { - +return 0 ; }/**********************************************************/ /* DRIVER CLOSE */ /**********************************************************/ -void close_rt (struct rtdm_dev_context *context, +int close_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info) { - +return 0 ; }/**********************************************************/ /* DRIVER IOCTL */ /**********************************************************/ -void ioctl_rt (struct rtdm_dev_context *context, +int ioctl_rt (struct rtdm_dev_context *context,rtdm_user_info_t *user_info, -int request, +unsigned request,void *arg) { - +return 0 ; }
@@ -103,11 +103,19 @@ proc_name: tick_driver.device_name, }; +extern xntbase_t *wind_tbase; +/**********************************************************/ /* INIT DRIVER */ /**********************************************************/ int init_module (void ) { +int ret; + + ret =xntbase_switch ("vxworks" , tick_period, &wind_tbase); +if (ret) +return ret; +rtdm_dev_register (&tick_driver);rtdm_task_init (&vxworks_tick_task,"vxworks_tick_task" , &vxworks_tick,NULL ,99 ,0 );
Signature · 1 line
Philippe.
Hi
Well I'm going to try to be clear :
I work on a project that aims at migrating VxWorks tasks from PPC boards on VME crate to X86 Computer ruuning with Linux. The cost of using Xenomai API instead of vxworks skin seems very costly. The idea is to keep the maximum of mechanisms.
As there is no implementation of vxworks periodic task instruction, the idea was to use watchdogs. In fact, as watchdogs are counting from ticks, it's easy to make tasks periodic if the period of the task is a multiple of the tick period. So each task starts it's watchdog, executes some routine, and suspends itself. The watchdog, when the specified delay ticks elapsed, resumes the task. And so on...
The use of multiple PPC boards, with periodic tasks that need to be synchronized, has required the use of an hardware interrupt, spread to all CPUs, and which handler tickAnnouce() vxworks. I know that this mechanism isn't still necessary as there is only one vxworks tick on Xenomai, even if I work with many CPUs. But in the new configuration, I have a PCI card that will send this interrupt. So I need to stop the automatic vxworks tick with tick_arg=0 and to handle this interrupt to tickAnnouce() manually. As I will don't have this card all the day, I need to simulate this mecanism, and I need to create something that will tickAnnouce() at a periodic time.
I created a module that, in on case, will handle the interrupt, and on an other case, will create a xenomai rt_task that tickAnnouce. And this doesn't work. I want the ioctl method send the period to the module in order to modify the period of the tick.
I still have created this driver has you see but it doesn't work. I'm going to test your modifications. Thank you for that.
I will also need to get a precise time, and Gilles suggest me to use xntbase, but xntbase_get_time(&nktbase); isn't recognized. I will see more information in the timebase programming documentation I think.
(http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__timebase.html
?)
I hope these information will help you in understanding what i want to archieve.
Thank you again for you help
Matthieu
Quoted 9 lines · Matthieu
Hi
Well I'm going to try to be clear :
I work on a project that aims at migrating VxWorks tasks from PPC boards on VME crate to X86 Computer ruuning with Linux. The cost of using Xenomai API instead of vxworks skin seems very costly. The idea is to keep the maximum of mechanisms.
Quoted 6 lines
As there is no implementation of vxworks periodic task instruction, the idea was to use watchdogs. In fact, as watchdogs are counting from ticks, it's easy to make tasks periodic if the period of the task is a multiple of the tick period. So each task starts it's watchdog, executes some routine, and suspends itself. The watchdog, when the specified delay ticks elapsed, resumes the task. And so on...
You may want to use a semaphore to synchronize your wd handler with the task instead of suspend/resume calls.
Quoted 6 lines
The use of multiple PPC boards, with periodic tasks that need to be synchronized, has required the use of an hardware interrupt, spread to all CPUs, and which handler
tickAnnouce()vxworks. I know that this mechanism isn't still necessary as there is only one vxworks tick on Xenomai, even if I work with many CPUs.
Wrong, Xenomai ticks on each CPU because internal timers are per-cpu resources; only the boot CPU tracks jiffies, but that's a different issue.
But in the new configuration, I have a PCI card that
Quoted 11 lines
will send this interrupt. So I need to stop the automatic vxworks tick with tick_arg=0 and to handle this interrupt to
tickAnnouce()manually. As I will don't have this card all the day, I need to simulate this mecanism, and I need to create something that willtickAnnouce()at a periodic time.I created a module that, in on case, will handle the interrupt, and on an other case, will create a xenomai
rt_taskthat tickAnnouce. And this doesn't work. I want the ioctl method send the period to the module in order to modify the period of the tick.I still have created this driver has you see but it doesn't work.
What your code did is switching the VxWorks timer to aperiodic mode which stops periodic timing; in that mode, the time unit is nanosecond, so every timeout data is interpreted as a count of nanoseconds. This is likely not what you want.
I'm going
Quoted 2 lines
to test your modifications. Thank you for that.
Forget about this example; actually, those changes do not fix the logic, but only provide some hints about xntbase_switch(), and fix return code issues.
Quoted 2 lines
I will also need to get a precise time, and Gilles suggest me to use xntbase, but
xntbase_get_time(&nktbase); isn't recognized.
What Gilles told you is that solely switching the VxWorks clock to aperiodic mode (by passing period == 0) would wreck the underlying timing logic of a VxWorks app, which does not pass/expect nanoseconds but jiffies/ticks. In short, doing so is not enough.
Normally, solving your issue would require to make the master timebase paced by your PCI card, which would in turn provide the correct timing for the VxWorks timebase (as the timebase doc states, periodic timebases are cascaded from the master aperiodic one). However, doing so would also require to adapt the Xenomai HAL code accordingly, and a PCI hw that is oneshot programmable as well.
If you want to hack the Xenomai timer sub-system in order to only affect the VxWorks timebase, what you actually need is to control the coupling between the master timebase (paced by decrementer) and the slave VxWorks one, so that decrementer ticks may be prevented from kicking the VxWorks timebase. This way, you would be able to call tickAnnounce() freely to announce any incoming VxWorks tick (i.e. from your PCI handler).
In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- call tickAnnounce() from your PCI IRQ handler
When paced normally (simulation, "somebody stole by PCI card" mode), just leave the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the VxWorks slave timebase to the master one anew:
- call xntslave_start(base2slave(wind_tbase), xnarch_get_cpu_time() + period, period); /* period is given in nanoseconds, depends on the master timebase */
In any case, you don't need to change the VxWorks tick period. Starting/stopping the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai internals -- we should probably encapsulate this into new xntbase_bind/unbind calls if this does eventually works for you.
Signature · 1 line
Philippe.
Quoted 19 lines · Philippe Gerum
Quoted 5 lines · Matthieu
Hi
Well I'm going to try to be clear :
I work on a project that aims at migrating VxWorks tasks from PPC boards
on
Quoted 1 line
VME crate to X86 Computer ruuning with Linux. The cost of using Xenomai
API
Quoted 1 line
instead of vxworks skin seems very costly. The idea is to keep the
maximum
Quoted 4 lines
of mechanisms.
As there is no implementation of vxworks periodic task instruction, the idea was to use watchdogs. In fact, as watchdogs are counting from
ticks,
Quoted 1 line
it's easy to make tasks periodic if the period of the task is a multiple
of
Quoted 1 line
the tick period. So each task starts it's watchdog, executes some
Quoted 9 lines
routine,
Quoted 1 line
and suspends itself. The watchdog, when the specified delay ticks
elapsed,
Quoted 1 line
resumes the task. And so on...
You may want to use a semaphore to synchronize your wd handler with the task
instead of suspend/resume calls.
Sorry, it was a mistake from me, semaphores are used instead of suspend/resume.
Quoted 28 lines
Quoted 3 lines
The use of multiple PPC boards, with periodic tasks that need to be synchronized, has required the use of an hardware interrupt, spread to
all
Quoted 1 line
CPUs, and which handler
tickAnnouce()vxworks. I know that thismechanism
Quoted 1 line
isn't still necessary as there is only one vxworks tick on Xenomai, even
if
Quoted 1 line
I work with many CPUs.
Wrong, Xenomai ticks on each CPU because internal timers are per-cpu resources;
only the boot CPU tracks jiffies, but that's a different issue.But in the new configuration, I have a PCI card that
Quoted 1 line
will send this interrupt. So I need to stop the automatic vxworks tick
with
Quoted 3 lines
tick_arg=0 and to handle this interrupt to
tickAnnouce()manually. As I will don't have this card all the day, I need to simulate this mecanism, and I need to create something that willtickAnnouce()at a periodictime.
Quoted 2 lines
I created a module that, in on case, will handle the interrupt, and on
an
Quoted 4 lines
other case, will create a xenomai
rt_taskthat tickAnnouce. And this doesn't work. I want the ioctl method send the period to the module in order to modify the period of the tick.
Quoted 7 lines
Quoted 1 line
I still have created this driver has you see but it doesn't work.
What your code did is switching the VxWorks timer to aperiodic mode which stops
periodic timing; in that mode, the time unit is nanosecond, so every timeout
data is interpreted as a count of nanoseconds. This is likely not what
you
Quoted 11 lines
want.
I'm going
Quoted 2 lines
to test your modifications. Thank you for that.
Forget about this example; actually, those changes do not fix the logic, but
only provide some hints aboutxntbase_switch(), and fix return code issues.
Quoted 6 lines
Quoted 2 lines
I will also need to get a precise time, and Gilles suggest me to use xntbase, but
xntbase_get_time(&nktbase); isn't recognized.What Gilles told you is that solely switching the VxWorks clock to aperiodic
mode (by passing period == 0) would wreck the underlying timing logic of
a
Quoted 4 lines
VxWorks app, which does not pass/expect nanoseconds but jiffies/ticks. In short,
doing so is not enough.
I need a clock to get the time with a 10 µs precision. I tought using this master timebase, as it gives me a time in nanoseconds, irrespective of vxworks timebase.
Quoted 5 lines
Normally, solving your issue would require to make the master timebase paced by
your PCI card, which would in turn provide the correct timing for the VxWorks
timebase (as the timebase doc states, periodic timebases are cascaded
from
Quoted 11 lines
the
master aperiodic one). However, doing so would also require to adapt the Xenomai
HAL code accordingly, and a PCI hw that is oneshot programmable as well.If you want to hack the Xenomai timer sub-system in order to only affect the
VxWorks timebase, what you actually need is to control the coupling between the
master timebase (paced by decrementer) and the slave VxWorks one, so that decrementer ticks may be prevented from kicking the VxWorks timebase.
This
Quoted 16 lines
way,
you would be able to calltickAnnounce()freely to announce any incoming VxWorks
tick (i.e. from your PCI handler).In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- calltickAnnounce()from your PCI IRQ handlerWhen paced normally (simulation, "somebody stole by PCI card" mode), just leave
the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the
VxWorks slave timebase to the master one anew:
Quoted 3 lines
- call xntslave_start(base2slave(wind_tbase),
xnarch_get_cpu_time()+ period,
period); /* period is given in nanoseconds, depends on the master
timebase
Quoted 10 lines
*/
In any case, you don't need to change the VxWorks tick period. Starting/stopping
the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai
internals -- we should probably encapsulate this into new xntbase_bind/unbind
calls if this does eventually works for you.
You are right. It was un misunderstanding because I still don't know the impact of tick_arg.
What you propose is very interesting. I's easier than what I tried to do. xntbase_bind/unbind seems to be a good solution. I would like to know from where I would be able to use these calls (kernel/user space) ? What I need is to select the simulation working mode (without the card) or the PCI IRQ mode during the execution of my code (whose exectution is in user space). If I'm working in simulation mode, I also need to specify the tick period at the begining of the execution (1ms or 5ms).
Quoted 2 lines
--
Philippe.
Matthieu
Quoted 80 lines · Matthieu
Quoted 18 lines · Philippe Gerum
Quoted 5 lines · Matthieu
Hi
Well I'm going to try to be clear :
I work on a project that aims at migrating VxWorks tasks from PPC boards
on
Quoted 1 line
VME crate to X86 Computer ruuning with Linux. The cost of using Xenomai
API
Quoted 1 line
instead of vxworks skin seems very costly. The idea is to keep the
maximum
Quoted 4 lines
of mechanisms.
As there is no implementation of vxworks periodic task instruction, the idea was to use watchdogs. In fact, as watchdogs are counting from
ticks,
Quoted 1 line
it's easy to make tasks periodic if the period of the task is a multiple
of
Quoted 9 lines
Quoted 1 line
the tick period. So each task starts it's watchdog, executes some
routine,
Quoted 1 line
and suspends itself. The watchdog, when the specified delay ticks
elapsed,
Quoted 1 line
resumes the task. And so on...
You may want to use a semaphore to synchronize your wd handler with the task
instead of suspend/resume calls.Sorry, it was a mistake from me, semaphores are used instead of suspend/resume.
Quoted 25 lines
Quoted 2 lines
The use of multiple PPC boards, with periodic tasks that need to be synchronized, has required the use of an hardware interrupt, spread to
all
Quoted 1 line
CPUs, and which handler
tickAnnouce()vxworks. I know that thismechanism
Quoted 1 line
isn't still necessary as there is only one vxworks tick on Xenomai, even
if
Quoted 1 line
I work with many CPUs.
Wrong, Xenomai ticks on each CPU because internal timers are per-cpu resources;
only the boot CPU tracks jiffies, but that's a different issue.But in the new configuration, I have a PCI card that
Quoted 1 line
will send this interrupt. So I need to stop the automatic vxworks tick
with
Quoted 3 lines
tick_arg=0 and to handle this interrupt to
tickAnnouce()manually. As I will don't have this card all the day, I need to simulate this mecanism, and I need to create something that willtickAnnouce()at a periodictime.
Quoted 1 line
I created a module that, in on case, will handle the interrupt, and on
an
Quoted 4 lines
other case, will create a xenomai
rt_taskthat tickAnnouce. And this doesn't work. I want the ioctl method send the period to the module in order to modify the period of the tick.Quoted 6 lines
Quoted 1 line
I still have created this driver has you see but it doesn't work.
What your code did is switching the VxWorks timer to aperiodic mode which stops
periodic timing; in that mode, the time unit is nanosecond, so every timeout
data is interpreted as a count of nanoseconds. This is likely not whatyou
Quoted 10 lines
want.
I'm going
Quoted 2 lines
to test your modifications. Thank you for that.
Forget about this example; actually, those changes do not fix the logic, but
only provide some hints aboutxntbase_switch(), and fix return code issues.Quoted 5 lines
Quoted 2 lines
I will also need to get a precise time, and Gilles suggest me to use xntbase, but
xntbase_get_time(&nktbase); isn't recognized.What Gilles told you is that solely switching the VxWorks clock to aperiodic
mode (by passing period == 0) would wreck the underlying timing logic ofa
Quoted 8 lines
Quoted 4 lines
VxWorks app, which does not pass/expect nanoseconds but jiffies/ticks. In short,
doing so is not enough.I need a clock to get the time with a 10 µs precision. I tought using this master timebase, as it gives me a time in nanoseconds, irrespective of vxworks timebase.
That will work. The master timebase is always active and does return nanoseconds when inquired.
Quoted 50 lines
Quoted 6 lines
Normally, solving your issue would require to make the master timebase paced by
your PCI card, which would in turn provide the correct timing for the VxWorks
timebase (as the timebase doc states, periodic timebases are cascadedfrom
Quoted 11 lines
the
master aperiodic one). However, doing so would also require to adapt the Xenomai
HAL code accordingly, and a PCI hw that is oneshot programmable as well.If you want to hack the Xenomai timer sub-system in order to only affect the
VxWorks timebase, what you actually need is to control the coupling between the
master timebase (paced by decrementer) and the slave VxWorks one, so that decrementer ticks may be prevented from kicking the VxWorks timebase.This
Quoted 16 lines
way,
you would be able to calltickAnnounce()freely to announce any incoming VxWorks
tick (i.e. from your PCI handler).In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- calltickAnnounce()from your PCI IRQ handlerWhen paced normally (simulation, "somebody stole by PCI card" mode), just leave
the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the
VxWorks slave timebase to the master one anew:Quoted 3 lines
- call xntslave_start(base2slave(wind_tbase),
xnarch_get_cpu_time()+ period,
period); /* period is given in nanoseconds, depends on the mastertimebase
Quoted 10 lines
*/
In any case, you don't need to change the VxWorks tick period. Starting/stopping
the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai
internals -- we should probably encapsulate this into new xntbase_bind/unbind
calls if this does eventually works for you.
Quoted 5 lines
You are right. It was un misunderstanding because I still don't know the impact of
tick_arg.
What you propose is very interesting. I's easier than what I tried to do. xntbase_bind/unbind seems to be a good solution. I would like to know from where I would be able to use these calls (kernel/user space) ?
Kernel space. If you need to relay requests to switch on/off timebase coupling from userland, then you just need your small RDM driver to do so, via some ioctl command of your own.
Quoted 5 lines
What I need is to select the simulation working mode (without the card) or the PCI IRQ mode during the execution of my code (whose exectution is in user space). If I'm working in simulation mode, I also need to specify the tick period at the begining of the execution (1ms or 5ms).
Then you will also need to change the period of the VxWorks timebase on the fly, using xntbase_update() when applicable.
Quoted 7 lines
Quoted 2 lines
--
Philippe.Matthieu
Signature · 1 line
Philippe.
Quoted 98 lines · Philippe Gerum
Quoted 1 line · Matthieu
On Mon, 07 Jul 2008 13:45:36 +0200, Philippe Gerum <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 5 lines · Matthieu
Hi
Well I'm going to try to be clear :
I work on a project that aims at migrating VxWorks tasks from PPC
boards
Quoted 2 lines
Quoted 2 lines
on
Quoted 1 line
VME crate to X86 Computer ruuning with Linux. The cost of using
Xenomai
Quoted 6 lines
Quoted 6 lines
API
Quoted 1 line
instead of vxworks skin seems very costly. The idea is to keep the
maximum
Quoted 3 lines
of mechanisms.
As there is no implementation of vxworks periodic task instruction,
the
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
idea was to use watchdogs. In fact, as watchdogs are counting from
ticks,
Quoted 1 line
it's easy to make tasks periodic if the period of the task is a
multiple
Quoted 5 lines
Quoted 5 lines
of
Quoted 1 line
the tick period. So each task starts it's watchdog, executes some
routine,
Quoted 1 line
and suspends itself. The watchdog, when the specified delay ticks
elapsed,
Quoted 15 lines
Quoted 5 lines
Quoted 1 line
resumes the task. And so on...
You may want to use a semaphore to synchronize your wd handler with the task
instead of suspend/resume calls.Sorry, it was a mistake from me, semaphores are used instead of suspend/resume.
Quoted 6 lines
Quoted 2 lines
The use of multiple PPC boards, with periodic tasks that need to be synchronized, has required the use of an hardware interrupt, spread to
all
Quoted 1 line
CPUs, and which handler
tickAnnouce()vxworks. I know that thismechanism
Quoted 1 line
isn't still necessary as there is only one vxworks tick on Xenomai,
even
Quoted 10 lines
Quoted 10 lines
if
Quoted 1 line
I work with many CPUs.
Wrong, Xenomai ticks on each CPU because internal timers are per-cpu resources;
only the boot CPU tracks jiffies, but that's a different issue.But in the new configuration, I have a PCI card that
Quoted 1 line
will send this interrupt. So I need to stop the automatic vxworks tick
with
Quoted 1 line
tick_arg=0 and to handle this interrupt to
tickAnnouce()manually. AsI
Quoted 1 line
Quoted 1 line
Quoted 1 line
will don't have this card all the day, I need to simulate this
mecanism,
Quoted 10 lines
Quoted 10 lines
Quoted 1 line
and I need to create something that will
tickAnnouce()at a periodictime.
Quoted 1 line
I created a module that, in on case, will handle the interrupt, and on
an
Quoted 5 lines
other case, will create a xenomai
rt_taskthat tickAnnouce. And this doesn't work. I want the ioctl method send the period to the module in order to modify the period of the tick.I still have created this driver has you see but it doesn't work.
What your code did is switching the VxWorks timer to aperiodic mode
which
Quoted 11 lines
Quoted 4 lines
stops
periodic timing; in that mode, the time unit is nanosecond, so every timeout
data is interpreted as a count of nanoseconds. This is likely not whatyou
Quoted 6 lines
want.
I'm going
Quoted 2 lines
to test your modifications. Thank you for that.
Forget about this example; actually, those changes do not fix the
logic,
Quoted 9 lines
Quoted 9 lines
but
only provide some hints aboutxntbase_switch(), and fix return code issues.Quoted 2 lines
I will also need to get a precise time, and Gilles suggest me to use xntbase, but
xntbase_get_time(&nktbase); isn't recognized.What Gilles told you is that solely switching the VxWorks clock to aperiodic
mode (by passing period == 0) would wreck the underlying timing logicof
Quoted 2 lines
a
Quoted 1 line
VxWorks app, which does not pass/expect nanoseconds but jiffies/ticks.
In
Quoted 4 lines
Quoted 3 lines
short,
doing so is not enough.
Quoted 8 lines
Quoted 1 line
I need a clock to get the time with a 10 µs precision. I tought using
this
Quoted 2 lines
master timebase, as it gives me a time in nanoseconds, irrespective of vxworks timebase.
That will work. The master timebase is always active and does return nanoseconds
when inquired.
What instruction I use to get this time ?
I tried :
#include <native/timer.h>xntbase_get_time(&nktbase);
But it doesn't work
Quoted 60 lines
Quoted 10 lines
Quoted 7 lines
Normally, solving your issue would require to make the master timebase paced by
your PCI card, which would in turn provide the correct timing for the VxWorks
timebase (as the timebase doc states, periodic timebases are cascadedfrom
Quoted 2 lines
the
master aperiodic one). However, doing so would also require to adaptthe
Quoted 2 lines
Quoted 2 lines
Xenomai
HAL code accordingly, and a PCI hw that is oneshot programmable aswell.
Quoted 2 lines
Quoted 2 lines
If you want to hack the Xenomai timer sub-system in order to only
affect
Quoted 4 lines
Quoted 4 lines
the
VxWorks timebase, what you actually need is to control the coupling between the
master timebase (paced by decrementer) and the slave VxWorks one, sothat
Quoted 4 lines
Quoted 1 line
decrementer ticks may be prevented from kicking the VxWorks timebase.
This
Quoted 2 lines
way,
you would be able to calltickAnnounce()freely to announce anyincoming
Quoted 9 lines
Quoted 9 lines
VxWorks
tick (i.e. from your PCI handler).In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- calltickAnnounce()from your PCI IRQ handlerWhen paced normally (simulation, "somebody stole by PCI card" mode),
just
Quoted 20 lines
Quoted 8 lines
leave
the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the
VxWorks slave timebase to the master one anew:- call xntslave_start(base2slave(wind_tbase),
xnarch_get_cpu_time()+ period,
period); /* period is given in nanoseconds, depends on the mastertimebase
Quoted 10 lines
*/
In any case, you don't need to change the VxWorks tick period. Starting/stopping
the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai
internals -- we should probably encapsulate this into new xntbase_bind/unbind
calls if this does eventually works for you.Quoted 3 lines
You are right. It was un misunderstanding because I still don't know the impact of
tick_arg.
What you propose is very interesting. I's easier than what I tried to
Quoted 8 lines
do.
Quoted 1 line
xntbase_bind/unbind seems to be a good solution. I would like to know
from
Quoted 1 line
where I would be able to use these calls (kernel/user space) ?
Kernel space. If you need to relay requests to switch on/off timebase coupling
from userland, then you just need your small RDM driver to do so, via
some
Quoted 18 lines
ioctl
command of your own.Quoted 1 line
What I need is to select the simulation working mode (without the card)
or
Quoted 2 lines
the PCI IRQ mode during the execution of my code (whose exectution is in user space). If I'm working in simulation mode, I also need to specify
the
Quoted 2 lines
tick period at the begining of the execution (1ms or 5ms).
Then you will also need to change the period of the VxWorks timebase on the fly,
usingxntbase_update()when applicable.Quoted 3 lines
Quoted 2 lines
--
Philippe.
Quoted 8 lines
Quoted 4 lines
Matthieu
--
Philippe.
That great. Thank you for all
Matthieu
Quoted 4 lines · Matthieu
Quoted 4 lines
Quoted 1 line
I need a clock to get the time with a 10 µs precision. I tought using
this
Quoted 2 lines
master timebase, as it gives me a time in nanoseconds, irrespective of vxworks timebase.
Quoted 8 lines
Quoted 3 lines
That will work. The master timebase is always active and does return nanoseconds
when inquired.What instruction I use to get this time ?
I tried :#include <
native/timer.h>
#include <nucleus/timebase.h>, but that's not the point.
Quoted 3 lines
xntbase_get_time(&nktbase);But it doesn't work
It ought to work, otherwise nothing would. What's the issue? Unpected result?
Signature · 1 line
Philippe.
Quoted 16 lines · Matthieu
Quoted 14 lines · Philippe Gerum
Quoted 11 lines · Matthieu
Quoted 7 lines
Quoted 1 line
I need a clock to get the time with a 10 µs precision. I tought using
this
Quoted 2 lines
master timebase, as it gives me a time in nanoseconds, irrespective of vxworks timebase.
That will work. The master timebase is always active and does return nanoseconds
when inquired.What instruction I use to get this time ?
I tried :#include <
native/timer.h>#include <
nucleus/timebase.h>, but that's not the point.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
xntbase_get_time(&nktbase);But it doesn't work
It ought to work, otherwise nothing would. What's the issue? Unpected result?
I want to get the actual time at a 10µs precision. I will truncate the result as the master timebase is a nanosecond precision time.
xntbase_get_time(&nktbase) will get you that value. Really. What does not work for you?
Quoted 7 lines
Quoted 2 lines
--
Philippe.Matthieu
Signature · 1 line
Philippe.
Quoted 28 lines · Matthieu
Quoted 27 lines · Philippe Gerum
Quoted 1 line · Matthieu
On Mon, 07 Jul 2008 15:55:33 +0200, Philippe Gerum <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 1 line · Matthieu
Quoted 1 line
Quoted 1 line
I need a clock to get the time with a 10 µs precision. I tought
using
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
this
Quoted 1 line
master timebase, as it gives me a time in nanoseconds, irrespective
of
Quoted 18 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
vxworks timebase.
That will work. The master timebase is always active and does return nanoseconds
when inquired.What instruction I use to get this time ?
I tried :Quoted 8 lines
Quoted 1 line
#include <
native/timer.h>#include <
nucleus/timebase.h>, but that's not the point.Quoted 3 lines
xntbase_get_time(&nktbase);But it doesn't work
It ought to work, otherwise nothing would. What's the issue? Unpected result?
I want to get the actual time at a 10µs precision. I will truncate the result as the master timebase is a nanosecond precision time.
Quoted 8 lines
Quoted 3 lines
xntbase_get_time(&nktbase)will get you that value. Really. What does not work
for you?error: 'nktbase' undeclared (first use in this function)
I include #include <nucleus/timebase.h> but when I look at the source code, I see that I need to be un KERNEL space ??
Of course you do, that's Xenomai nucleus code. You need to return that value from your ioctl.
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
--
Philippe.Matthieu
--
Philippe.Matthieu
Signature · 1 line
Philippe.
Hi,
I would like to know if you finally plan to implement xntbase_bind/unbind ?
Matthieu
Quoted 4 lines · Matthieu
Hi,
I would like to know if you finally plan to implement xntbase_bind/unbind ?
Why?
Quoted 9 lines
Matthieu
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.
Quoted 43 lines · Matthieu
Quoted 6 lines · Philippe Gerum
Quoted 3 lines · Matthieu
Hi,
I would like to know if you finally plan to implement
xntbase_bind/unbind ?
Why?You told in one of your answers :
Normally, solving your issue would require to make the master timebase paced by your PCI card, which would in turn provide the correct timing for the VxWorks timebase (as the timebase doc states, periodic timebases are cascaded from the master aperiodic one). However, doing so would also require to adapt the Xenomai HAL code accordingly, and a PCI hw that is oneshot programmable as well.
If you want to hack the Xenomai timer sub-system in order to only affect the VxWorks timebase, what you actually need is to control the coupling between the master timebase (paced by decrementer) and the slave VxWorks one, so that decrementer ticks may be prevented from kicking the VxWorks timebase. This way, you would be able to call
tickAnnounce()freely to announce any incoming VxWorks tick (i.e. from your PCI handler).In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- calltickAnnounce()from your PCI IRQ handlerWhen paced normally (simulation, "somebody stole by PCI card" mode), just leave the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the VxWorks slave timebase to the master one anew:
- call
xntslave_start(base2slave(wind_tbase), xnarch_get_cpu_time() + period, period); /* period is given in nanoseconds, depends on the master timebase */In any case, you don't need to change the VxWorks tick period. Starting/stopping the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai internals -- we should probably encapsulate this into new xntbase_bind/unbind calls if this does eventually works for you.
Quoted 6 lines
...End of quote.
Well, it works for me. So do you intend to implement xntbase_bind/unbind calls or do I use directly xntslave_start/stop ? Both solutions are ok for me ...
Well, "it works for me" is the kind of feedback I have been waiting for so far. In extenso, my latest reply should read as: "why do you want me to care about xntbase_bind/unbind, since I have no idea of whether my suggestion worked for you or not?".
Now that I do have that information, the answer to your question is yes, likely.
ETA: undefined yet.
Signature · 1 line
Philippe.
Quoted 8 lines · Philippe Gerum
Quoted 3 lines · Matthieu
Hi,
I would like to know if you finally plan to implement
xntbase_bind/unbind ?
Quoted 1 line
Why?
You told in one of your answers :
Normally, solving your issue would require to make the master timebase paced by your PCI card, which would in turn provide the correct timing for the VxWorks timebase (as the timebase doc states, periodic timebases are cascaded from the master aperiodic one). However, doing so would also require to adapt the Xenomai HAL code accordingly, and a PCI hw that is oneshot programmable as well.
If you want to hack the Xenomai timer sub-system in order to only affect the VxWorks timebase, what you actually need is to control the coupling between the master timebase (paced by decrementer) and the slave VxWorks one, so that decrementer ticks may be prevented from kicking the VxWorks timebase. This way, you would be able to call tickAnnounce() freely to announce any incoming VxWorks tick (i.e. from your PCI handler).
In short, when paced by the PCI interrupt, you will need to:
- call xntslave_stop(base2slave(wind_tbase))
- call tickAnnounce() from your PCI IRQ handler
When paced normally (simulation, "somebody stole by PCI card" mode), just leave the burden to the system timer (i.e. ppc decrementer) as usual, by coupling the VxWorks slave timebase to the master one anew:
- call xntslave_start(base2slave(wind_tbase), xnarch_get_cpu_time() + period, period); /* period is given in nanoseconds, depends on the master timebase */
In any case, you don't need to change the VxWorks tick period. Starting/stopping the VxWorks timebase should do the trick. NOTE: this is a hack exposing Xenomai internals -- we should probably encapsulate this into new xntbase_bind/unbind calls if this does eventually works for you.
...End of quote.
Well, it works for me. So do you intend to implement xntbase_bind/unbind calls or do I use directly xntslave_start/stop ? Both solutions are ok for me ...
Quoted 11 lines
Quoted 9 lines
Matthieu
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Quoted 2 lines
--
Philippe.
Matthieu