* [Xenomai-help] Non-Real-Time Asynchronous Notification
@ 2008-03-19 22:05 Robert McCullough
2008-03-20 19:29 ` Jan Kiszka
0 siblings, 1 reply; 9+ messages in thread
From: Robert McCullough @ 2008-03-19 22:05 UTC (permalink / raw)
To: xenomai
Hi,
How do I signal an asynchronous notification from a RTDM real-time task to a
non-real-time user-space Linux thread?
Do I use Non-Real-Time Signaling Services (rtdm_nrtsig_init,..)?
If so, how?
Here is the current code that I am trying to port to RTDM.
Current driver code to signal non-real-time Linux thread:
// If event
if(event){
// and signal asynchronous readers
if (kmdpr_device->async_queue)
kill_fasync(&kmdpr_device->async_queue, SIGIO,
POLL_IN);
}
Current non-real-time Linux thread signal hander:
// A static function to use for callback by OS
static void signal_handler_func(int signo)
{
l_sighandler->signalHandler(signo);
}
void Kmss::startSignalHandler()
{
l_sighandler = this;
struct sigaction action;
memset(&action, 0, sizeof(action));
action.sa_handler = signal_handler_func;
action.sa_flags = 0;//SA_RESTART;
sigaction(SIGIO, &action, NULL);
fcntl(_fh, F_SETOWN, getpid());
fcntl(_fh, F_SETFL, fcntl(_fh, F_GETFL) | FASYNC);
}
void Kmss::signalHandler(int signo)
{
kmdpr_events_t events;
if (signo==SIGIO)
{
/* Process events */
}
}
Best regards,
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-03-19 22:05 [Xenomai-help] Non-Real-Time Asynchronous Notification Robert McCullough
@ 2008-03-20 19:29 ` Jan Kiszka
2008-03-21 14:57 ` Robert McCullough
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2008-03-20 19:29 UTC (permalink / raw)
To: rob; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 669 bytes --]
Robert McCullough wrote:
> Hi,
>
> How do I signal an asynchronous notification from a RTDM real-time task to a
> non-real-time user-space Linux thread?
> Do I use Non-Real-Time Signaling Services (rtdm_nrtsig_init,..)?
> If so, how?
>
> Here is the current code that I am trying to port to RTDM.
>
> Current driver code to signal non-real-time Linux thread:
>
> // If event
> if(event){
> // and signal asynchronous readers
> if (kmdpr_device->async_queue)
> kill_fasync(&kmdpr_device->async_queue, SIGIO,
> POLL_IN);
> }
Just push this code in the rtdm_nrtsig handler and trigger the handler
execution from RT context.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-03-20 19:29 ` Jan Kiszka
@ 2008-03-21 14:57 ` Robert McCullough
2008-03-21 20:09 ` Jan Kiszka
0 siblings, 1 reply; 9+ messages in thread
From: Robert McCullough @ 2008-03-21 14:57 UTC (permalink / raw)
To: jan.kiszka; +Cc: xenomai
Hi Jan,
--> -----Original Message-----
--> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> Sent: Thursday, March 20, 2008 3:29 PM
--> To: rob@domain.hid
--> Cc: xenomai@xenomai.org
--> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
-->
--> Robert McCullough wrote:
--> > Hi,
--> >
--> > How do I signal an asynchronous notification from a RTDM real-time
--> task to a
--> > non-real-time user-space Linux thread?
--> > Do I use Non-Real-Time Signaling Services (rtdm_nrtsig_init,..)?
--> > If so, how?
--> >
--> > Here is the current code that I am trying to port to RTDM.
--> >
--> > Current driver code to signal non-real-time Linux thread:
--> >
--> > // If event
--> > if(event){
--> > // and signal asynchronous readers
--> > if (kmdpr_device->async_queue)
--> > kill_fasync(&kmdpr_device->async_queue,
SIGIO,
--> > POLL_IN);
--> > }
-->
--> Just push this code in the rtdm_nrtsig handler and trigger the handler
--> execution from RT context.
-->
--> Jan
[Robert McCullough]
Ok, I understand that but how do I specify the file operation fasync in my
rtdm_device? How do I replace or update the code marked TODO?
Here is a snippet of my current RTDM.
/* TODO replace fasync with Xenomai counterpart */
int kmdpr_fasync(int fd, struct file *filp, int mode)
{
kmdpr_context_t *ctx = filp->private_data;
return fasync_helper(fd, filp, mode, &ctx->async_queue);
}
static int kmdpr_close (struct rtdm_dev_context *context,
rtdm_user_info_t *
user_info)
{
kmdpr_context_t *ctx; /* device context information */
PRODEBUG(MODULE_NAME, "Close: kmdpr\n");
/* TODO replace fasync with Xenomai counterpart */
// remove this filp from the asynchronously notified filp's
// kmdpr_fasync(-1, filp, 0);
ctx = (kmdpr_context_t *)context->dev_private;
/*
* Shut Down KMDPR port
*/
shutdown(ctx);
return 0;
}
/**
* This structure describe the kmdpr RTDM device
*
*/
static struct rtdm_device kmdpr_device = {
struct_version: RTDM_DEVICE_STRUCT_VER,
device_flags: RTDM_NAMED_DEVICE,
context_size: sizeof(kmdpr_context_t),
device_name: DEVICE_NAME,
open_rt: kmdpr_open,
open_nrt: kmdpr_open,
ops: {
close_rt: kmdpr_close,
close_nrt: kmdpr_close,
ioctl_rt: kmdpr_ioctl,
ioctl_nrt: kmdpr_ioctl,
read_rt: NULL,
read_nrt: NULL,
write_rt: NULL,
write_nrt: NULL,
/* TODO replace fasync with Xenomai counterpart
fasync_rt: NULL,
fasync_nrt: kmdpr_fasync,
*/
},
device_class: RTDM_CLASS_KMDPR,
device_sub_class: RTDM_SUBCLASS_GENERIC,
profile_version: 1,
driver_name: MODULE_NAME,
driver_version: RTDM_DRIVER_VER(MODULE_MAJOR_VER,
MODULE_MINOR_VER,
MODULE_BUGFIX_VER),
peripheral_name: MODULE_DESC,
provider_name: "Promess Incorporated",
proc_name: kmdpr_device.device_name,
};
Thanks,
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-03-21 14:57 ` Robert McCullough
@ 2008-03-21 20:09 ` Jan Kiszka
2008-03-31 15:22 ` Robert McCullough
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2008-03-21 20:09 UTC (permalink / raw)
To: rob; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]
Robert McCullough wrote:
> Hi Jan,
>
> --> -----Original Message-----
> --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> Sent: Thursday, March 20, 2008 3:29 PM
> --> To: rob@domain.hid
> --> Cc: xenomai@xenomai.org
> --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
> -->
> --> Robert McCullough wrote:
> --> > Hi,
> --> >
> --> > How do I signal an asynchronous notification from a RTDM real-time
> --> task to a
> --> > non-real-time user-space Linux thread?
> --> > Do I use Non-Real-Time Signaling Services (rtdm_nrtsig_init,..)?
> --> > If so, how?
> --> >
> --> > Here is the current code that I am trying to port to RTDM.
> --> >
> --> > Current driver code to signal non-real-time Linux thread:
> --> >
> --> > // If event
> --> > if(event){
> --> > // and signal asynchronous readers
> --> > if (kmdpr_device->async_queue)
> --> > kill_fasync(&kmdpr_device->async_queue,
> SIGIO,
> --> > POLL_IN);
> --> > }
> -->
> --> Just push this code in the rtdm_nrtsig handler and trigger the handler
> --> execution from RT context.
> -->
> --> Jan
>
> [Robert McCullough]
> Ok, I understand that but how do I specify the file operation fasync in my
> rtdm_device? How do I replace or update the code marked TODO?
In fact, there is no fasync support available with RTDM, specifically as
using signals under real-time constraints is a bad idea (not only
because Xenomai has no hard-RT signal support).
But before suggesting any alternative pattern: What does your
application actually require to work? How does asynchronous
driver/application interaction currently look like?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-03-21 20:09 ` Jan Kiszka
@ 2008-03-31 15:22 ` Robert McCullough
2008-04-01 23:07 ` Jan Kiszka
0 siblings, 1 reply; 9+ messages in thread
From: Robert McCullough @ 2008-03-31 15:22 UTC (permalink / raw)
To: jan.kiszka; +Cc: xenomai
Hi Jan,
--> -----Original Message-----
--> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> Sent: Friday, March 21, 2008 4:10 PM
--> To: rob@domain.hid
--> Cc: xenomai@xenomai.org
--> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
-->
--> Robert McCullough wrote:
--> > Hi Jan,
--> >
--> > --> -----Original Message-----
--> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> > --> Sent: Thursday, March 20, 2008 3:29 PM
--> > --> To: rob@domain.hid
--> > --> Cc: xenomai@xenomai.org
--> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
--> Notification
--> > -->
--> > --> Robert McCullough wrote:
--> > --> > Hi,
--> > --> >
--> > --> > How do I signal an asynchronous notification from a RTDM
--> real-time
--> > --> task to a
--> > --> > non-real-time user-space Linux thread?
--> > --> > Do I use Non-Real-Time Signaling Services
--> (rtdm_nrtsig_init,..)?
--> > --> > If so, how?
--> > --> >
--> > --> > Here is the current code that I am trying to port to RTDM.
--> > --> >
--> > --> > Current driver code to signal non-real-time Linux thread:
--> > --> >
--> > --> > // If event
--> > --> > if(event){
--> > --> > // and signal asynchronous readers
--> > --> > if (kmdpr_device->async_queue)
--> > --> >
kill_fasync(&kmdpr_device->async_queue,
--> > SIGIO,
--> > --> > POLL_IN);
--> > --> > }
--> > -->
--> > --> Just push this code in the rtdm_nrtsig handler and trigger the
--> handler
--> > --> execution from RT context.
--> > -->
--> > --> Jan
--> >
--> > [Robert McCullough]
--> > Ok, I understand that but how do I specify the file operation fasync
--> in my
--> > rtdm_device? How do I replace or update the code marked TODO?
-->
--> In fact, there is no fasync support available with RTDM, specifically
--> as
--> using signals under real-time constraints is a bad idea (not only
--> because Xenomai has no hard-RT signal support).
-->
--> But before suggesting any alternative pattern: What does your
--> application actually require to work? How does asynchronous
--> driver/application interaction currently look like?
-->
--> Jan
[Robert McCullough]
Here is a little background on how my driver works.
The driver is the interface/control for an AC servo drive which controls an
AC motor. The interface to the drive is done through a dual-ported RAM.
The I/O from the servo drive is updated and an IRQ is triggered from the
servo drive through the DP RAM to our MPC5200 at a 4 kHz rate. In my IRQ
handler I read, process, and update the I/O in the RAM. Some of the data
from the servo drive contains status bits that represent asynchronous
events/faults from the drive that needs to be passed up to the user
application. In my current non-real-time driver I used fasync to send a
SIGIO signal to the user application whenever one of these events/faults
changed and then the application would read the status bits with an ioctl
call and process them.
I hope this clarifies the requirements a little.
How would you suggest I solve this in my RTDM driver?
Best regards,
Robert McCullough
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-03-31 15:22 ` Robert McCullough
@ 2008-04-01 23:07 ` Jan Kiszka
2008-04-02 13:29 ` Robert McCullough
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2008-04-01 23:07 UTC (permalink / raw)
To: rob; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 3864 bytes --]
Robert McCullough wrote:
> Hi Jan,
>
> --> -----Original Message-----
> --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> Sent: Friday, March 21, 2008 4:10 PM
> --> To: rob@domain.hid
> --> Cc: xenomai@xenomai.org
> --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
> -->
> --> Robert McCullough wrote:
> --> > Hi Jan,
> --> >
> --> > --> -----Original Message-----
> --> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> > --> Sent: Thursday, March 20, 2008 3:29 PM
> --> > --> To: rob@domain.hid
> --> > --> Cc: xenomai@xenomai.org
> --> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
> --> Notification
> --> > -->
> --> > --> Robert McCullough wrote:
> --> > --> > Hi,
> --> > --> >
> --> > --> > How do I signal an asynchronous notification from a RTDM
> --> real-time
> --> > --> task to a
> --> > --> > non-real-time user-space Linux thread?
> --> > --> > Do I use Non-Real-Time Signaling Services
> --> (rtdm_nrtsig_init,..)?
> --> > --> > If so, how?
> --> > --> >
> --> > --> > Here is the current code that I am trying to port to RTDM.
> --> > --> >
> --> > --> > Current driver code to signal non-real-time Linux thread:
> --> > --> >
> --> > --> > // If event
> --> > --> > if(event){
> --> > --> > // and signal asynchronous readers
> --> > --> > if (kmdpr_device->async_queue)
> --> > --> >
> kill_fasync(&kmdpr_device->async_queue,
> --> > SIGIO,
> --> > --> > POLL_IN);
> --> > --> > }
> --> > -->
> --> > --> Just push this code in the rtdm_nrtsig handler and trigger the
> --> handler
> --> > --> execution from RT context.
> --> > -->
> --> > --> Jan
> --> >
> --> > [Robert McCullough]
> --> > Ok, I understand that but how do I specify the file operation fasync
> --> in my
> --> > rtdm_device? How do I replace or update the code marked TODO?
> -->
> --> In fact, there is no fasync support available with RTDM, specifically
> --> as
> --> using signals under real-time constraints is a bad idea (not only
> --> because Xenomai has no hard-RT signal support).
> -->
> --> But before suggesting any alternative pattern: What does your
> --> application actually require to work? How does asynchronous
> --> driver/application interaction currently look like?
> -->
> --> Jan
>
> [Robert McCullough]
> Here is a little background on how my driver works.
> The driver is the interface/control for an AC servo drive which controls an
> AC motor. The interface to the drive is done through a dual-ported RAM.
> The I/O from the servo drive is updated and an IRQ is triggered from the
> servo drive through the DP RAM to our MPC5200 at a 4 kHz rate. In my IRQ
> handler I read, process, and update the I/O in the RAM. Some of the data
> from the servo drive contains status bits that represent asynchronous
> events/faults from the drive that needs to be passed up to the user
> application. In my current non-real-time driver I used fasync to send a
> SIGIO signal to the user application whenever one of these events/faults
> changed and then the application would read the status bits with an ioctl
> call and process them.
>
> I hope this clarifies the requirements a little.
> How would you suggest I solve this in my RTDM driver?
Well, a classic pattern is to encapsulate the async event handling in
one or more dedicated threads that block-wait on those events. Check the
RTDM profile for serial devices for such a channel. This has the
advantage that you can cleanly specify the handling priority,
specifically compared to "normal" operations.
HTH,
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-04-01 23:07 ` Jan Kiszka
@ 2008-04-02 13:29 ` Robert McCullough
2008-04-05 15:41 ` Jan Kiszka
0 siblings, 1 reply; 9+ messages in thread
From: Robert McCullough @ 2008-04-02 13:29 UTC (permalink / raw)
To: jan.kiszka; +Cc: xenomai
Hi Jan,
--> -----Original Message-----
--> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> Sent: Tuesday, April 01, 2008 7:07 PM
--> To: rob@domain.hid
--> Cc: xenomai@xenomai.org
--> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
-->
--> Robert McCullough wrote:
--> > Hi Jan,
--> >
--> > --> -----Original Message-----
--> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> > --> Sent: Friday, March 21, 2008 4:10 PM
--> > --> To: rob@domain.hid
--> > --> Cc: xenomai@xenomai.org
--> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
--> Notification
--> > -->
--> > --> Robert McCullough wrote:
--> > --> > Hi Jan,
--> > --> >
--> > --> > --> -----Original Message-----
--> > --> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> > --> > --> Sent: Thursday, March 20, 2008 3:29 PM
--> > --> > --> To: rob@domain.hid
--> > --> > --> Cc: xenomai@xenomai.org
--> > --> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
--> > --> Notification
--> > --> > -->
--> > --> > --> Robert McCullough wrote:
--> > --> > --> > Hi,
--> > --> > --> >
--> > --> > --> > How do I signal an asynchronous notification from a
--> RTDM
--> > --> real-time
--> > --> > --> task to a
--> > --> > --> > non-real-time user-space Linux thread?
--> > --> > --> > Do I use Non-Real-Time Signaling Services
--> > --> (rtdm_nrtsig_init,..)?
--> > --> > --> > If so, how?
--> > --> > --> >
--> > --> > --> > Here is the current code that I am trying to port to
--> RTDM.
--> > --> > --> >
--> > --> > --> > Current driver code to signal non-real-time Linux
--> thread:
--> > --> > --> >
--> > --> > --> > // If event
--> > --> > --> > if(event){
--> > --> > --> > // and signal asynchronous readers
--> > --> > --> > if (kmdpr_device->async_queue)
--> > --> > --> >
--> > kill_fasync(&kmdpr_device->async_queue,
--> > --> > SIGIO,
--> > --> > --> > POLL_IN);
--> > --> > --> > }
--> > --> > -->
--> > --> > --> Just push this code in the rtdm_nrtsig handler and
--> trigger the
--> > --> handler
--> > --> > --> execution from RT context.
--> > --> > -->
--> > --> > --> Jan
--> > --> >
--> > --> > [Robert McCullough]
--> > --> > Ok, I understand that but how do I specify the file
--> operation fasync
--> > --> in my
--> > --> > rtdm_device? How do I replace or update the code marked
--> TODO?
--> > -->
--> > --> In fact, there is no fasync support available with RTDM,
--> specifically
--> > --> as
--> > --> using signals under real-time constraints is a bad idea (not
--> only
--> > --> because Xenomai has no hard-RT signal support).
--> > -->
--> > --> But before suggesting any alternative pattern: What does your
--> > --> application actually require to work? How does asynchronous
--> > --> driver/application interaction currently look like?
--> > -->
--> > --> Jan
--> >
--> > [Robert McCullough]
--> > Here is a little background on how my driver works.
--> > The driver is the interface/control for an AC servo drive which
--> controls an
--> > AC motor. The interface to the drive is done through a dual-ported
--> RAM.
--> > The I/O from the servo drive is updated and an IRQ is triggered from
--> the
--> > servo drive through the DP RAM to our MPC5200 at a 4 kHz rate. In
--> my IRQ
--> > handler I read, process, and update the I/O in the RAM. Some of the
--> data
--> > from the servo drive contains status bits that represent
--> asynchronous
--> > events/faults from the drive that needs to be passed up to the user
--> > application. In my current non-real-time driver I used fasync to
--> send a
--> > SIGIO signal to the user application whenever one of these
--> events/faults
--> > changed and then the application would read the status bits with an
--> ioctl
--> > call and process them.
--> >
--> > I hope this clarifies the requirements a little.
--> > How would you suggest I solve this in my RTDM driver?
-->
--> Well, a classic pattern is to encapsulate the async event handling in
--> one or more dedicated threads that block-wait on those events. Check
--> the
--> RTDM profile for serial devices for such a channel. This has the
--> advantage that you can cleanly specify the handling priority,
--> specifically compared to "normal" operations.
-->
--> HTH,
--> Jan
[Robert McCullough]
Are you referring to the RTSER_RTIOC_WAIT_EVENT in the serial profile?
If so, this can only be called from a real-time user-space task.
I need to see the event in a non-real-time user-space task.
How would I do this?
Best regards,
Robert McCullough
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-04-02 13:29 ` Robert McCullough
@ 2008-04-05 15:41 ` Jan Kiszka
2008-04-09 18:31 ` Robert McCullough
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2008-04-05 15:41 UTC (permalink / raw)
To: rob; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 5594 bytes --]
Robert McCullough wrote:
> Hi Jan,
>
> --> -----Original Message-----
> --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> Sent: Tuesday, April 01, 2008 7:07 PM
> --> To: rob@domain.hid
> --> Cc: xenomai@xenomai.org
> --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
> -->
> --> Robert McCullough wrote:
> --> > Hi Jan,
> --> >
> --> > --> -----Original Message-----
> --> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> > --> Sent: Friday, March 21, 2008 4:10 PM
> --> > --> To: rob@domain.hid
> --> > --> Cc: xenomai@xenomai.org
> --> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
> --> Notification
> --> > -->
> --> > --> Robert McCullough wrote:
> --> > --> > Hi Jan,
> --> > --> >
> --> > --> > --> -----Original Message-----
> --> > --> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
> --> > --> > --> Sent: Thursday, March 20, 2008 3:29 PM
> --> > --> > --> To: rob@domain.hid
> --> > --> > --> Cc: xenomai@xenomai.org
> --> > --> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
> --> > --> Notification
> --> > --> > -->
> --> > --> > --> Robert McCullough wrote:
> --> > --> > --> > Hi,
> --> > --> > --> >
> --> > --> > --> > How do I signal an asynchronous notification from a
> --> RTDM
> --> > --> real-time
> --> > --> > --> task to a
> --> > --> > --> > non-real-time user-space Linux thread?
> --> > --> > --> > Do I use Non-Real-Time Signaling Services
> --> > --> (rtdm_nrtsig_init,..)?
> --> > --> > --> > If so, how?
> --> > --> > --> >
> --> > --> > --> > Here is the current code that I am trying to port to
> --> RTDM.
> --> > --> > --> >
> --> > --> > --> > Current driver code to signal non-real-time Linux
> --> thread:
> --> > --> > --> >
> --> > --> > --> > // If event
> --> > --> > --> > if(event){
> --> > --> > --> > // and signal asynchronous readers
> --> > --> > --> > if (kmdpr_device->async_queue)
> --> > --> > --> >
> --> > kill_fasync(&kmdpr_device->async_queue,
> --> > --> > SIGIO,
> --> > --> > --> > POLL_IN);
> --> > --> > --> > }
> --> > --> > -->
> --> > --> > --> Just push this code in the rtdm_nrtsig handler and
> --> trigger the
> --> > --> handler
> --> > --> > --> execution from RT context.
> --> > --> > -->
> --> > --> > --> Jan
> --> > --> >
> --> > --> > [Robert McCullough]
> --> > --> > Ok, I understand that but how do I specify the file
> --> operation fasync
> --> > --> in my
> --> > --> > rtdm_device? How do I replace or update the code marked
> --> TODO?
> --> > -->
> --> > --> In fact, there is no fasync support available with RTDM,
> --> specifically
> --> > --> as
> --> > --> using signals under real-time constraints is a bad idea (not
> --> only
> --> > --> because Xenomai has no hard-RT signal support).
> --> > -->
> --> > --> But before suggesting any alternative pattern: What does your
> --> > --> application actually require to work? How does asynchronous
> --> > --> driver/application interaction currently look like?
> --> > -->
> --> > --> Jan
> --> >
> --> > [Robert McCullough]
> --> > Here is a little background on how my driver works.
> --> > The driver is the interface/control for an AC servo drive which
> --> controls an
> --> > AC motor. The interface to the drive is done through a dual-ported
> --> RAM.
> --> > The I/O from the servo drive is updated and an IRQ is triggered from
> --> the
> --> > servo drive through the DP RAM to our MPC5200 at a 4 kHz rate. In
> --> my IRQ
> --> > handler I read, process, and update the I/O in the RAM. Some of the
> --> data
> --> > from the servo drive contains status bits that represent
> --> asynchronous
> --> > events/faults from the drive that needs to be passed up to the user
> --> > application. In my current non-real-time driver I used fasync to
> --> send a
> --> > SIGIO signal to the user application whenever one of these
> --> events/faults
> --> > changed and then the application would read the status bits with an
> --> ioctl
> --> > call and process them.
> --> >
> --> > I hope this clarifies the requirements a little.
> --> > How would you suggest I solve this in my RTDM driver?
> -->
> --> Well, a classic pattern is to encapsulate the async event handling in
> --> one or more dedicated threads that block-wait on those events. Check
> --> the
> --> RTDM profile for serial devices for such a channel. This has the
> --> advantage that you can cleanly specify the handling priority,
> --> specifically compared to "normal" operations.
> -->
> --> HTH,
> --> Jan
>
> [Robert McCullough]
> Are you referring to the RTSER_RTIOC_WAIT_EVENT in the serial profile?
> If so, this can only be called from a real-time user-space task.
> I need to see the event in a non-real-time user-space task.
> How would I do this?
Then you can simply built the signaling on top of Linux mechanisms that
are triggered from the RT domain via a rtdm_nrtsig. You can hook the
non-RT API into the RTDM device by using *_nrt handlers (e.g. ioctl_nrt).
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
2008-04-05 15:41 ` Jan Kiszka
@ 2008-04-09 18:31 ` Robert McCullough
0 siblings, 0 replies; 9+ messages in thread
From: Robert McCullough @ 2008-04-09 18:31 UTC (permalink / raw)
To: jan.kiszka; +Cc: xenomai
Hi Jan,
--> -----Original Message-----
--> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> Sent: Saturday, April 05, 2008 11:42 AM
--> To: rob@domain.hid
--> Cc: xenomai@xenomai.org
--> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous Notification
-->
--> Robert McCullough wrote:
--> > Hi Jan,
--> >
--> > --> -----Original Message-----
--> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> > --> Sent: Tuesday, April 01, 2008 7:07 PM
--> > --> To: rob@domain.hid
--> > --> Cc: xenomai@xenomai.org
--> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
--> Notification
--> > -->
--> > --> Robert McCullough wrote:
--> > --> > Hi Jan,
--> > --> >
--> > --> > --> -----Original Message-----
--> > --> > --> From: jan.kiszka@domain.hid [mailto:jan.kiszka@domain.hid]
--> > --> > --> Sent: Friday, March 21, 2008 4:10 PM
--> > --> > --> To: rob@domain.hid
--> > --> > --> Cc: xenomai@xenomai.org
--> > --> > --> Subject: Re: [Xenomai-help] Non-Real-Time Asynchronous
--> > --> Notification
--> > --> > -->
--> > --> > --> Robert McCullough wrote:
--> > --> > --> > Hi Jan,
--> > --> > --> >
--> > --> > --> > --> -----Original Message-----
--> > --> > --> > --> From: jan.kiszka@domain.hid
--> [mailto:jan.kiszka@domain.hid]
--> > --> > --> > --> Sent: Thursday, March 20, 2008 3:29 PM
--> > --> > --> > --> To: rob@domain.hid
--> > --> > --> > --> Cc: xenomai@xenomai.org
--> > --> > --> > --> Subject: Re: [Xenomai-help] Non-Real-Time
--> Asynchronous
--> > --> > --> Notification
--> > --> > --> > -->
--> > --> > --> > --> Robert McCullough wrote:
--> > --> > --> > --> > Hi,
--> > --> > --> > --> >
--> > --> > --> > --> > How do I signal an asynchronous notification
--> from a
--> > --> RTDM
--> > --> > --> real-time
--> > --> > --> > --> task to a
--> > --> > --> > --> > non-real-time user-space Linux thread?
--> > --> > --> > --> > Do I use Non-Real-Time Signaling Services
--> > --> > --> (rtdm_nrtsig_init,..)?
--> > --> > --> > --> > If so, how?
--> > --> > --> > --> >
--> > --> > --> > --> > Here is the current code that I am trying to
--> port to
--> > --> RTDM.
--> > --> > --> > --> >
--> > --> > --> > --> > Current driver code to signal non-real-time
--> Linux
--> > --> thread:
--> > --> > --> > --> >
--> > --> > --> > --> > // If event
--> > --> > --> > --> > if(event){
--> > --> > --> > --> > // and signal asynchronous
readers
--> > --> > --> > --> > if
(kmdpr_device->async_queue)
--> > --> > --> > --> >
--> > --> > kill_fasync(&kmdpr_device->async_queue,
--> > --> > --> > SIGIO,
--> > --> > --> > --> > POLL_IN);
--> > --> > --> > --> > }
--> > --> > --> > -->
--> > --> > --> > --> Just push this code in the rtdm_nrtsig handler
--> and
--> > --> trigger the
--> > --> > --> handler
--> > --> > --> > --> execution from RT context.
--> > --> > --> > -->
--> > --> > --> > --> Jan
--> > --> > --> >
--> > --> > --> > [Robert McCullough]
--> > --> > --> > Ok, I understand that but how do I specify the file
--> > --> operation fasync
--> > --> > --> in my
--> > --> > --> > rtdm_device? How do I replace or update the code
--> marked
--> > --> TODO?
--> > --> > -->
--> > --> > --> In fact, there is no fasync support available with
--> RTDM,
--> > --> specifically
--> > --> > --> as
--> > --> > --> using signals under real-time constraints is a bad
--> idea (not
--> > --> only
--> > --> > --> because Xenomai has no hard-RT signal support).
--> > --> > -->
--> > --> > --> But before suggesting any alternative pattern: What
--> does your
--> > --> > --> application actually require to work? How does
--> asynchronous
--> > --> > --> driver/application interaction currently look like?
--> > --> > -->
--> > --> > --> Jan
--> > --> >
--> > --> > [Robert McCullough]
--> > --> > Here is a little background on how my driver works.
--> > --> > The driver is the interface/control for an AC servo drive
--> which
--> > --> controls an
--> > --> > AC motor. The interface to the drive is done through a
--> dual-ported
--> > --> RAM.
--> > --> > The I/O from the servo drive is updated and an IRQ is
--> triggered from
--> > --> the
--> > --> > servo drive through the DP RAM to our MPC5200 at a 4 kHz
--> rate. In
--> > --> my IRQ
--> > --> > handler I read, process, and update the I/O in the RAM.
--> Some of the
--> > --> data
--> > --> > from the servo drive contains status bits that represent
--> > --> asynchronous
--> > --> > events/faults from the drive that needs to be passed up to
--> the user
--> > --> > application. In my current non-real-time driver I used
--> fasync to
--> > --> send a
--> > --> > SIGIO signal to the user application whenever one of these
--> > --> events/faults
--> > --> > changed and then the application would read the status bits
--> with an
--> > --> ioctl
--> > --> > call and process them.
--> > --> >
--> > --> > I hope this clarifies the requirements a little.
--> > --> > How would you suggest I solve this in my RTDM driver?
--> > -->
--> > --> Well, a classic pattern is to encapsulate the async event
--> handling in
--> > --> one or more dedicated threads that block-wait on those events.
--> Check
--> > --> the
--> > --> RTDM profile for serial devices for such a channel. This has
--> the
--> > --> advantage that you can cleanly specify the handling priority,
--> > --> specifically compared to "normal" operations.
--> > -->
--> > --> HTH,
--> > --> Jan
--> >
--> > [Robert McCullough]
--> > Are you referring to the RTSER_RTIOC_WAIT_EVENT in the serial
--> profile?
--> > If so, this can only be called from a real-time user-space task.
--> > I need to see the event in a non-real-time user-space task.
--> > How would I do this?
-->
--> Then you can simply built the signaling on top of Linux mechanisms
--> that
--> are triggered from the RT domain via a rtdm_nrtsig. You can hook the
--> non-RT API into the RTDM device by using *_nrt handlers (e.g.
--> ioctl_nrt).
-->
--> Jan
[Robert McCullough]
Thanks for your help. I solved my problem using a dedicated user real-time
task that calls an ioctl and block-wait on the event similar to the
RTSER_RTIOC_WAIT_EVENT in the serial profile that you suggested. Then when
the event occurs the task unblocks and sends a Linux signal to my
non-real-time user thread. The Linux signal causes a switch to secondary
mode which is understandable and acceptable.
Best regards,
Robert McCullough
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-04-09 18:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19 22:05 [Xenomai-help] Non-Real-Time Asynchronous Notification Robert McCullough
2008-03-20 19:29 ` Jan Kiszka
2008-03-21 14:57 ` Robert McCullough
2008-03-21 20:09 ` Jan Kiszka
2008-03-31 15:22 ` Robert McCullough
2008-04-01 23:07 ` Jan Kiszka
2008-04-02 13:29 ` Robert McCullough
2008-04-05 15:41 ` Jan Kiszka
2008-04-09 18:31 ` Robert McCullough
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.