* [Xenomai-help] USB task
@ 2010-08-26 16:59 John Wojnaroski
2010-08-26 17:11 ` Gilles Chanteperdrix
0 siblings, 1 reply; 2+ messages in thread
From: John Wojnaroski @ 2010-08-26 16:59 UTC (permalink / raw)
To: xenomai
Hi,
I'm writing a task to control an A2D conversion chip via a USB port. The
task will run at 100Hz to convert and read up to 8 channels with a setup
time of 10us between channels. Using a usb_control_msg(....) to control
and talk to the chip(s) in user space.
here is the real time task wrapper that calls the 3 modules
void smc_task( void *cookie) {
rt_task_set_periodic(NULL, TM_NOW, smc_period_ns);
while (!end) {
rt_task_wait_period(NULL); // 100Hz
p_rtMCP->Polling(); // this calls the pUSB->Scan() method
pFltCtrls->Scan();
pSMC->Execute();
}
}
can the task be treated as "atomic" in that all three modules will run
to completion in order without being prempted? or would signals need
blocking as in
/* Block signals to make transaction atomic */
memset( &set, 0xFF, sizeof(sigset_t) );
sigprocmask(SIG_BLOCK, &set, &oldset);
or would this make matters worse. ATM the task is up and running and
*seems* to be working and am assuming the pUSB->Scan() is dropping into
kernel space to communicate via the USB port.
If it is not violating some basic rules and tenets of rt programming
with Xenomai would be happy to leave it as is....
Any thoughts, comments, critiques much appreciated
John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Xenomai-help] USB task
2010-08-26 16:59 [Xenomai-help] USB task John Wojnaroski
@ 2010-08-26 17:11 ` Gilles Chanteperdrix
0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2010-08-26 17:11 UTC (permalink / raw)
To: John Wojnaroski; +Cc: xenomai
John Wojnaroski wrote:
> Hi,
>
> I'm writing a task to control an A2D conversion chip via a USB port. The
> task will run at 100Hz to convert and read up to 8 channels with a setup
> time of 10us between channels. Using a usb_control_msg(....) to control
> and talk to the chip(s) in user space.
>
> here is the real time task wrapper that calls the 3 modules
>
> void smc_task( void *cookie) {
> rt_task_set_periodic(NULL, TM_NOW, smc_period_ns);
> while (!end) {
> rt_task_wait_period(NULL); // 100Hz
> p_rtMCP->Polling(); // this calls the pUSB->Scan() method
> pFltCtrls->Scan();
> pSMC->Execute();
> }
> }
>
> can the task be treated as "atomic" in that all three modules will run
> to completion in order without being prempted? or would signals need
> blocking as in
>
> /* Block signals to make transaction atomic */
> memset( &set, 0xFF, sizeof(sigset_t) );
> sigprocmask(SIG_BLOCK, &set, &oldset);
Xenomai itself only sends signals to tasks in rare conditions (namely,
if you ask for some debug features, such as the T_WARNSW bit, or arm the
watchdog). But if you are running under gdb, or if you send a SIGTERM to
the process, Linux may send a signal, and you may want it to handle it
gracefully. And again, this would be exceptional conditions.
--
Gilles.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-26 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-26 16:59 [Xenomai-help] USB task John Wojnaroski
2010-08-26 17:11 ` Gilles Chanteperdrix
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.