[Jack-Devel] [PATCH 05/16] iio_driver.c Improved speed, added xrun indications. Removed references to POST_PACKED_STRUCTURE to enable execution on ARM without "Bus error" problems.

PrevNext  Index
DateFri, 14 Feb 2014 08:18:30 +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
---
 codeBlocks/jack1.layout  | 222 +++++++++++++++++++++++++----------------------
 drivers/iio/iio_driver.C |  61 ++++++++-----
 drivers/iio/iio_driver.h |   1 +
 include/internal.h       |   3 +-
 include/port.h           |   3 +-
 jack                     |   2 +-
 6 files changed, 163 insertions(+), 129 deletions(-)

diff --git a/codeBlocks/jack1.layout b/codeBlocks/jack1.layout
index 3a70aa4..15ff655 100644
--- a/codeBlocks/jack1.layout
+++ b/codeBlocks/jack1.layout
@@ -1,129 +1,129 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 <CodeBlocks_layout_file>
 	<ActiveTarget name="Debug" />
-	<File name="../Makefile.am" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../configure.ac" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1088" topLine="8" />
+			<Cursor1 position="20317" topLine="640" />
 		</Cursor>
 	</File>
-	<File name="../jackd/transengine.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="14333" topLine="499" />
+			<Cursor1 position="6722" topLine="268" />
 		</Cursor>
 	</File>
-	<File name="../drivers/iio/JackIIODriverTest.C" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="2460" topLine="45" />
+			<Cursor1 position="953" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="../configure.ac" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/coreaudio/coreaudio_driver.c" open="1" top="1" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="20317" topLine="640" />
+			<Cursor1 position="10939" topLine="270" />
 		</Cursor>
 	</File>
-	<File name="../config/os/generic/time.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/netjack/net_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="967" topLine="2" />
+			<Cursor1 position="1587" topLine="51" />
 		</Cursor>
 	</File>
-	<File name="../drivers/firewire/ffado_driver.c" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="13482" topLine="351" />
+			<Cursor1 position="18461" topLine="558" />
 		</Cursor>
 	</File>
-	<File name="../README" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="118" topLine="0" />
+			<Cursor1 position="818" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="../libjack/time.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/alsa/usx2y.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1648" topLine="49" />
+			<Cursor1 position="13985" topLine="486" />
 		</Cursor>
 	</File>
-	<File name="../tools/Makefile.am" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../AUTHORS" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="4760" topLine="134" />
+			<Cursor1 position="2313" topLine="53" />
 		</Cursor>
 	</File>
-	<File name="../AUTHORS" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="2313" topLine="53" />
+			<Cursor1 position="5953" topLine="148" />
 		</Cursor>
 	</File>
-	<File name="../drivers/dummy/dummy_driver.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="9501" topLine="309" />
+			<Cursor1 position="10847" topLine="351" />
 		</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">
+	<File name="../config/os/generic/time.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="7560" topLine="262" />
+			<Cursor1 position="967" topLine="2" />
 		</Cursor>
 	</File>
-	<File name="../config/cpu/m68k/atomicity.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../jackd/controlapi.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="3797" topLine="92" />
+			<Cursor1 position="37819" topLine="1375" />
 		</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">
+	<File name="../jack/types.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="953" topLine="0" />
+			<Cursor1 position="942" topLine="5" />
 		</Cursor>
 	</File>
-	<File name="../drivers/alsa/usx2y.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="13985" topLine="486" />
+			<Cursor1 position="172" topLine="0" />
 		</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">
+	<File name="../drivers/iio/JackIIODriverTest.C" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="23463" topLine="810" />
+			<Cursor1 position="2460" topLine="45" />
 		</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">
+	<File name="../libjack/time.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" />
+			<Cursor1 position="1648" topLine="49" />
 		</Cursor>
 	</File>
-	<File name="../drivers/alsa/alsa_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="5918" topLine="159" />
+			<Cursor1 position="9053" topLine="290" />
 		</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">
+	<File name="../libjack/client.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="47427" topLine="1776" />
+			<Cursor1 position="4767" topLine="213" />
 		</Cursor>
 	</File>
-	<File name="../drivers/iio/iio_driver.C" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="7071" topLine="201" />
+			<Cursor1 position="2222" topLine="33" />
 		</Cursor>
 	</File>
