On 10/13/2016 12:24 PM, Erik Friesen wrote:
> To clarify my question, I am trying to understand at what level lcnc
> accesses hardware peripherals.  For example, suppose I build a board with
> an spi dac peripheral to the arm, as well as write the kernel driver, if
> necessary.  What type of glue do I need to provide in this situation?

LinuxCNC interfaces with hardware peripherals through HAL, the Hardware 
Abstraction Layer.  Each hardware peripheral is represented by a HAL 
"component".  A HAL component is a piece of software that talks to its 
hardware and presents HAL pins to the rest of LinuxCNC.  A HAL component 
is thus a kind of device driver.  It talks to LinuxCNC via HAL pins, and 
talks to its hardware in whatever way is appropriate for that hardware.

Each HAL component runs either in "realtime" context, or "non-realtime". 
  Since you're talking about motion control and 4 kHz update rates, you 
want a realtime component.  Realtime components run in realtime threads, 
that's the "addf" stuff you see in .hal files.

Here's a diagram that shows the LinuxCNC architecture:


Your component would sit down in the bottom left, in the "realtime 
hardware devices" box.

Realtime components can be written in C or in a domain-specific language 
called "comp".  Take a look at src/hal/drivers/hal_speaker.c and 
src/hal/drivers/serport.comp for some simple examples.

Some info on how to get started hacking on LinuxCNC are in these documents:


Feel free to ask follow-on questions if any of this is not clear.

Sebastian Kuzminsky

Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Emc-users mailing list

Reply via email to