[Jack-Devel] [PATCH 01/16] Added the beginnings of the iio driver to the codebase. The IIO driver compiles using the C++ preprocessor. The driver requires more code, but in this version the it compiles and the beginnings of Added the beginnings of the functions driver_initialize, iio_driver_bufsize are in place. Also the autotools system is setup to compile IIO if the pre-requisites are present. Added prerequisite checking for the IIO driver and the generation of drivers/iio/Makefile to configure.ac. Also added the iio subdirectory directive to drivers/Makefile.am Added the drivers/iio subdirectory and required code.

PrevNext  Index
DateFri, 14 Feb 2014 08:18:26 +1100
From Matt Flax <[hidden] at flatmax dot org>
To[hidden] at lists dot jackaudio dot org
In-Reply-ToMatt Flax [Jack-Devel] [PATCH 00/16] IIO driver for jack1
---
 AUTHORS                  |   3 +
 codeBlocks/jack1.cbp     | 362 +++++++++++++++++++++++++++++++++++++++++++++++
 codeBlocks/jack1.layout  | 174 +++++++++++++++++++++++
 configure.ac             |  30 ++++
 drivers/Makefile.am      |  10 +-
 drivers/iio/Makefile.am  |  15 ++
 drivers/iio/iio_driver.C | 192 +++++++++++++++++++++++++
 drivers/iio/iio_driver.h |  66 +++++++++
 8 files changed, 850 insertions(+), 2 deletions(-)
 create mode 100644 codeBlocks/jack1.cbp
 create mode 100644 codeBlocks/jack1.layout
 create mode 100644 drivers/iio/Makefile.am
 create mode 100644 drivers/iio/iio_driver.C
 create mode 100644 drivers/iio/iio_driver.h

diff --git a/AUTHORS b/AUTHORS
index be46a20..848472a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -92,5 +92,8 @@ Marc-Olivier Barre
 Torben Hohn
        wrote netjack, implemented mixed 64/32 bit support and bug fixes.
 
+Matt Flax <flatmax@>
+    implemented the IIO driver for Jack.
+
 Many others have contributed patches and/or test results, and we thank
 them all.
