August 23, 2015
"RingBuffer" is the new name for the BioSemi library that was formerly called "Labview_DLL". The new name was chosen to remove any inference that the library comes from or, is dependent on, the National Instruments "LabVIEW" product.
This software contains no kernel mode routines and runs entirely in user mode.
The BioSemi Mac software is distributed here in both prebuilt binary form - for Intel MAC OSX 10.10 (Yosemite) and later - and with a Makefile so that it can be rebuild to run with updated components.
The low level software needed to access the USB sample stream generated by the BioSemi acquisition hardware consists of 2 libraries:
Prebuild binary files are located in the "OSX32" and "OSX64" subdirectories. The first set of instructions below give the steps required to use these pre-built binary files, see Install.
If these binary files don't work, try rebuilding them from the available source, see Rebuilding the binary files.
The choice should be determined by the bit-width of the acquisition application you intend to run. The "file" command can be used to determine a program's bit-width.
Warning: don't install both 64 bit and 32 bit software in the same login session. The install procedure appends to paths defined in the environment. Serially appending both 64 and 32 bit items to the same environment variables will cause confusion.
The directories contains these binary files:
export DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH
./RingBuffer_SyncTest 0to start the test program. Use CTRL-C to stop the test. See the RingBuffer_SyncTest Usage section below for more information about this program.
If you get this message:
dyld: Library not loaded: libRingBuffer.0.0.1.dylib Referenced from: /Users/ ... /RingBuffer_SyncTest Reason: image not foundthis usually means that the DYLD_LIBRARY_PATH is not set correctly.
A more permanent arrangement for the libRingBuffer and libusb shared libraries is to put them in /usr/local/lib. This removes the need to have to repeatedly setup the DYLD_LIBRARY_PATH environment variable to be able to find these shared libraries.
Once this test program works, follow the instructions in Try Client/Server if you want to try the client/server mode of operation.
Some performance improvement may be gained by using the library parameters explained at Tuning.
This program checks that the 0xffffff00 sync words appear in all the right places in the input stream. It stops with a message if they don't.
There can be 3 command line parameters for this program:
Hitting CTRL-C when the program is running will stop the run.
To rebuild the binary files Apple's program development package "Xcode Tools" must be installed. This package can be downloaded through the internet from the App Store.
Then perform the following steps to build first the libusb-1.0 library and then the RingBuffer library. In these instructions the bash shell is assumed.
. ./compile_libusb.sh
export DYLD_LIBRARY_PATH=$LIBUSB_PREFIX/lib:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATHAs well, the location of the "libusb" shared library must be declared - as in step 4 above. If you just performed this step then this has been taken care of. Otherwise, use
export DYLD_LIBRARY_PATH=`pwd`/lib:$DYLD_LIBRARY_PATHPlug the Biosemi Receiver's USB cable into the computer and type
./RingBuffer_SyncTest 0to start the test program. Use CTRL-C to stop the test. See the RingBuffer_SyncTest Usage section for more about this program.
dyld: Library not loaded: libRingBuffer.0.0.1.dylib Referenced from: /Users/ ... /RingBuffer_SyncTest Reason: image not foundthis usually means that the DYLD_LIBRARY_PATH is not set correctly.
To develop your own acquisition program using the RingBuffer library, see RingBufferLibrary-API for a description of the API's available.
The distributed software was compiled and tested in both 32 and 64 bit modes using an Intel based MAC running OSX 10.10.5 (Yosemite). The Xcode compiler on this system is version 6.4.
LabVIEW for OSX requires user Call Libraries be in a framework. National Instruments' latest instructions for creating such a framework are given at:
http://digital.ni.com/public.nsf/allkb/A6A6371FE0EA333B86257015005E3400
These instructions are reproduced below:
1. Open Xcode. 2. Select File » New Project. 3. Select the Framework & Library » Cocoa Framework template. Note: LabVIEW supports the use of Frameworks that use the Carbon API, and does not support Frameworks that use the Cocoa API. However, since the Carbon Framework template has been deprecated in current versions of Xcode, you can use the Cocoa Framework template to start the project. Again, Frameworks called by LabVIEW should not call the Cocoa API on Mac OS X. LabVIEW does not use Cocoa, and therefore does not initialize this API. Using this API inside Frameworks may result in unpredictable behavior. 4. Name the framework when prompted (e.g. MyFramework). Click Next. 5. Specify the location of the project on disk. Click Create. 6. Make sure that the project is set to build a 32-bit or 32/64-bit Universal Framework. LabVIEW for Mac OS X cannot load 64-bit frameworks. Within the Project Navigator select the Project item in the tree (e.g. MyFramework), select the Project in the Settings area, and select the Build Settings tab. Make sure that the selected build architecture is 32-bit or standard (32/64-bit Intel).
For our purpose, use this variation to these instructions:
bsif.h bsif_inject_socket_samples.o bsif_libusb.o bsif_socket_io.o bsif_tap_usb_samples.o ringbuffer.cpp ringbuffer.h
libusb-1.0.0.dylib
Outside of Xcode, copy the newly created framework to the directory where you intend to use it. Rename it at this stage if necessary.
Do this to make the framework portable so it can be used on other similar computers
(replace the 32's with 64's if building a 64 bit version):
otool -L BioSemiRingBuffer32
install_name_tool -change /Users/XXX/lib/libusb-1.0.0.dylib @loader_path/Resources/libusb-1.0.0.dylib BioSemiRingBuffer32
otool -L BioSemiRingBuffer32