I'm happy to announce that the integration of Charles' work on Usermode PCI 
drivers, and John's major RTAPI restructuring to cater for various RT OS and 
thread styles is complete and ready for wider scrutiny:

http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/rtos-integration-preview3
 (v2.5-based)
http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/rtos-integration-preview3-merged-into-master
 (rolled into master)

This should build as-is on RTAI, Xenomai, RT-PREEMPT and vanilla kernels, on 
PC's running i386 and x86_64 kernels, the Raspberry and the Beaglebone ARM 
boards; very likely with minimal effort on other platforms since no assembly 
code dependencies remain.


To show that it's not just bits in a repo but actually moves something: here's 
my mill driven by xenomai/master/5i20, configuration unchanged from RTAI:

http://www.youtube.com/watch?v=gm39Ab-7JTU&feature=youtu.be


Building
--------
first:
sudo apt-get install libudev-dev

In case you want to build in a separate directory, here are the git steps:
mkdir emc2-test
cd emc2-test
git init
git fetch git://git.mah.priv.at/emc2-dev.git 
rtos-integration-preview3:refs/remotes/origin/rtos-integration-preview3
git checkout rtos-integration-preview3
cd src
sh autogen.sh
./configure

The ARM platforms need 

./configure --with-platform=beaglebone
./configure --with-platform=raspberry

make
sudo make setuid

Build and runtests is ok on all platforms and thread styles (barring me 
overlooked a combination). The userland PCI support requires libudev-dev, 
configure will tell you so if it is missing.

The ARM builds are able to run Axis over a remote X display (NB: I did not say 
'with usable performance').

The userland PCI support is now selected automatically if a userland thread 
style is used, and the platform is PC. 

PC: this addresses Mesa cards only at that point; non-Mesanet PCI drivers will 
need adaptation to work with this support code. There were a few PCI drivers (I 
think hal_vti and hal_evoreg) being worked on by I think Michael Büsch but that 
work seems incomplete; I would think the best way is to back out these changes 
and look at how Charles adapted hm2. Also hm2_7i43 is currently missing.

Parport-based configurations should run unchanged - please block loading of the 
'lp' module.

The Raspberry build includes a simple hal_gpio driver which has room for 
improvement.

The beaglebone build currently no hardware drivers - porting hal_gpio should be 
straightforward though. The most interesting aspect of this platform is the 
ability to use the builtin 'programmable realtime units' for highspeed 
functions like stepgen or encode. See the arm335x-hal-pru-module information 
below.

Charles on usermode PCI support:
--------------------------------

The usermode PCI code uses sysfs to talk to the hardware, which
support all required features for existing LinuxCNC drivers (no
interrupt or DMA support necessary).

To modify an existing LinuxCNC kernel driver, start by adding:

#include config_module.h

...at the top of your code and changing any <linux/include.h> includes
to use the RTAPI_INC_* defines available in config_module.h.  See the
mesa-hostmot2 hal/drivers/ directory for examples.

If you're lucky (and the driver uses a subset of the hostmot2's kernel
requirements) that's all you'll need to do.  If you need additional
functionality, take a look in rtapi/userpci and rtapi_pci.h and see
about extending the code to add the feature(s) you need.


The RTAPI code has seen some massive restructuring as the duplication and 
reimplementation of features for various flavors became unmanageable:

John on the RTAPI restructuring:
--------------------------------

At this point, LinuxCNC supports four RT thread system options (plus the
non-RT 'posix' option, formerly called 'sim').  These options have been
added over time, one-by-one, by copying the source files from an
existing thread system and tweaking to implement the new thread system.
In addition, there are a great number of parallels between the RTAPI
and ULAPI code.  The result was many copies of the same boilerplate code.

This restructuring merges generic boilerplate into function-specific
generic files in src/rtapi/rtapi_*.c.  Where possible, RTAPI and ULAPI
code is folded together.

Thread system-specific code is removed into a single .c and .h file for
each system, e.g. rtai-kernel.[ch].  Common points in the generic code
call 'hook' functions implemented in the thread-specific files.  The
hook functions do things like start threads in rtapi_task_start_hook(),
and are named after their calling functions in rtapi.h, like
rtapi_task_start().

The intended benefits:

- Improvements and bug fixes found in one thread system will propagate
to all thread systems, if applicable

- The learning curve for future implementers of new thread systems will
be a smaller hurdle with better organization of the rtapi functions and
more clear division between generic and thread-specific code

- Thousands of lines of repeated boiler plate code eliminated; useful
diagnostics and comments formerly scattered among thread systems now in
one place; no more variable and function definitions in .h files (well,
there might be a few places I (John) missed).

Next steps:
-----------

Please try this out and report back on the list. Both changesets are signifcant 
and we'd appreciate code reviews as well.
Also, we would be particularly interested in reports about Mesanet cards beyond 
5i20 and 5i25, and any progress on non-Mesanet PCI drivers.

The question whether to merge this into v2.5_branch or master is still open - 
please form an opinion before I deliver on mine ;)


Kernels to try:
---------------
Please see 
http://www.mail-archive.com/[email protected]/msg07851.html 
Xenomai and RT-PREEMPT kernel debian packages for x86/PC can be found here: 
http://static.mah.priv.at/public/xenomai-debs/
Repos for DIY: http://git.mah.priv.at/gitweb/linuxcnc-kernel.git  and 
http://git.mah.priv.at/gitweb/xenomai-linuxcnc.git for Xenomai userland support.
For xenomai on the raspberry see 
http://powet.eu/2012/07/25/raspberry-pi-xenomai/ .
For xenomai on the beaglebone, contact me privately for now.


Related work:
--------------
AM335x PRU examples: this branch has been rebase ontop of 
rtos-integration-preview3 and is a starting point for determined beaglebone 
hackers: 
http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/arm335x-hal-pru-module


I would like to thank all patient testers, in particular Kent and Anders, for 
bravely facing the bleeding edge; also Peter for great support.


- Michael




------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to