diff --git a/codeBlocks/jack1.cbp b/codeBlocks/jack1.cbp
new file mode 100644
index 0000000..5f799df
--- /dev/null
+++ b/codeBlocks/jack1.cbp
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="jack1" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Debug">
+				<Option output="bin/Debug/jack1" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Debug/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-g" />
+				</Compiler>
+			</Target>
+			<Target title="Release">
+				<Option output="bin/Release/jack1" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Unit filename="../AUTHORS" />
+		<Unit filename="../Makefile.am" />
+		<Unit filename="../README" />
+		<Unit filename="../README.developers" />
+		<Unit filename="../acinclude.m4" />
+		<Unit filename="../autogen.sh" />
+		<Unit filename="../config/Makefile.am" />
+		<Unit filename="../config/cpu/Makefile.am" />
+		<Unit filename="../config/cpu/alpha/Makefile.am" />
+		<Unit filename="../config/cpu/alpha/atomicity.h" />
+		<Unit filename="../config/cpu/alpha/cycles.h" />
+		<Unit filename="../config/cpu/cris/Makefile.am" />
+		<Unit filename="../config/cpu/cris/atomicity.h" />
+		<Unit filename="../config/cpu/generic/Makefile.am" />
+		<Unit filename="../config/cpu/generic/atomicity.h" />
+		<Unit filename="../config/cpu/generic/cycles.h" />
+		<Unit filename="../config/cpu/i386/Makefile.am" />
+		<Unit filename="../config/cpu/i386/atomicity.h" />
+		<Unit filename="../config/cpu/i386/cycles.h" />
+		<Unit filename="../config/cpu/i486/Makefile.am" />
+		<Unit filename="../config/cpu/i486/cycles.h" />
+		<Unit filename="../config/cpu/ia64/Makefile.am" />
+		<Unit filename="../config/cpu/ia64/atomicity.h" />
+		<Unit filename="../config/cpu/ia64/cycles.h" />
+		<Unit filename="../config/cpu/ia64/ia64intrin.h" />
+		<Unit filename="../config/cpu/m68k/Makefile.am" />
+		<Unit filename="../config/cpu/m68k/atomicity.h" />
+		<Unit filename="../config/cpu/mips/Makefile.am" />
+		<Unit filename="../config/cpu/mips/atomicity.h" />
+		<Unit filename="../config/cpu/powerpc/Makefile.am" />
+		<Unit filename="../config/cpu/powerpc/atomicity.h" />
+		<Unit filename="../config/cpu/powerpc/cycles.h" />
+		<Unit filename="../config/cpu/s390/Makefile.am" />
+		<Unit filename="../config/cpu/s390/atomicity.h" />
+		<Unit filename="../config/os/Makefile.am" />
+		<Unit filename="../config/os/generic/Makefile.am" />
+		<Unit filename="../config/os/generic/ipc.h" />
+		<Unit filename="../config/os/generic/poll.h" />
+		<Unit filename="../config/os/generic/sanitycheck.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/generic/time.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/generic/time.h" />
+		<Unit filename="../config/os/gnu-linux/Makefile.am" />
+		<Unit filename="../config/os/gnu-linux/sanitycheck.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/gnu-linux/systemtest.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/gnu-linux/time.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/gnu-linux/time.h" />
+		<Unit filename="../config/os/macosx/JACK_LOCATION.h" />
+		<Unit filename="../config/os/macosx/Makefile.am" />
+		<Unit filename="../config/os/macosx/README" />
+		<Unit filename="../config/os/macosx/getopt.h" />
+		<Unit filename="../config/os/macosx/ipc.h" />
+		<Unit filename="../config/os/macosx/mach_port.h" />
+		<Unit filename="../config/os/macosx/pThreadUtilities.h" />
+		<Unit filename="../config/os/macosx/poll.h" />
+		<Unit filename="../config/os/macosx/sanitycheck.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/macosx/time.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/os/macosx/time.h" />
+		<Unit filename="../config/sysdeps/Makefile.am" />
+		<Unit filename="../config/sysdeps/atomicity.h" />
+		<Unit filename="../config/sysdeps/cycles.h" />
+		<Unit filename="../config/sysdeps/getopt.h" />
+		<Unit filename="../config/sysdeps/ipc.h" />
+		<Unit filename="../config/sysdeps/mach_port.h" />
+		<Unit filename="../config/sysdeps/pThreadUtilities.h" />
+		<Unit filename="../config/sysdeps/poll.h" />
+		<Unit filename="../config/sysdeps/portaudio.h" />
+		<Unit filename="../config/sysdeps/sanitycheck.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/sysdeps/systemtest.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/sysdeps/time.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../config/sysdeps/time.h" />
+		<Unit filename="../configure.ac" />
+		<Unit filename="../drivers/Makefile.am" />
+		<Unit filename="../drivers/alsa/Makefile.am" />
+		<Unit filename="../drivers/alsa/alsa_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/alsa_driver.h" />
+		<Unit filename="../drivers/alsa/generic.h" />
+		<Unit filename="../drivers/alsa/generic_hw.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/hammerfall.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/hammerfall.h" />
+		<Unit filename="../drivers/alsa/hdsp.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/hdsp.h" />
+		<Unit filename="../drivers/alsa/ice1712.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/ice1712.h" />
+		<Unit filename="../drivers/alsa/memops.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/usx2y.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa/usx2y.h" />
+		<Unit filename="../drivers/alsa_midi/Makefile.am" />
+		<Unit filename="../drivers/alsa_midi/a2j.h" />
+		<Unit filename="../drivers/alsa_midi/alsa_midi.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/alsa_midi_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/list.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/list.h" />
+		<Unit filename="../drivers/alsa_midi/midi_pack.h" />
+		<Unit filename="../drivers/alsa_midi/midi_unpack.h" />
+		<Unit filename="../drivers/alsa_midi/port.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/port.h" />
+		<Unit filename="../drivers/alsa_midi/port_hash.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/port_hash.h" />
+		<Unit filename="../drivers/alsa_midi/port_thread.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/alsa_midi/port_thread.h" />
+		<Unit filename="../drivers/am/Makefile.am" />
+		<Unit filename="../drivers/am/alsa_midi.h" />
+		<Unit filename="../drivers/am/alsa_midi_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/am/alsa_rawmidi.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/am/alsa_seqmidi.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/am/midi_pack.h" />
+		<Unit filename="../drivers/am/midi_unpack.h" />
+		<Unit filename="../drivers/coreaudio/Makefile.am" />
+		<Unit filename="../drivers/coreaudio/coreaudio_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/coreaudio/coreaudio_driver.h" />
+		<Unit filename="../drivers/dummy/Makefile.am" />
+		<Unit filename="../drivers/dummy/dummy_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/dummy/dummy_driver.h" />
+		<Unit filename="../drivers/firewire/Makefile.am" />
+		<Unit filename="../drivers/firewire/ffado_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/firewire/ffado_driver.h" />
+		<Unit filename="../drivers/freebob/Makefile.am" />
+		<Unit filename="../drivers/freebob/freebob_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/freebob/freebob_driver.h" />
+		<Unit filename="../drivers/iio/Makefile.am" />
+		<Unit filename="../drivers/iio/iio_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/iio/iio_driver.h" />
+		<Unit filename="../drivers/netjack/Makefile.am" />
+		<Unit filename="../drivers/netjack/README" />
+		<Unit filename="../drivers/netjack/net_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/netjack/net_driver.h" />
+		<Unit filename="../drivers/netjack/netjack.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/netjack/netjack.h" />
+		<Unit filename="../drivers/netjack/netjack_packet.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/netjack/netjack_packet.h" />
+		<Unit filename="../drivers/oss/Makefile.am" />
+		<Unit filename="../drivers/oss/oss_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/oss/oss_driver.h" />
+		<Unit filename="../drivers/portaudio/Makefile.am" />
+		<Unit filename="../drivers/portaudio/portaudio_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/portaudio/portaudio_driver.h" />
+		<Unit filename="../drivers/sun/Makefile.am" />
+		<Unit filename="../drivers/sun/sun_driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../drivers/sun/sun_driver.h" />
+		<Unit filename="../include/Makefile.am" />
+		<Unit filename="../include/atomicity.h" />
+		<Unit filename="../include/bitset.h" />
+		<Unit filename="../include/driver.h" />
+		<Unit filename="../include/driver_interface.h" />
+		<Unit filename="../include/driver_parse.h" />
+		<Unit filename="../include/engine.h" />
+		<Unit filename="../include/hardware.h" />
+		<Unit filename="../include/internal.h" />
+		<Unit filename="../include/intsimd.h" />
+		<Unit filename="../include/memops.h" />
+		<Unit filename="../include/messagebuffer.h" />
+		<Unit filename="../include/pool.h" />
+		<Unit filename="../include/port.h" />
+		<Unit filename="../include/sanitycheck.h" />
+		<Unit filename="../include/shm.h" />
+		<Unit filename="../include/start.h" />
+		<Unit filename="../include/systemtest.h" />
+		<Unit filename="../include/unlock.h" />
+		<Unit filename="../include/varargs.h" />
+		<Unit filename="../include/version.h.in" />
+		<Unit filename="../jack.pc.in" />
+		<Unit filename="../jack.spec.in" />
+		<Unit filename="../jackd/ChangeLog" />
+		<Unit filename="../jackd/Makefile.am" />
+		<Unit filename="../jackd/clientengine.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/clientengine.h" />
+		<Unit filename="../jackd/controlapi.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/engine.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/jackd.1.in" />
+		<Unit filename="../jackd/jackd.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/jackstart.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/md5.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/md5.h" />
+		<Unit filename="../jackd/md5_loc.h" />
+		<Unit filename="../jackd/transengine.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../jackd/transengine.h" />
+		<Unit filename="../libjack/ChangeLog" />
+		<Unit filename="../libjack/Makefile.am" />
+		<Unit filename="../libjack/client.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/driver.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/intclient.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/local.h" />
+		<Unit filename="../libjack/messagebuffer.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/metadata.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/midiport.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/pool.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/port.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/ringbuffer.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/sanitycheck.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/shm.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/simd.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/systemtest.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/thread.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/time.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/transclient.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/unlock.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../libjack/uuid.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../python/Makefile.am" />
+		<Extensions>
+			<envvars />
+			<code_completion />
+			<debugger />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>
diff --git a/codeBlocks/jack1.layout b/codeBlocks/jack1.layout
new file mode 100644
index 0000000..b1fd9cc
--- /dev/null
+++ b/codeBlocks/jack1.layout
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_layout_file>
+	<ActiveTarget name="Debug" />
+	<File name="../config/os/macosx/README" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="5518" topLine="135" />
+		</Cursor>
+	</File>
+	<File name="../drivers/coreaudio/coreaudio_driver.c" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="21968" topLine="579" />
+		</Cursor>
+	</File>
+	<File name="../include/driver.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="9697" topLine="252" />
+		</Cursor>
+	</File>
+	<File name="../libjack/thread.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="6722" topLine="268" />
+		</Cursor>
+	</File>
+	<File name="../drivers/sun/sun_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="0" topLine="32" />
+		</Cursor>
+	</File>
+	<File name="../include/engine.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="1373" topLine="40" />
+		</Cursor>
+	</File>
+	<File name="../drivers/sun/Makefile.am" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="246" topLine="0" />
+		</Cursor>
+	</File>
+	<File name="../drivers/iio/iio_driver.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="4431" topLine="93" />
+		</Cursor>
+	</File>
+	<File name="../jackd/engine.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="64641" topLine="2403" />
+		</Cursor>
+	</File>
+	<File name="../drivers/portaudio/portaudio_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="0" topLine="30" />
+		</Cursor>
+	</File>
+	<File name="../jackd/jackd.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="19263" topLine="728" />
+		</Cursor>
+	</File>
+	<File name="../drivers/am/alsa_seqmidi.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="15067" topLine="601" />
+		</Cursor>
+	</File>
+	<File name="../drivers/alsa_midi/alsa_midi.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="18572" topLine="644" />
+		</Cursor>
+	</File>
+	<File name="../drivers/firewire/ffado_driver.c" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="26116" topLine="765" />
+		</Cursor>
+	</File>
+	<File name="../config/cpu/alpha/atomicity.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="2222" topLine="33" />
+		</Cursor>
+	</File>
+	<File name="../drivers/iio/iio_driver.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="1385" topLine="23" />
+		</Cursor>
+	</File>
+	<File name="../README" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="118" topLine="0" />
+		</Cursor>
+	</File>
+	<File name="../configure.ac" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="6664" topLine="208" />
+		</Cursor>
+	</File>
+	<File name="../libjack/port.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="15137" topLine="574" />
+		</Cursor>
+	</File>
+	<File name="../drivers/sun/sun_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="33274" topLine="447" />
+		</Cursor>
+	</File>
+	<File name="../include/port.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="5953" topLine="148" />
+		</Cursor>
+	</File>
+	<File name="../README.developers" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="4198" topLine="110" />
+		</Cursor>
+	</File>
+	<File name="../drivers/freebob/freebob_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="29992" topLine="1037" />
+		</Cursor>
+	</File>
+	<File name="../drivers/dummy/dummy_driver.c" open="1" top="1" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="11059" topLine="367" />
+		</Cursor>
+	</File>
+	<File name="../drivers/alsa/hammerfall.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="7560" topLine="262" />
+		</Cursor>
+	</File>
+	<File name="../config/cpu/ia64/ia64intrin.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="172" topLine="0" />
+		</Cursor>
+	</File>
+	<File name="../libjack/driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="3008" topLine="90" />
+		</Cursor>
+	</File>
+	<File name="../drivers/portaudio/portaudio_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="1626" topLine="24" />
+		</Cursor>
+	</File>
+	<File name="../drivers/alsa/alsa_driver.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="57783" topLine="2122" />
+		</Cursor>
+	</File>
+	<File name="../drivers/oss/oss_driver.c" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="17712" topLine="444" />
+		</Cursor>
+	</File>
+	<File name="../drivers/alsa_midi/a2j.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="2337" topLine="56" />
+		</Cursor>
+	</File>
+	<File name="../drivers/am/alsa_rawmidi.c" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="7736" topLine="334" />
+		</Cursor>
+	</File>
+	<File name="../AUTHORS" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="2313" topLine="53" />
+		</Cursor>
+	</File>
+	<File name="../drivers/dummy/dummy_driver.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="1252" topLine="21" />
+		</Cursor>
+	</File>
+</CodeBlocks_layout_file>
diff --git a/configure.ac b/configure.ac
index f2ed759..7b10e2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -777,6 +777,34 @@ then
 fi
 AM_CONDITIONAL(HAVE_PA, $HAVE_PA)
 