-	<File name="../config/os/macosx/README" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/oss/oss_driver.c" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="877" topLine="13" />
+			<Cursor1 position="29451" topLine="1292" />
 		</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">
+	<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="7736" topLine="334" />
+			<Cursor1 position="3008" topLine="90" />
 		</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">
+	<File name="../drivers/am/alsa_midi_driver.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" />
+			<Cursor1 position="2611" topLine="68" />
 		</Cursor>
 	</File>
-	<File name="../drivers/alsa/memops.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/alsa/alsa_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="5041" topLine="155" />
+			<Cursor1 position="5918" topLine="159" />
 		</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">
+	<File name="../config/os/gnu-linux/time.c" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="21344" topLine="553" />
+			<Cursor1 position="4416" topLine="141" />
 		</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">
@@ -131,109 +131,109 @@
 			<Cursor1 position="2337" topLine="56" />
 		</Cursor>
 	</File>
-	<File name="../include/driver.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../jack/control.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="7292" topLine="206" />
+			<Cursor1 position="14661" topLine="520" />
 		</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">
+	<File name="../jackd/jackstart.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="5219" topLine="1318" />
+			<Cursor1 position="1384" topLine="61" />
 		</Cursor>
 	</File>
-	<File name="../drivers/dummy/Makefile.am" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/firewire/ffado_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="321" topLine="0" />
+			<Cursor1 position="5805" topLine="176" />
 		</Cursor>
 	</File>
-	<File name="../drivers/netjack/net_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="1587" topLine="51" />
+			<Cursor1 position="1626" topLine="24" />
 		</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">
+	<File name="../drivers/firewire/ffado_driver.c" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1626" topLine="24" />
+			<Cursor1 position="13482" topLine="351" />
 		</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">
+	<File name="../tools/Makefile.am" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="2222" topLine="33" />
+			<Cursor1 position="4760" topLine="134" />
 		</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">
+	<File name="../include/driver.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="10847" topLine="351" />
+			<Cursor1 position="7292" topLine="206" />
 		</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">
+	<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="172" topLine="0" />
+			<Cursor1 position="1042" topLine="28" />
 		</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">
+	<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="0" topLine="32" />
+			<Cursor1 position="246" topLine="0" />
 		</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">
+	<File name="../drivers/dummy/dummy_driver.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="6722" topLine="268" />
+			<Cursor1 position="9501" topLine="309" />
 		</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">
+	<File name="../drivers/dummy/Makefile.am" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="18461" topLine="558" />
+			<Cursor1 position="321" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="../libjack/client.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="4767" topLine="213" />
+			<Cursor1 position="7736" topLine="334" />
 		</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">
+	<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="9053" topLine="290" />
+			<Cursor1 position="1373" topLine="40" />
 		</Cursor>
 	</File>
-	<File name="../jackd/jackstart.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../drivers/alsa/memops.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1384" topLine="61" />
+			<Cursor1 position="5041" topLine="155" />
 		</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">
+	<File name="../jackd/transengine.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="5953" topLine="148" />
+			<Cursor1 position="14333" topLine="499" />
 		</Cursor>
 	</File>
-	<File name="../jack/control.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../README" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="14661" topLine="520" />
+			<Cursor1 position="118" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="../jack/types.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="942" topLine="5" />
+			<Cursor1 position="15067" topLine="601" />
 		</Cursor>
 	</File>
-	<File name="../jackd/clientengine.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="1052" topLine="3" />
+			<Cursor1 position="7560" topLine="262" />
 		</Cursor>
 	</File>
-	<File name="../README.developers" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="818" topLine="0" />
+			<Cursor1 position="877" topLine="13" />
 		</Cursor>
 	</File>
-	<File name="../jackd/controlapi.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="37819" topLine="1375" />
+			<Cursor1 position="7071" topLine="201" />
 		</Cursor>
 	</File>
-	<File name="../drivers/dummy/dummy_driver.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="398" topLine="8" />
+			<Cursor1 position="0" topLine="32" />
 		</Cursor>
 	</File>
 	<File name="../drivers/iio/Makefile.am" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -241,39 +241,49 @@
 			<Cursor1 position="463" topLine="0" />
 		</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">
