Migrating device drivers from RTLinux to Xenomai/Analogy
Hi,
I am wondering if any Xenomai users or admins/contributors can give me an idea of the scale of a project I am thinking of undertaking.
My university has PCs running RTLinux (on RedHat if I remember correctly) with custom-made data acquisition (DAQ) boards which are used to control some equipment and record back data in laboratory experiments for electrical engineering students. Now, those PCs are very old and failing regularly, and as I understand RTLinux has been effectively discontinued, so they want to replace them with something else.
They have found Xenomai as an attractive option, and I have been asked to write drivers for the DAQ boards (the boards connect as PCI cards).
As I understand, I would have to use Analogy to implement the drivers for real-time operation, however what is missing obviously is the actual device driver Analogy will talk to. Analogy as I can see comes with a bunch of drivers for commercial DAQ boards (from NI and so on), but I need to have my own since it is a custom board.
I have code for the DAQ board drivers (written in C) from RTLinux. Now I am familiar with driver basics but am no expert. The code seems straightforward enough.
How much of an effort would it be to port said drivers to Xenomai/Analogy, approximately? Is this relatively straightforward, or does it require writing from scratch?
Thanks a lot for any guidance on this issue.
Cheers,
Andrija Stupar
University of Toronto
Quoted 1 line · On 11/25/2016 11:03 PM, [email protected] wrote:
How much of an effort would it be to port said drivers to Xenomai/Analogy, approximately? Is this relatively straightforward, or does it require writing from scratch?
Hi Andrija
It really depends on the quality of the linux driver that you are trying to port and the RTLinux services that you depend on. Can your driver run on a vanilla kernel? Maybe you could post your driver to github and we can then try to give you a ballpark estimate.
jorge
Hi Jorge,
Thanks for your reply. I have posted the driver on github:
https://github.com/AndrijaPFC/RTDAQDriver/blob/master/acromag.c
That's the only .c file. Here is the full repo., with all the header files:
https://github.com/AndrijaPFC/RTDAQDriver
I don't know if I can run it on a vanilla kernel, I haven't tried. I am looking at the system header files, and they don't seem to point to anything unusual in the .c file itself, except possibly for rtl_debug.h (which from searching for it online, I cannot determine whether it is something which comes with a vanilla kernel or not).
Another clue may be in the header file
https://github.com/AndrijaPFC/RTDAQDriver/blob/master/rtce_module.h
which itself invokes system header files rtl.h, rtl_sched.h and rtl_time.h which seem to like RT-Linux specific things...or no?
Thanks a lot again,
Andrija Stupar
Quoted 17 lines · Jorge Ramirez
Quoted 1 line · On 11/25/2016 11:03 PM, [email protected] wrote:
How much of an effort would it be to port said drivers to Xenomai/Analogy, approximately? Is this relatively straightforward, or does it require writing from scratch?
Hi Andrija
It really depends on the quality of the linux driver that you are trying to port and the RTLinux services that you depend on. Can your driver run on a vanilla kernel?
Maybe you could post your driver to github and we can then try to give you a ballpark estimate.jorge
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai
Quoted 2 lines · On Mon, 28 Nov 2016 14:34:03 -0500 [email protected] wrote:
Thanks for your reply. I have posted the driver on github:
https://github.com/AndrijaPFC/RTDAQDriver/blob/master/acromag.c
Had a quick scan of the code, and have a couple of observations.
The Linux kernel has seen quite a few changes since the 2.4 days. The makefiles for starters. There are also builtin functions for downloading fpga binary blobs from disk so you no longer have to hard code them in to the module - I'm assuming the missing fpga_prog.h contains the binary blob.
The PCI interface has changed and there are also routines to handle Industry Pack modules - It may be worth your while contacting Acromag and asking them what support they can offer. You may even find drivers exist in the latest kernel for your IP modules - These could be used as a reference or modified to suit you application.
Regards, Paul.
Quoted 13 lines · Paul
Quoted 2 lines · On Mon, 28 Nov 2016 14:34:03 -0500 [email protected] wrote:
Thanks for your reply. I have posted the driver on github:
https://github.com/AndrijaPFC/RTDAQDriver/blob/master/acromag.cHad a quick scan of the code, and have a couple of observations.
The Linux kernel has seen quite a few changes since the 2.4 days. The makefiles for starters. There are also builtin functions for downloading fpga binary blobs from disk so you no longer have to hard code them in to the module - I'm assuming the missing
fpga_prog.hcontains the binary blob.
Quoted 5 lines
The PCI interface has changed and there are also routines to handle Industry Pack modules - It may be worth your while contacting Acromag and asking them what support they can offer. You may even find drivers exist in the latest kernel for your IP modules - These could be used as a reference or modified to suit you application.
The effort to get this driver under Xenomai seems trivial (a little bit longer if you want to bring it under the Analogy stack, maybe a couple of weeks).
You should consider throwing away the code and writing it from scratch avoiding some of the terrible hacks they have crafted around some platform issues (usleep causing segmentation faults?)
Quoted 4 lines
Regards, Paul.
Hi Paul and Jorge,
Thanks for your input, it's much appreciated.
Regards,
Andrija