+AC_ARG_ENABLE(iio, AC_HELP_STRING([--disable-iio],[ignore IIO driver ]),
+			TRY_IIO=$enableval , TRY_IIO=yes )
+HAVE_IIO="false"
+if test "x$TRY_IIO" = "xyes"
+then
+AC_LANG_PUSH(C++)
+	# check for gtkIOStream package
+	PKG_CHECK_MODULES(GTKIOSTREAM, gtkIOStream >= 1.4.0,
+	     [HAVE_IIO="true"
+              JACK_DEFAULT_DRIVER=\"iio\"
+	     ], AC_MSG_RESULT([no]))
+
+	AC_SUBST([GTKIOSTREAM_CFLAGS])
+	AC_SUBST([GTKIOSTREAM_LIBS])
+
+	PKG_CHECK_MODULES(EIGEN, eigen3 >= 3.0.0,
+	     [HAVE_IIO="true"
+              JACK_DEFAULT_DRIVER=\"iio\"
+	     ], [HAVE_IIO="false"
+              AC_MSG_RESULT([no])] )
+    AC_SUBST(EIGEN_CFLAGS)
+    AC_SUBST(EIGEN_LIBS)
+AC_LANG_POP(C++)
+
+fi
+#AM_CONDITIONAL(HAVE_GTKIOSTREAM,$HAVE_GTKIOSTREAM)
+AM_CONDITIONAL(HAVE_IIO,$HAVE_IIO)
+
 AC_ARG_ENABLE(coreaudio, AC_HELP_STRING([--disable-coreaudio], [ignore CoreAudio driver]),
 			TRY_COREAUDIO=$enableval , TRY_COREAUDIO=yes )
 HAVE_COREAUDIO="false"