+	<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="246" topLine="0" />
+			<Cursor1 position="47427" topLine="1776" />
 		</Cursor>
 	</File>
-	<File name="../drivers/alsa/alsa_driver.c" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../config/cpu/m68k/atomicity.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="41188" topLine="1518" />
+			<Cursor1 position="3797" topLine="92" />
 		</Cursor>
 	</File>
-	<File name="../drivers/am/alsa_midi_driver.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../Makefile.am" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="2611" topLine="68" />
+			<Cursor1 position="1088" topLine="8" />
 		</Cursor>
 	</File>
-	<File name="../drivers/oss/oss_driver.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<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="4593" topLine="193" />
+			<Cursor1 position="5219" topLine="1318" />
 		</Cursor>
 	</File>
-	<File name="../drivers/firewire/ffado_driver.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="../jackd/clientengine.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="5805" topLine="176" />
+			<Cursor1 position="1052" topLine="3" />
 		</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">
+	<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="1373" topLine="40" />
+			<Cursor1 position="23463" topLine="810" />
 		</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">
+	<File name="../drivers/dummy/dummy_driver.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1042" topLine="28" />
+			<Cursor1 position="398" topLine="8" />
+		</Cursor>
+	</File>
+	<File name="../drivers/alsa/alsa_driver.c" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="41188" topLine="1518" />
+		</Cursor>
+	</File>
+	<File name="../drivers/netjack/netjack_packet.c" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="14523" topLine="512" />
 		</Cursor>
 	</File>
 </CodeBlocks_layout_file>
