What kind of system is this?While the <html><rtapi_xxx.h></html> headers provide the portability APIs required by most realtime components, sometimes it's necessary to make decisions based on the details of the system. Here are some checks that you may find it useful to perform. Preprocessor checks* Building "realtime" code? defined(RTAPI) ** APIs specified as "realtime only" (e.g., rtapi_parport_get) are available * Building "userspace" code? defined(ULAPI) ** Not all RTAPI APIs available * Building on a Linux operating system? defined(__linux__) * Building this code in kernel space? defined(__KERNEL__) Runtime checks* Realtime resides in kernelspace? rtapi_is_kernelspace() * Underlying OS provides realtime guarantees? rtapi_is_realtime() |
"uspace" is desirable because it allows LinuxCNC to work with a kernel shipped by Debian, and enables new hardware interfaces such as ethernet (mesa 7i80).
The work was mostly done by JeffEpler, with help from a variety of the usual suspects. Some code is adapted from "unified-build-candidate-3", an ancestor branch of the machinekit project.
Because of the way the machinekit project's git history was structured, it is not possible to merge just their userspace rtapi implementation. That is why JeffEpler chose to make a fresh implementation instead.
Hardware access | ||||||
Name | in version.. | Kernelspace | Realtime guarantee | PCI | ISA | Ethernet |
rtai | all linuxcnc | Y | Y | Y | Y | N |
sim | 2.6 and earlier | N | N | N | N | Y |
uspace | master branch | N | Y | Y | no memory-mapped | Y |
unified | machinekit | N | Y | Y | no memory-mapped | Y |
All testing to date has been done on Debian 7 "Wheezy" with the 3.2.0-rt-amd64 and 3.2.0-rt-686-pae kernels. Ubuntu used to offer -rt kernels, but no longer appears to do so.
./configure --with-realtime=uspace make sudo make setuidIf you do not "sudo make setuid", then linuxcnc runs without realtime guarantees and without access to hardware. If you run "sudo make setuid", then linuxcnc runs with access to hardware. If you run "sudo make setuid", and run with a RT-PREEMPT kernel, then linuxcnc runs with access to hardware and with realtime guarantees.
The other PCI drivers will need adaptation to the hostmot2-style PCI driver registration before they work.
Other EPP drivers should only require a small amount of work to adapt. (except that's only pluto, which is likely to be removed during the 2.7 development cycle)
ISA drivers are probably not worth tinkering with. Any which use memory-mapped I/Os? would require additional API work.
$ sudo env RTAPI_UID=`id -n` gdb rtapi_app ... # set breakpoints or whatever (gdb) runThen in another terminal, interact with halcmd (not halrun):
$ halcmd -f testfile.hal ... $ halcmd stop $ halcmd unload allThere's probably a slightly more irritating sequence that can be used to debug rtapi_app when running linuxcnc instead of halcmd, but in the case that you need to debug motion remember that you can also just skip "sudo make setuid" and use a sim-only configuration.