@@ -951,6 +979,7 @@ drivers/coreaudio/Makefile
 drivers/freebob/Makefile
 drivers/firewire/Makefile
 drivers/netjack/Makefile
+drivers/iio/Makefile
 example-clients/Makefile
 tools/Makefile
 tools/zalsa/Makefile
@@ -974,6 +1003,7 @@ echo $PACKAGE $VERSION :
 echo
 echo \| Build with ALSA support............................... : $HAVE_ALSA
 echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
+echo \| Build with IIO \(Industrial IO\) support................ : $HAVE_IIO
 echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
 echo \| Build with OSS support................................ : $HAVE_OSS
 echo \| Build with Sun audio support.......................... : $HAVE_SUN
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
index b159b19..074f743 100644
--- a/drivers/Makefile.am
+++ b/drivers/Makefile.am
@@ -48,5 +48,11 @@ else
 FIREWIRE_DIR =
 endif
 
-SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR) netjack
-DIST_SUBDIRS = alsa alsa_midi dummy oss sun portaudio coreaudio freebob firewire netjack
+if HAVE_IIO
+IIO_DIR = iio
+else
+IIO_DIR =
+endif
+
+SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR) $(IIO_DIR) netjack
+DIST_SUBDIRS = alsa alsa_midi dummy oss sun portaudio coreaudio freebob firewire iio netjack
diff --git a/drivers/iio/Makefile.am b/drivers/iio/Makefile.am
new file mode 100644
index 0000000..65db647
--- /dev/null
+++ b/drivers/iio/Makefile.am
@@ -0,0 +1,15 @@
+MAINTAINCLEANFILES = Makefile.in
+
+AM_CFLAGS = $(JACK_CFLAGS)
+AM_CXXFLAGS = $(JACK_CFLAGS) $(GTKIOSTREAM_CFLAGS) $(EIGEN_CFLAGS) -fpermissive
+
+plugindir = $(ADDON_DIR)
+
+plugin_LTLIBRARIES = jack_iio.la
+
+jack_iio_la_LDFLAGS = -module -avoid-version
+jack_iio_la_SOURCES = iio_driver.C
+jack_iio_la_LIBADD = $(top_builddir)/jackd/libjackserver.la $(GTKIOSTREAM_LIBS) $(EIGEN_LIBS)
+#jack_portaudio_la_LIBADD = $(PA_LIBS)
+
+noinst_HEADERS = iio_driver.h
diff --git a/drivers/iio/iio_driver.C b/drivers/iio/iio_driver.C
new file mode 100644
index 0000000..fda1db6
--- /dev/null
+++ b/drivers/iio/iio_driver.C
@@ -0,0 +1,192 @@
+/*
+
+	IIO driver for Jack
+	Copyright (C) 2013 Matt Flax <[hidden]>
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+	MA  02111-1307  USA
+
+*/
+
+#include <iostream>
+#include <IIO/IIO.H>
+
+#include <values.h>
+#include <inttypes.h>
+extern "C" {
+#include "iio_driver.h"
+#include "engine.h"
+}
+
+#define IIO_DEFAULT_CHIP "AD7476A" ///< The default IIO recording chip to look for.
+#define IIO_DEFAULT_READ_FS 1.e6 ///< The default IIO sample rate for the default chip.
+#define IIO_DEFAULT_PERIOD_SIZE 3000 ///< The default period size is in the ms range
+
+//#define IIO_DRIVER_N_PARAMS	2
+//const static jack_driver_param_desc_t iio_params[IIO_DRIVER_N_PARAMS] = {
+//    {
+//        "inchannels",
+//        'i',
+//        JackDriverParamUInt,
+//        { .ui = IIO_DRIVER_DEF_INS },
+//        NULL,
+//        "capture channels",
+//        "capture channels"
+//    },
+//    {
+//        "capture",
+//        'C',
+//        JackDriverParamString,
+//        { .str = IIO_DEFAULT_CHIP },
+//        NULL,
+//        "input chip name",
+//        "input chip name"
+//    }
+//};
+
+static int iio_driver_attach (iio_driver_t *driver, jack_engine_t *engine) {
+    //return jack_activate (driver->client);
+    return 0;
+}
+
+static int iio_driver_detach (iio_driver_t *driver, jack_engine_t *engine) {
+    return 0;
+}
+
+static int iio_driver_start (iio_driver_t *driver) {
+    return 0;
+}
+
+static int iio_driver_stop (iio_driver_t *driver) {
+    return 0;
+}
+
+static int iio_driver_read (iio_driver_t *driver, jack_nframes_t nframes) {
+    return 0;
+}
+
+static int iio_driver_write (iio_driver_t *driver, jack_nframes_t nframes) {
+    return 0;
+}
+
+static int iio_driver_null_cycle (iio_driver_t *driver, jack_nframes_t nframes) {
+
+// output buffers are currently not handled ... in future, add output handling here.
+
+    return 0;
+}
+
+static int iio_driver_run_cycle (iio_driver_t *driver) {
+    return 0;
+}
+
+/** Given the number of samples and the sample rate, find the number of microseconds.
+\param nframes The number of frames.
+\param fs The sample rate.
+\return The number of microseconds represented by nframes.
+*/
+jack_time_t getUSecs(jack_nframes_t nframes, jack_nframes_t fs) {
+    return (jack_time_t) floor((((float) nframes) / fs) * 1000000.0f);
+}
+
+static int iio_driver_bufsize (iio_driver_t *driver, jack_nframes_t nframes) {
+    driver->period_size = nframes;
+    driver->period_usecs = driver->wait_time = getUSecs(nframes, driver->sample_rate);
+
+    /* tell the engine to change its buffer size */
+    if (driver->engine->set_buffer_size (driver->engine, nframes)) {
+        jack_error ("iio: cannot set engine buffer size to %d ", nframes);
+        return -1;
+    }
+
+    return 0;
+}
+
+jack_driver_t *driver_initialize (jack_client_t *client, const JSList * params) {
+    IIO *iio = NULL;
+    iio_driver_t *driver = (iio_driver_t *) calloc (1, sizeof (iio_driver_t));
+
+    if (driver) {
+        jack_driver_nt_init((jack_driver_nt_t *) driver);
+
+        driver->engine = NULL; // setup the required driver variables.
+        driver->client = client;
+        driver->last_wait_ust = 0;
+
+        driver->write         = (JackDriverReadFunction)       iio_driver_write;
+        driver->read          = (JackDriverReadFunction)       iio_driver_read;
+        driver->null_cycle    = (JackDriverNullCycleFunction)  iio_driver_null_cycle;
+        driver->nt_attach     = (JackDriverNTAttachFunction)   iio_driver_attach;
+        driver->nt_stop       = (JackDriverNTStopFunction)     iio_driver_stop;
+        driver->nt_start      = (JackDriverNTStartFunction)    iio_driver_start;
+        driver->nt_detach     = (JackDriverNTDetachFunction)   iio_driver_detach;
+        driver->nt_bufsize    = (JackDriverNTBufSizeFunction)  iio_driver_bufsize;
+        driver->nt_run_cycle  = (JackDriverNTRunCycleFunction) iio_driver_run_cycle;
+
+        driver->sample_rate = IIO_DEFAULT_READ_FS; // IIO sample rate is fixed.
+        driver->period_size = IIO_DEFAULT_PERIOD_SIZE;
+
+        driver->period_usecs = driver->wait_time = getUSecs(driver->period_size, driver->sample_rate);
+
+        driver->capture_channels  = MAXINT; // The default number of physical input channels - a very large number, to be reduced.
+        driver->capture_ports     = NULL;
+        driver->playback_channels = 0; // currently doesn't support playback.
+        driver->playback_ports    = NULL;
+
+        iio = new IIO; // initialise the IIO system.
+        if (iio) { // if the IIO class was successfully created ...
+        driver->IIO_devices=static_cast<void*>(iio); // store the iio class in the C structure
+
+            string chipName(IIO_DEFAULT_CHIP); // the default chip name to search for in the IIO devices.
+
+            const JSList *pnode = params; // param pointer
+            while (pnode != NULL) {
+                const jack_driver_param_t *param = (const jack_driver_param_t *) pnode->data;
+                switch (param->character) {
+
+                case 'C': // we are specifying a new chip name
+                    chipName = param->value.str;
+                    break;
+                case 'i': // we are specifying the number of capture channels
+                    driver->capture_channels = param->value.ui;
+                    break;
+                }
+                pnode = jack_slist_next(pnode);
+            }
+
+            iio->findDevicesByChipName(chipName); // find all devices with a particular chip which are present.
+
+            iio->printInfo(); // print out detail about the devices which were found ...
+
+            // if the available number of ports is less then the requested number, then restrict to the number of physical ports.
+            if (iio->getChCnt()<driver->capture_channels)
+                driver->capture_channels=iio->getChCnt();
+
+            string name("iio_pcm");
+            //jack_info("created iio driver ... %s|%" PRIu32 "|%" PRIu32 "|%lu|%u|%u", name.c_str(), driver->sample_rate, driver->period_size, driver->wait_time, driver->capture_channels, driver->playback_channels);
+
+            return (jack_driver_t *) driver;
+        } else
+            jack_error("iio driver_initialise: new IIO failed: %s: %s@%i", strerror(errno), __FILE__, __LINE__);
+        } else
+        jack_error("iio driver_initialise: iio_driver_t malloc() failed: %s: %s@%i", strerror(errno), __FILE__, __LINE__);
+
+    // if we get here, there was a problem.
+    if (driver)
+        free(driver);
+    if (iio)
+        delete iio;
+    return NULL;
+}
diff --git a/drivers/iio/iio_driver.h b/drivers/iio/iio_driver.h
new file mode 100644
index 0000000..9bf2aea
--- /dev/null
+++ b/drivers/iio/iio_driver.h
@@ -0,0 +1,66 @@
+/*
+
+	OSS driver for Jack
+	Copyright (C) 2003-2007 Matt Flax <faltmax@>
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+	MA  02111-1307  USA
+
+*/
+
+
+#ifndef __JACK_IIO_DRIVER_H__
+#define __JACK_IIO_DRIVER_H__
+
+#include <jack/types.h>
+#include <jack/jack.h>
+
+#include "driver.h"
+
+/** The structure defining all of the IIO related variables.
+*/
+typedef struct _iio_driver {
+    JACK_DRIVER_NT_DECL;
+
+	jack_nframes_t period_size;
+//	unsigned int nperiods;
+	unsigned int capture_channels;
+	unsigned int playback_channels;
+//
+//	char *indev;
+//	char *outdev;
+//	int infd;
+//	int outfd;
+//	int format;
+//	int ignorehwbuf;
+//	int trigger;
+//
+	JSList *capture_ports;
+	JSList *playback_ports;
+//
+//	jack_engine_t *engine;
+	jack_client_t *client;
+
+    jack_nframes_t  sample_rate; ///< The sample rate of the IIO chip.
+    unsigned long   wait_time; ///< The time to wait between calls.
+
+    void *IIO_devices; ///< The IIO C++ class maintaining all devices with a particular chip name.
+} iio_driver_t;
+
+/** Function called by jack to init. the IIO driver, possibly passing in variables.
+*/
+jack_driver_t *driver_initialize (jack_client_t *client, const JSList * params);
+#endif
+
-- 
1.8.3.2
PrevNext  Index

1392326354.13744_0.ltw:2,a <1392326321-3699-2-git-send-email-flatmax at flatmax dot org>