diff --git a/drivers/iio/iio_driver.C b/drivers/iio/iio_driver.C
index 6a9709f..fbf6230 100644
--- a/drivers/iio/iio_driver.C
+++ b/drivers/iio/iio_driver.C
@@ -43,9 +43,10 @@ extern "C" {
 
 #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 1024 ///< The default period size is in the ms range
+#define IIO_DEFAULT_PERIOD_SIZE 2048 ///< The default period size is in the ms range
 #define IIO_DEFAULT_CAPUTURE_PORT_COUNT MAXINT ///< The default number of capture ports is exceedingly big, trimmed down to a realistic size in driver_initialize
-#define IIO_SAFETY_FACTOR 2./3. ///< The default safety factor, allow consumption of this fraction of the available DMA buffer before we don't allow the driver to continue.
+//#define IIO_SAFETY_FACTOR 2./3. ///< The default safety factor, allow consumption of this fraction of the available DMA buffer before we don't allow the driver to continue.
+#define IIO_SAFETY_FACTOR 1. ///< The default safety factor, allow consumption of this fraction of the available DMA buffer before we don't allow the driver to continue.
 
 //#define IIO_DRIVER_N_PARAMS	2
 //const static jack_driver_param_desc_t iio_params[IIO_DRIVER_N_PARAMS] = {
@@ -165,7 +166,7 @@ static int iio_driver_stop (iio_driver_t *driver) {
 
 static int iio_driver_read(iio_driver_t *driver, jack_nframes_t nframes) {
     if (nframes > 0) {
-        cout<<"iio_driver_read nframes = "<<nframes<<"\n";
+        //cout<<"iio_driver_read nframes = "<<nframes<<"\n";
         Eigen::Array<unsigned short int, Eigen::Dynamic, Eigen::Dynamic> *data = static_cast<Eigen::Array<unsigned short int, Eigen::Dynamic, Eigen::Dynamic> *>(driver->data);
         IIO *iio = static_cast<IIO *>(driver->IIO_devices);
         uint devChCnt=(*iio)[0].getChCnt();
@@ -195,13 +196,13 @@ static int iio_driver_read (iio_driver_t *driver, jack_nframes_t nframes) {
 }
 
 static int iio_driver_write (iio_driver_t *driver, jack_nframes_t nframes) {
-    if (nframes>0)
-        cout<<"iio_driver_write nframes = "<<nframes<<"\n";
+    //if (nframes>0)
+    //    cout<<"iio_driver_write nframes = "<<nframes<<"\n";
     return 0;
 }
 
 static int iio_driver_null_cycle (iio_driver_t *driver, jack_nframes_t nframes) {
-    cout<<"iio_driver_null_cycle\n";
+    //cout<<"iio_driver_null_cycle\n";
 
 // output buffers are currently not handled ... in future, add output handling here.
 
@@ -211,28 +212,33 @@ static int iio_driver_null_cycle (iio_driver_t *driver, jack_nframes_t nframes)
 /** The driver_wait function to work out if we have used more time then available to process one cycle.
 */
 static jack_nframes_t iio_driver_wait(iio_driver_t *driver, int extra_fd, int *status, float *delayed_usecs) {
-    cout<<"iio_driver_wait\n";
-    float maxDelayTime=(IIO_SAFETY_FACTOR*driver->maxDelayUSecs); // this driver can handle this much delay between reads.
+    //cout<<"iio_driver_wait\n";
+    //float maxDelayTime=(IIO_SAFETY_FACTOR*driver->maxDelayUSecs); // this driver can handle this much delay between reads.
+    float maxDelayTime=driver->maxDelayUSecs; // this driver can handle this much delay between reads.
     //cout<<"maxDelayTime "<<maxDelayTime<<endl;
     *status = 0;
 
     jack_time_t now = driver->engine->get_microseconds();
 
-    if (driver->next_time < now)
-        if (driver->next_time == 0) /* first time through */
+    bool xrun=false;
+    if (driver->next_time < now){
+        //cout<<"iio_driver_wait NOT good\n";
+        if (driver->next_time == 0){ /* first time through */
             driver->next_time = now + driver->wait_time;
-        else if ((now - driver->last_wait_ust) > maxDelayTime) { /* xrun */
+            driver->last_xrun_time=now;
+        }else if ((now - driver->last_wait_ust) > maxDelayTime) { /* xrun */
             //cout<<"driver->last_wait_ust "<<driver->last_wait_ust<<" now "<<now<<endl;
-            jack_error("**** iio: xrun of %ju usec", (uintmax_t)now - driver->next_time);
+            //jack_error("**** iio: xrun of %ju usec", (uintmax_t)now - driver->next_time);
+            cout<<"**** iio: xrun of "<<((uintmax_t)now - driver->next_time)<<"u usec last xrun was "<<now-driver->last_xrun_time<<"us ago.\n";
+            driver->last_xrun_time=now;
             driver->next_time = now + driver->wait_time;
             *status=0; // xruns are fatal - but switching to non-fatal during development
+            xrun=true;
             //*status=-1; // xruns are fatal
         } else /* late, but handled by our "buffer" */
             driver->next_time += driver->wait_time;
-    else {
-        jack_time_t wait = driver->next_time - now;
-        struct timespec ts = { .tv_sec = (time_t)wait / (time_t)1000000, .tv_nsec = ((time_t)wait % (time_t)1000000) * 1000 };
-        nanosleep(&ts,NULL);
+    } else {
+        //cout<<"iio_driver_wait all good\n";
         driver->next_time += driver->wait_time;
     }
 
@@ -240,6 +246,7 @@ static jack_nframes_t iio_driver_wait(iio_driver_t *driver, int extra_fd, int *s
     driver->engine->transport_cycle_start (driver->engine, driver->last_wait_ust);
 
     *delayed_usecs = 0;
+    if (xrun) return 0;
     return driver->period_size;
 }
 
@@ -296,11 +303,16 @@ static int iio_driver_bufsize (iio_driver_t *driver, jack_nframes_t nframes) {
             return -1;
         }
     }
+    // if the data matrix is larger in columns then the number of capture channels, then resize it.
+    if ((int)ceil((float)driver->capture_channels/(float)(*iio)[0].getChCnt())<data->cols())
+        data->resize(data->rows(), (int)ceil((float)driver->capture_channels/(float)(*iio)[0].getChCnt()));
 
     // all good, adjust the new variables...
     driver->period_size = nframes;
     driver->period_usecs = driver->wait_time = getUSecs(nframes, driver->sample_rate);
 
+    cout<<"wait_time = "<<driver->wait_time<<endl;
+
     /* 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);
@@ -390,9 +402,14 @@ jack_driver_t *driver_initialize (jack_client_t *client, const JSList * params)
             driver->period_usecs = driver->wait_time = getUSecs(driver->period_size, driver->sample_rate);
             driver->maxDelayUSecs=(double)iio->getChannelBufferCnt()/driver->sample_rate*1.e6; // find the duration (in us) each channel can buffer
 
+            cout<<"wait_time = "<<driver->wait_time<<endl;
+            cout<<"maxDelayUSecs = "<<driver->maxDelayUSecs<<endl;
+
+
             bool bufferSizeOK=true;
-            if (driver->wait_time>(IIO_SAFETY_FACTOR*driver->maxDelayUSecs)) {
-                jack_info("iio driver requires a wait time/period of %d us, however the maximum buffer is %d us, which is more then the safety factor of %d.\nIndicating the problem.", driver->wait_time, driver->maxDelayUSecs, IIO_SAFETY_FACTOR);
+            if ((float)driver->wait_time>(IIO_SAFETY_FACTOR*driver->maxDelayUSecs)) {
+                cout<<"iio driver requires a wait time/period of "<<driver->wait_time<<" us, however the maximum buffer is "<<driver->maxDelayUSecs<<" us, which is more then the safety factor of "<<IIO_SAFETY_FACTOR<<".\nIndicating the problem.\n";
+                jack_info("iio driver requires a wait time/period of %d us, however the maximum buffer is %f us, which is more then the safety factor of %f.\nIndicating the problem.", driver->wait_time, driver->maxDelayUSecs, IIO_SAFETY_FACTOR);
                 bufferSizeOK=false; // indicate the error
             }
 
@@ -411,12 +428,16 @@ jack_driver_t *driver_initialize (jack_client_t *client, const JSList * params)
                 dataCreationOK=false;
             }
 
-            cout<<"matrix size rows = "<<data->rows()<<" cols = "<<data->cols()<<endl;
-
             // 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();
 
+            // if the data matrix is larger in columns then the number of capture channels, then resize it.
+            if ((int)ceil((float)driver->capture_channels/(float)(*iio)[0].getChCnt())<data->cols())
+                data->resize(data->rows(), (int)ceil((float)driver->capture_channels/(float)(*iio)[0].getChCnt()));
+
+            cout<<"matrix size rows = "<<data->rows()<<" cols = "<<data->cols()<<endl;
+
             string name("iio_pcm");
             if ((driver->capture_channels!=0 || driver->playback_channels!=0) && bufferSizeOK && dataCreationOK) {
                 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);
diff --git a/drivers/iio/iio_driver.h b/drivers/iio/iio_driver.h
index d067c76..ffd410b 100644
--- a/drivers/iio/iio_driver.h
+++ b/drivers/iio/iio_driver.h
@@ -59,6 +59,7 @@ typedef struct _iio_driver {
     struct timespec next_wakeup;
 #else
     jack_time_t     next_time;
+    jack_time_t     last_xrun_time;
 #endif
 
     void *IIO_devices; ///< The IIO C++ class maintaining all devices with a particular chip name.
diff --git a/include/internal.h b/include/internal.h
index 831124f..90c0827 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -43,7 +43,8 @@
    than use the natural alignment of the processor and/or
    compiler.
 */
-#define POST_PACKED_STRUCTURE __attribute__((__packed__))
+//#define POST_PACKED_STRUCTURE __attribute__((__packed__))
+#define POST_PACKED_STRUCTURE
 #else
 /* Add other things here for non-gcc platforms */
 #endif
diff --git a/include/port.h b/include/port.h
index 840d9ed..51b98c5 100644
--- a/include/port.h
+++ b/include/port.h
@@ -63,7 +63,8 @@ typedef int32_t jack_port_type_id_t;
    than use the natural alignment of the processor and/or
    compiler.
 */
-#define POST_PACKED_STRUCTURE __attribute__((__packed__))
+//#define POST_PACKED_STRUCTURE __attribute__((__packed__))
+#define POST_PACKED_STRUCTURE
 #else
 /* Add other things here for non-gcc platforms */
 #endif
diff --git a/jack b/jack
index b7f8964..c1592b4 160000
--- a/jack
+++ b/jack
@@ -1 +1 @@
-Subproject commit b7f896437abbf80a76cc2be5cdfdb1ec7452a345
+Subproject commit c1592b4e56af0db2148d519847a6ef593edf3517
-- 
1.8.3.2
PrevNext  Index

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