Must I provide both rt function and nrt function for the ops of rtdm driver ?
jan.kiszka at siemens.com
Thu Apr 16 10:52:07 CEST 2020
On 16.04.20 09:49, 孙世龙 via Xenomai wrote:
> Must I provide both rt function and nrt function for the ops of
> rtdm driver ?
> Must I implement the rt read and nrt read operation if i need
> provide read operation for my rtdm driver?What I have to consider?
> I have searched all over the source code of xenomai-v3.1.I find
> that most rtdm driver have both rt_ioctl and nrt_ioctl ,but none
> nrt_read\nrt_write function is implemented except the driver named analogy.
A driver need not implement both handlers. If it leaves one
unimplemented (NULL), the RTDM core will switch the caller to the mode
where there is an implementation.
Normally, an RTDM driver has no use in provided a non-RT-only version of
its read/write handlers. Therefore it only provides the _rt variant.
The situation is different for ioctls, though, because there can be many
subservices (IOCTL codes) behind that single handler. Some of those may
be used for initialization and require to call plain Linux function
(like vmalloc). Therefore, they implement both handlers and decide
whether to take a specific IOCTL code after dispatching - or direct it
to the "other side" by returning -ENOSYS. That should be described in
the RTDM section of our documentation.
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
More information about the Xenomai