Low Level Software API

Zihan Chen edited this page Sep 3, 2013 · 4 revisions

Low-Level Software API

The low-level software API is in the Software/lib directory. There are two main classes:

  • FirewirePort: this defines a "port manager" for a particular Firewire port
  • AmpIO: this defines the data layout for an amplifier board (e.g., the QLA)

The basic idea is that all Firewire I/O should be performed via the FirewirePort object. This avoids issues due to multi-threading. Up to 16 amplifier boards can be created, as instances of AmpIO, and then added to the FirewirePort object.

For maximum efficiency (lowest latency), it is best to combine all information into a single read or write command over the Firewire (the overhead for each Firewire transaction is about 30 microseconds). These block read and block write commands are issued by the FirewirePort object, via the ReadAllBoards and WriteAllBoards methods, respectively.

This API depends on the Linux libraw1394 library, though for real-time performance considerations RT-Firewire is an alternative of interest.

A typical use of the library is as follows (see also the qladisp test program (qladisp.cpp)):

FirewirePort Port(0);
AmpIO Board(5);
while (1) {
  std::cout << "Encoder0 = " << Board.GetEncoderPosition(0) << std::endl;
  // ...

Go to the NEXT section (Example Program) or return to the INDEX