aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-12-19 17:47:06 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-12-19 17:47:06 +0900
commitb260a9aebb0ba2f55a0f9d4f00f09f90728e8cf9 (patch)
tree79b735c24b6ca8a886090ac9b517a46d6b195b06
parentba03e6f8e017a727438e234cbaf9beb726d08fc4 (diff)
downloadhinoko-rs-b260a9aebb0ba2f55a0f9d4f00f09f90728e8cf9.tar.gz
hinoko-sys/hinoko: regenerate crates for libhinoko v0.6.0 release
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--Hinoko-0.0.gir462
-rw-r--r--README.rst18
-rw-r--r--conf/gir-hinoko-sys.toml1
-rw-r--r--conf/gir-hinoko.toml6
-rw-r--r--hinoko-sys/Cargo.toml13
-rw-r--r--hinoko-sys/build.rs2
-rw-r--r--hinoko-sys/src/lib.rs8
-rw-r--r--hinoko-sys/tests/manual.h10
-rw-r--r--hinoko/Cargo.toml7
-rw-r--r--hinoko/src/auto/fw_iso_ctx.rs10
-rw-r--r--hinoko/src/auto/fw_iso_rx_single.rs10
-rw-r--r--hinoko/src/auto/fw_iso_tx.rs13
-rw-r--r--hinoko/src/fw_iso_rx_single.rs3
-rw-r--r--hinoko/src/fw_iso_tx.rs55
-rw-r--r--hinoko/src/lib.rs210
15 files changed, 547 insertions, 281 deletions
diff --git a/Hinoko-0.0.gir b/Hinoko-0.0.gir
index 4aef483..cef1d3b 100644
--- a/Hinoko-0.0.gir
+++ b/Hinoko-0.0.gir
@@ -23,12 +23,12 @@ and/or use gtk-doc annotations. -->
<constructor name="new" c:identifier="hinoko_cycle_timer_new">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="20">Allocate and return an instance of HinokoCycleTimer.</doc>
+ line="28">Allocate and return an instance of HinokoCycleTimer.</doc>
<source-position filename="../src/cycle_timer.h" line="20"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="25">An instance of HinokoCycleTimer.</doc>
+ line="33">An instance of HinokoCycleTimer.</doc>
<type name="CycleTimer" c:type="HinokoCycleTimer*"/>
</return-value>
</constructor>
@@ -36,7 +36,7 @@ and/or use gtk-doc annotations. -->
c:identifier="hinoko_cycle_timer_get_clock_id">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="48">Get the ID of clock for timestamp.</doc>
+ line="56">Get the ID of clock for timestamp.</doc>
<source-position filename="../src/cycle_timer.h" line="25"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -45,7 +45,7 @@ and/or use gtk-doc annotations. -->
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="50">A #HinokoCycleTimer.</doc>
+ line="58">A #HinokoCycleTimer.</doc>
<type name="CycleTimer" c:type="HinokoCycleTimer*"/>
</instance-parameter>
<parameter name="clock_id"
@@ -54,7 +54,7 @@ and/or use gtk-doc annotations. -->
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="51">The numerical ID of clock source for the reference
+ line="59">The numerical ID of clock source for the reference
timestamp. One CLOCK_REALTIME(0), CLOCK_MONOTONIC(1), and
CLOCK_MONOTONIC_RAW(4) is available in UAPI of Linux kernel.</doc>
<type name="gint" c:type="gint*"/>
@@ -65,7 +65,7 @@ and/or use gtk-doc annotations. -->
c:identifier="hinoko_cycle_timer_get_cycle_timer">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="62">Get the value of cycle timer in 1394 OHCI controller.</doc>
+ line="70">Get the value of cycle timer in 1394 OHCI controller.</doc>
<source-position filename="../src/cycle_timer.h" line="27"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -74,7 +74,7 @@ and/or use gtk-doc annotations. -->
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="64">A #HinokoCycleTimer.</doc>
+ line="72">A #HinokoCycleTimer.</doc>
<type name="CycleTimer" c:type="HinokoCycleTimer*"/>
</instance-parameter>
<parameter name="cycle_timer"
@@ -83,7 +83,7 @@ and/or use gtk-doc annotations. -->
transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="65">The value of cycle
+ line="73">The value of cycle
timer register of 1394 OHCI, including three elements; second,
cycle and offset.</doc>
<array zero-terminated="0" c:type="guint16*" fixed-size="3">
@@ -96,7 +96,7 @@ and/or use gtk-doc annotations. -->
c:identifier="hinoko_cycle_timer_get_timestamp">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="32">Get timestamp with enough sizee of strorage. The timestamp refers to
+ line="40">Get timestamp with enough sizee of strorage. The timestamp refers to
clock_id available by hinoko_cycle_timer_get_clock_id().</doc>
<source-position filename="../src/cycle_timer.h" line="22"/>
<return-value transfer-ownership="none">
@@ -106,7 +106,7 @@ clock_id available by hinoko_cycle_timer_get_clock_id().</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="34">A #HinokoCycleTimer.</doc>
+ line="42">A #HinokoCycleTimer.</doc>
<type name="CycleTimer" c:type="HinokoCycleTimer*"/>
</instance-parameter>
<parameter name="tv_sec"
@@ -115,7 +115,7 @@ clock_id available by hinoko_cycle_timer_get_clock_id().</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="35">The second part of timestamp.</doc>
+ line="43">The second part of timestamp.</doc>
<type name="gint64" c:type="gint64*"/>
</parameter>
<parameter name="tv_nsec"
@@ -124,7 +124,7 @@ clock_id available by hinoko_cycle_timer_get_clock_id().</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/cycle_timer.c"
- line="36">The nanosecond part of timestamp.</doc>
+ line="44">The nanosecond part of timestamp.</doc>
<type name="gint32" c:type="gint32*"/>
</parameter>
</parameters>
@@ -333,7 +333,7 @@ handler is called. When any error occurs, it's reported.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="800">Create Gsource for GMainContext to dispatch events for isochronous context.</doc>
+ line="795">Create Gsource for GMainContext to dispatch events for isochronous context.</doc>
<source-position filename="../src/fw_iso_ctx.h" line="69"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -342,7 +342,7 @@ handler is called. When any error occurs, it's reported.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="802">A #hinokoFwIsoCtx.</doc>
+ line="797">A #hinokoFwIsoCtx.</doc>
<type name="FwIsoCtx" c:type="HinokoFwIsoCtx*"/>
</instance-parameter>
<parameter name="gsrc"
@@ -351,17 +351,39 @@ handler is called. When any error occurs, it's reported.</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="803">A #GSource.</doc>
+ line="798">A #GSource.</doc>
<type name="GLib.Source" c:type="GSource**"/>
</parameter>
</parameters>
</method>
+ <method name="flush_completions"
+ c:identifier="hinoko_fw_iso_ctx_flush_completions"
+ version="0.6."
+ throws="1">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_ctx.c"
+ line="975">Flush isochronous context until recent isochronous cycle. The call of function forces the
+context to queue any type of interrupt event for the recent isochronous cycle. Application can
+process the content of isochronous packet without waiting for actual hardware interrupt.</doc>
+ <source-position filename="../src/fw_iso_ctx.h" line="72"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_ctx.c"
+ line="977">A #HinokoFwIsoCtx.</doc>
+ <type name="FwIsoCtx" c:type="HinokoFwIsoCtx*"/>
+ </instance-parameter>
+ </parameters>
+ </method>
<method name="get_cycle_timer"
c:identifier="hinoko_fw_iso_ctx_get_cycle_timer"
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="403">Retrieve the value of cycle timer register. This method call is available
+ line="401">Retrieve the value of cycle timer register. This method call is available
once any isochronous context is created.</doc>
<source-position filename="../src/fw_iso_ctx.h" line="65"/>
<return-value transfer-ownership="none">
@@ -371,13 +393,13 @@ once any isochronous context is created.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="405">A #HinokoFwIsoCtx.</doc>
+ line="403">A #HinokoFwIsoCtx.</doc>
<type name="FwIsoCtx" c:type="HinokoFwIsoCtx*"/>
</instance-parameter>
<parameter name="clock_id" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="406">The numerical ID of clock source for the reference timestamp. One
+ line="404">The numerical ID of clock source for the reference timestamp. One
CLOCK_REALTIME(0), CLOCK_MONOTONIC(1), and CLOCK_MONOTONIC_RAW(2)
is available in UAPI of Linux kernel.</doc>
<type name="gint" c:type="gint"/>
@@ -388,7 +410,7 @@ once any isochronous context is created.</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="409">A #HinokoCycleTimer to store data of cycle timer.</doc>
+ line="407">A #HinokoCycleTimer to store data of cycle timer.</doc>
<type name="CycleTimer" c:type="HinokoCycleTimer* const*"/>
</parameter>
</parameters>
@@ -411,7 +433,7 @@ once any isochronous context is created.</doc>
<glib:signal name="stopped" when="last">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="169">When isochronous context is stopped, #HinokoFwIsoCtx::stopped is
+ line="167">When isochronous context is stopped, #HinokoFwIsoCtx::stopped is
emitted.</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -423,7 +445,7 @@ emitted.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="172">A #GError.</doc>
+ line="170">A #GError.</doc>
<type name="GLib.Error"/>
</parameter>
</parameters>
@@ -533,11 +555,11 @@ emitted.</doc>
<function name="quark" c:identifier="hinoko_fw_iso_ctx_error_quark">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="48">Return the GQuark for error domain of GError which has code in #HinokoFwIsoCtxError.</doc>
+ line="46">Return the GQuark for error domain of GError which has code in #HinokoFwIsoCtxError.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="53">A #GQuark.</doc>
+ line="51">A #GQuark.</doc>
<type name="GLib.Quark" c:type="GQuark"/>
</return-value>
</function>
@@ -1404,27 +1426,24 @@ properties are available.</doc>
glib:type-name="HinokoFwIsoRxMultiple"
glib:get-type="hinoko_fw_iso_rx_multiple_get_type"
glib:type-struct="FwIsoRxMultipleClass">
- <source-position filename="../src/fw_iso_rx_multiple.h" line="59"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="56"/>
<constructor name="new" c:identifier="hinoko_fw_iso_rx_multiple_new">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="122">Instantiate #HinokoFwIsoRxMultiple object and return the instance.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="63"/>
+ line="131">Instantiate #HinokoFwIsoRxMultiple object and return the instance.</doc>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="60"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="127">an instance of #HinokoFwIsoRxMultiple.</doc>
+ line="136">an instance of #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</return-value>
</constructor>
<virtual-method name="interrupted">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.h"
- line="48">When any packet is available, the handler of
-#HinokoFwIsoRxMultipleClass::interrupted is called with the number of
-available packets. In the handler, payload of received packet is
-available by a call of #hinoko_fw_iso_rx_multiple_get_payload().</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="58"/>
+ line="48">In detail, please refer to documentation about #HinokoFwIsoRxMultiple::interrupted.</doc>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="55"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1448,11 +1467,11 @@ available by a call of #hinoko_fw_iso_rx_multiple_get_payload().</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="134">Allocate an IR context to 1394 OHCI controller for buffer-fill mode.
+ line="143">Allocate an IR context to 1394 OHCI controller for buffer-fill mode.
A local node of the node corresponding to the given path is used as the
controller, thus any path is accepted as long as process has enough
permission for the path.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="65"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="62"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1460,19 +1479,19 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="136">A #HinokoFwIsoRxMultiple.</doc>
+ line="145">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
<parameter name="path" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="137">A path to any Linux FireWire character device.</doc>
+ line="146">A path to any Linux FireWire character device.</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="channels" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="138">an array
+ line="147">an array
for channels to listen to.</doc>
<array length="2" zero-terminated="0" c:type="const guint8*">
<type name="guint8"/>
@@ -1481,7 +1500,7 @@ permission for the path.</doc>
<parameter name="channels_length" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="140">The length of @channels.</doc>
+ line="149">The length of @channels.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -1489,7 +1508,7 @@ permission for the path.</doc>
<method name="get_payload"
c:identifier="hinoko_fw_iso_rx_multiple_get_payload"
throws="1">
- <source-position filename="../src/fw_iso_rx_multiple.h" line="84"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="81"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1497,13 +1516,13 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="440">A #HinokoFwIsoRxMultiple.</doc>
+ line="467">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
<parameter name="index" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="441">the index of packet available in this interrupt.</doc>
+ line="468">the index of packet available in this interrupt.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="payload"
@@ -1512,7 +1531,7 @@ permission for the path.</doc>
transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="442">The array with data
+ line="469">The array with data
frame for payload of IR context.</doc>
<array length="2" zero-terminated="0" c:type="const guint8**">
<type name="guint8" c:type="guint8*"/>
@@ -1524,7 +1543,7 @@ permission for the path.</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="444">The number of bytes in the above @payload.</doc>
+ line="471">The number of bytes in the above @payload.</doc>
<type name="guint" c:type="guint*"/>
</parameter>
</parameters>
@@ -1534,9 +1553,9 @@ permission for the path.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="221">Map an intermediate buffer to share payload of IR context with 1394 OHCI
+ line="230">Map an intermediate buffer to share payload of IR context with 1394 OHCI
controller.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="72"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="69"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1544,20 +1563,20 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="223">A #HinokoFwIsoRxMultiple.</doc>
+ line="232">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
<parameter name="bytes_per_chunk" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="224">The maximum number of bytes for payload of isochronous
+ line="233">The maximum number of bytes for payload of isochronous
packet (not payload for isochronous context).</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="chunks_per_buffer" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="226">The number of chunks in buffer.</doc>
+ line="235">The number of chunks in buffer.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -1565,8 +1584,8 @@ controller.</doc>
<method name="release" c:identifier="hinoko_fw_iso_rx_multiple_release">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="199">Release allocated IR context from 1394 OHCI controller.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="70"/>
+ line="208">Release allocated IR context from 1394 OHCI controller.</doc>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="67"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1574,7 +1593,7 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="201">A #HinokoFwIsoRxMultiple.</doc>
+ line="210">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
</parameters>
@@ -1584,8 +1603,8 @@ controller.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="299">Start IR context.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="78"/>
+ line="318">Start IR context.</doc>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="75"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1593,7 +1612,7 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="301">A #HinokoFwIsoRxMultiple.</doc>
+ line="320">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
<parameter name="cycle_match"
@@ -1602,7 +1621,7 @@ controller.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="302">
+ line="321">
The isochronous cycle to start packet processing. The first
element should be the second part of isochronous cycle, up to
3. The second element should be the cycle part of isochronous
@@ -1614,20 +1633,22 @@ controller.</doc>
<parameter name="sync" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="307">The value of sync field in isochronous header for packet processing,
+ line="326">The value of sync field in isochronous header for packet processing,
up to 15.</doc>
<type name="guint32" c:type="guint32"/>
</parameter>
<parameter name="tags" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="309">The value of tag field in isochronous header for packet processing.</doc>
+ line="328">The value of tag field in isochronous header for packet processing.</doc>
<type name="FwIsoCtxMatchFlag" c:type="HinokoFwIsoCtxMatchFlag"/>
</parameter>
<parameter name="chunks_per_irq" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="310">The number of chunks per interval of interrupt.</doc>
+ line="329">The number of chunks per interval of interrupt. When 0 is given, application
+ should call #hinoko_fw_iso_ctx_flush_completions voluntarily to generate
+ #HinokoFwIsoRxMultiple::interrupted event.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -1635,8 +1656,8 @@ controller.</doc>
<method name="stop" c:identifier="hinoko_fw_iso_rx_multiple_stop">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="339">Stop IR context.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="82"/>
+ line="366">Stop IR context.</doc>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="79"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1644,7 +1665,7 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="341">A #HinokoFwIsoRxMultiple.</doc>
+ line="368">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
</parameters>
@@ -1653,9 +1674,9 @@ controller.</doc>
c:identifier="hinoko_fw_iso_rx_multiple_unmap_buffer">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="268">Unmap intermediate buffer shard with 1394 OHCI controller for payload
+ line="277">Unmap intermediate buffer shard with 1394 OHCI controller for payload
of IR context.</doc>
- <source-position filename="../src/fw_iso_rx_multiple.h" line="76"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="73"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1663,7 +1684,7 @@ of IR context.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="270">A #HinokoFwIsoRxMultiple.</doc>
+ line="279">A #HinokoFwIsoRxMultiple.</doc>
<type name="FwIsoRxMultiple" c:type="HinokoFwIsoRxMultiple*"/>
</instance-parameter>
</parameters>
@@ -1683,9 +1704,15 @@ of IR context.</doc>
<glib:signal name="interrupted" when="last">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="96">When any packet is available, the #HinokoFwIsoRxMultiple::interrupted
-signal is emitted with the number of available packets. In the
-handler, payload of received packet is available by a call of
+ line="99">When Linux FireWire subsystem generates interrupt event, the
+#HinokoFwIsoRxMultiple::interrupted signal is emitted. There are two cases for Linux
+FireWire subsystem to generate the event:
+
+- When OHCI 1394 controller generates hardware interrupt as a result to process the
+ isochronous packet for the buffer chunk marked to generate hardware interrupt.
+- When application calls #hinoko_fw_iso_ctx_flush_completions() explicitly.
+
+The handler of signal can retrieve the content of packet by call of
#hinoko_fw_iso_rx_multiple_get_payload().</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -1694,7 +1721,7 @@ handler, payload of received packet is available by a call of
<parameter name="count" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_multiple.c"
- line="99">The number of packets available in this interrupt.</doc>
+ line="102">The number of packets available in this interrupt.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -1703,13 +1730,13 @@ handler, payload of received packet is available by a call of
<record name="FwIsoRxMultipleClass"
c:type="HinokoFwIsoRxMultipleClass"
glib:is-gtype-struct-for="FwIsoRxMultiple">
- <source-position filename="../src/fw_iso_rx_multiple.h" line="59"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="56"/>
<field name="parent_class">
<type name="FwIsoCtxClass" c:type="HinokoFwIsoCtxClass"/>
</field>
<field name="interrupted">
<callback name="interrupted">
- <source-position filename="../src/fw_iso_rx_multiple.h" line="58"/>
+ <source-position filename="../src/fw_iso_rx_multiple.h" line="55"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1742,27 +1769,24 @@ handler, payload of received packet is available by a call of
glib:type-name="HinokoFwIsoRxSingle"
glib:get-type="hinoko_fw_iso_rx_single_get_type"
glib:type-struct="FwIsoRxSingleClass">
- <source-position filename="../src/fw_iso_rx_single.h" line="66"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="63"/>
<constructor name="new" c:identifier="hinoko_fw_iso_rx_single_new">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="83">Instantiate #HinokoFwIsoRxSingle object and return the instance.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="70"/>
+ line="91">Instantiate #HinokoFwIsoRxSingle object and return the instance.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="67"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="88">an instance of #HinokoFwIsoRxSingle.</doc>
+ line="96">an instance of #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</return-value>
</constructor>
<virtual-method name="interrupted">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.h"
- line="48">When any packet is available, the
-#HinokoFwIsoRxSingleClass::interrupted handler is called with header
-of the packet. In the handler, payload of received packet is
-available by a call of #hinoko_fw_iso_rx_single_get_payload().</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="63"/>
+ line="48">In detail, please refer to documentation about #HinokoFwIsoRxSingle::interrupted.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="60"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1813,11 +1837,11 @@ available by a call of #hinoko_fw_iso_rx_single_get_payload().</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="95">Allocate an IR context to 1394 OHCI controller for packet-per-buffer mode.
+ line="103">Allocate an IR context to 1394 OHCI controller for packet-per-buffer mode.
A local node of the node corresponding to the given path is used as the
controller, thus any path is accepted as long as process has enough
permission for the path.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="72"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="69"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1825,25 +1849,25 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="97">A #HinokoFwIsoRxSingle.</doc>
+ line="105">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
<parameter name="path" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="98">A path to any Linux FireWire character device.</doc>
+ line="106">A path to any Linux FireWire character device.</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="channel" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="99">An isochronous channel to listen.</doc>
+ line="107">An isochronous channel to listen.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="header_size" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="100">The number of bytes for header of IR context.</doc>
+ line="108">The number of bytes for header of IR context.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -1853,8 +1877,8 @@ permission for the path.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="294">Retrieve payload of IR context for a handled packet corresponding to index.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="90"/>
+ line="288">Retrieve payload of IR context for a handled packet corresponding to index.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="88"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1862,13 +1886,13 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="296">A #HinokoFwIsoRxSingle.</doc>
+ line="290">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
<parameter name="index" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="297">the index inner available packets.</doc>
+ line="291">the index inner available packets.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="payload"
@@ -1877,7 +1901,7 @@ permission for the path.</doc>
transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="298">The
+ line="292">The
array with data frame for payload of IR context.</doc>
<array length="2" zero-terminated="0" c:type="const guint8**">
<type name="guint8"/>
@@ -1889,7 +1913,7 @@ permission for the path.</doc>
transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="300">The number of bytes in the above @payload.</doc>
+ line="294">The number of bytes in the above @payload.</doc>
<type name="guint" c:type="guint*"/>
</parameter>
</parameters>
@@ -1897,7 +1921,7 @@ permission for the path.</doc>
<method name="map_buffer"
c:identifier="hinoko_fw_iso_rx_single_map_buffer"
throws="1">
- <source-position filename="../src/fw_iso_rx_single.h" line="78"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="75"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1914,11 +1938,39 @@ permission for the path.</doc>
</parameter>
</parameters>
</method>
+ <method name="register_packet"
+ c:identifier="hinoko_fw_iso_rx_single_register_packet"
+ version="0.6."
+ throws="1">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_rx_single.c"
+ line="190">Register chunk of buffer to process packet for future isochronous cycle. The caller can schedule
+hardware interrupt to generate interrupt event. In detail, please refer to documentation about
+#HinokoFwIsoRxSingle::interrupted signal.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="81"/>
+ <return-value transfer-ownership="none">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_rx_single.c"
+ line="192">A #HinokoFwIsoRxSingle.</doc>
+ <type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
+ </instance-parameter>
+ <parameter name="schedule_interrupt" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_rx_single.c"
+ line="193">Whether to schedule hardware interrupt at isochronous cycle for the packet.</doc>
+ <type name="gboolean" c:type="gboolean"/>
+ </parameter>
+ </parameters>
+ </method>
<method name="release" c:identifier="hinoko_fw_iso_rx_single_release">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="129">Release allocated IR context from 1394 OHCI controller.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="76"/>
+ line="137">Release allocated IR context from 1394 OHCI controller.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="73"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1926,17 +1978,18 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="131">A #HinokoFwIsoRxSingle.</doc>
+ line="139">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
</parameters>
</method>
<method name="start"
c:identifier="hinoko_fw_iso_rx_single_start"
+ version="0.6."
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="190">Start IR context.</doc>
+ line="209">Start IR context.</doc>
<source-position filename="../src/fw_iso_rx_single.h" line="84"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -1945,7 +1998,7 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="192">A #HinokoFwIsoRxSingle.</doc>
+ line="211">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
<parameter name="cycle_match"
@@ -1954,7 +2007,7 @@ permission for the path.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="193">
+ line="212">
The isochronous cycle to start packet processing. The first
element should be the second part of isochronous cycle, up to
3. The second element should be the cycle part of isochronous
@@ -1966,30 +2019,23 @@ permission for the path.</doc>
<parameter name="sync" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="198">The value of sync field in isochronous header for packet processing,
+ line="217">The value of sync field in isochronous header for packet processing,
up to 15.</doc>
<type name="guint32" c:type="guint32"/>
</parameter>
<parameter name="tags" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="200">The value of tag field in isochronous header for packet processing.</doc>
+ line="219">The value of tag field in isochronous header for packet processing.</doc>
<type name="FwIsoCtxMatchFlag" c:type="HinokoFwIsoCtxMatchFlag"/>
</parameter>
- <parameter name="packets_per_irq" transfer-ownership="none">
- <doc xml:space="preserve"
- filename="../src/fw_iso_rx_single.c"
- line="201">The number of packets as interval of event. Skip cycles are
- ignored.</doc>
- <type name="guint" c:type="guint"/>
- </parameter>
</parameters>
</method>
<method name="stop" c:identifier="hinoko_fw_iso_rx_single_stop">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="239">Stop IR context.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="88"/>
+ line="241">Stop IR context.</doc>
+ <source-position filename="../src/fw_iso_rx_single.h" line="86"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -1997,7 +2043,7 @@ permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="241">A #HinokoFwIsoRxSingle.</doc>
+ line="243">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
</parameters>
@@ -2006,9 +2052,9 @@ permission for the path.</doc>
c:identifier="hinoko_fw_iso_rx_single_unmap_buffer">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="168">Unmap intermediate buffer shard with 1394 OHCI controller for payload
+ line="175">Unmap intermediate buffer shard with 1394 OHCI controller for payload
of IR context.</doc>
- <source-position filename="../src/fw_iso_rx_single.h" line="82"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="79"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2016,7 +2062,7 @@ of IR context.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="170">A #HinokoFwIsoRxSingle.</doc>
+ line="177">A #HinokoFwIsoRxSingle.</doc>
<type name="FwIsoRxSingle" c:type="HinokoFwIsoRxSingle*"/>
</instance-parameter>
</parameters>
@@ -2031,9 +2077,17 @@ of IR context.</doc>
<glib:signal name="interrupted" when="last">
<doc xml:space="preserve"
filename="../src/fw_iso_rx_single.c"
- line="51">When any packet is available, the #HinokoFwIsoRxSingle::interrupted
-signal is emitted with header of the packet. In a handler of the
-signal, payload of received packet is available by a call of
+ line="51">When Linux FireWire subsystem generates interrupt event, the
+#HinokoFwIsoRxSingle::interrupted signal is emitted. There are three cases for Linux
+FireWire subsystem to generate the event:
+
+- When OHCI 1394 controller generates hardware interrupt as a result to process the
+ isochronous packet for the buffer chunk marked to generate hardware interrupt.
+- When the size of accumulated context header for packets since the last event reaches
+ the size of memory page (usually 4,096 bytes).
+- When application calls #hinoko_fw_iso_ctx_flush_completions() explicitly.
+
+The handler of signal can retrieve context payload of received packet by call of
#hinoko_fw_iso_rx_single_get_payload().</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
@@ -2078,13 +2132,13 @@ signal, payload of received packet is available by a call of
<record name="FwIsoRxSingleClass"
c:type="HinokoFwIsoRxSingleClass"
glib:is-gtype-struct-for="FwIsoRxSingle">
- <source-position filename="../src/fw_iso_rx_single.h" line="66"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="63"/>
<field name="parent_class">
<type name="FwIsoCtxClass" c:type="HinokoFwIsoCtxClass"/>
</field>
<field name="interrupted">
<callback name="interrupted">
- <source-position filename="../src/fw_iso_rx_single.h" line="63"/>
+ <source-position filename="../src/fw_iso_rx_single.h" line="60"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2144,25 +2198,24 @@ signal, payload of received packet is available by a call of
glib:type-name="HinokoFwIsoTx"
glib:get-type="hinoko_fw_iso_tx_get_type"
glib:type-struct="FwIsoTxClass">
- <source-position filename="../src/fw_iso_tx.h" line="64"/>
+ <source-position filename="../src/fw_iso_tx.h" line="63"/>
<constructor name="new" c:identifier="hinoko_fw_iso_tx_new">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="76">Instantiate #HinokoFwIsoTx object and return the instance.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="68"/>
+ line="83">Instantiate #HinokoFwIsoTx object and return the instance.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="67"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="81">an instance of #HinokoFwIsoTx.</doc>
+ line="88">an instance of #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</return-value>
</constructor>
<virtual-method name="interrupted">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.h"
- line="48">When registered packets are handled, #HinokoFwIsoTxClass::interrupted
-handler is called with timestamps of the packet.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="61"/>
+ line="48">In detail, please refer to documentation about #HinokoFwIsoTx::interrupted.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="60"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2213,10 +2266,10 @@ handler is called with timestamps of the packet.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="88">Allocate an IT context to 1394 OHCI controller. A local node of the node
+ line="95">Allocate an IT context to 1394 OHCI controller. A local node of the node
corresponding to the given path is used as the controller, thus any path is
accepted as long as process has enough permission for the path.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="70"/>
+ <source-position filename="../src/fw_iso_tx.h" line="69"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2224,31 +2277,31 @@ accepted as long as process has enough permission for the path.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="90">A #HinokoFwIsoTx.</doc>
+ line="97">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
<parameter name="path" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="91">A path to any Linux FireWire character device.</doc>
+ line="98">A path to any Linux FireWire character device.</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="scode" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="92">A #HinokoFwScode to indicate speed of isochronous communication.</doc>
+ line="99">A #HinokoFwScode to indicate speed of isochronous communication.</doc>
<type name="FwScode" c:type="HinokoFwScode"/>
</parameter>
<parameter name="channel" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="93">An isochronous channel to transfer.</doc>
+ line="100">An isochronous channel to transfer.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="header_size" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="94">The number of bytes for header of IT context.</doc>
+ line="101">The number of bytes for header of IT context.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
@@ -2258,9 +2311,9 @@ accepted as long as process has enough permission for the path.</doc>
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="128">Map intermediate buffer to share payload of IT context with 1394 OHCI
+ line="135">Map intermediate buffer to share payload of IT context with 1394 OHCI
controller.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="75"/>
+ <source-position filename="../src/fw_iso_tx.h" line="74"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2268,31 +2321,34 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="130">A #HinokoFwIsoTx.</doc>
+ line="137">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
<parameter name="maximum_bytes_per_payload"
transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="131">The number of bytes for payload of IT context.</doc>
+ line="138">The number of bytes for payload of IT context.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="payloads_per_buffer" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="132">The number of payloads of IT context in buffer.</doc>
+ line="139">The number of payloads of IT context in buffer.</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
</method>
<method name="register_packet"
c:identifier="hinoko_fw_iso_tx_register_packet"
+ version="0.6."
throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="248">Register packet data in a shape of header and payload of IT context.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="85"/>
+ line="220">Register packet data with header and payload for IT context. The caller can schedule hardware
+interrupt to generate interrupt event. In detail, please refer to documentation about
+#HinokoFwIsoTx::interrupted.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="83"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2300,19 +2356,19 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="250">A #HinokoFwIsoTx.</doc>
+ line="222">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
<parameter name="tags" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="251">The value of tag field for isochronous packet to register.</doc>
+ line="223">The value of tag field for isochronous packet to register.</doc>
<type name="FwIsoCtxMatchFlag" c:type="HinokoFwIsoCtxMatchFlag"/>
</parameter>
<parameter name="sy" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="252">The value of sy field for isochronous packet to register.</doc>
+ line="224">The value of sy field for isochronous packet to register.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="header"
@@ -2321,7 +2377,7 @@ controller.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="253">The header of IT context
+ line="225">The header of IT context
for isochronous packet.</doc>
<array length="3" zero-terminated="0" c:type="const guint8*">
<type name="guint8" c:type="guint8"/>
@@ -2330,7 +2386,7 @@ controller.</doc>
<parameter name="header_length" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="255">The number of bytes for the @header.</doc>
+ line="227">The number of bytes for the @header.</doc>
<type name="guint" c:type="guint"/>
</parameter>
<parameter name="payload"
@@ -2339,7 +2395,7 @@ controller.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="256">The payload of IT context
+ line="228">The payload of IT context
for isochronous packet.</doc>
<array length="5" zero-terminated="0" c:type="const guint8*">
<type name="guint8" c:type="guint8"/>
@@ -2348,16 +2404,22 @@ controller.</doc>
<parameter name="payload_length" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="258">The number of bytes for the @payload.</doc>
+ line="230">The number of bytes for the @payload.</doc>
<type name="guint" c:type="guint"/>
</parameter>
+ <parameter name="schedule_interrupt" transfer-ownership="none">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_tx.c"
+ line="231">Whether to schedule hardware interrupt at isochronous cycle for the packet.</doc>
+ <type name="gboolean" c:type="gboolean"/>
+ </parameter>
</parameters>
</method>
<method name="release" c:identifier="hinoko_fw_iso_tx_release">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="113">Release allocated IT context from 1394 OHCI controller.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="73"/>
+ line="120">Release allocated IT context from 1394 OHCI controller.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="72"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2365,16 +2427,19 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="115">A #HinokoFwIsoTx.</doc>
+ line="122">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
</parameters>
</method>
- <method name="start" c:identifier="hinoko_fw_iso_tx_start" throws="1">
+ <method name="start"
+ c:identifier="hinoko_fw_iso_tx_start"
+ version="0.6."
+ throws="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="187">Start IT context.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="81"/>
+ line="179">Start IT context.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="80"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2382,7 +2447,7 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="189">A #HinokoFwIsoTx.</doc>
+ line="181">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
<parameter name="cycle_match"
@@ -2391,7 +2456,7 @@ controller.</doc>
allow-none="1">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="190">
+ line="182">
The isochronous cycle to start packet processing. The first
element should be the second part of isochronous cycle, up to
3. The second element should be the cycle part of isochronous
@@ -2400,21 +2465,13 @@ controller.</doc>
<type name="guint16"/>
</array>
</parameter>
- <parameter name="packets_per_irq" transfer-ownership="none">
- <doc xml:space="preserve"
- filename="../src/fw_iso_tx.c"
- line="195">The number of packets as interval of event. This value
- should be up to (pagesize / 4) due to implementation of
- Linux FireWire subsystem.</doc>
- <type name="guint" c:type="guint"/>
- </parameter>
</parameters>
</method>
<method name="stop" c:identifier="hinoko_fw_iso_tx_stop">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="230">Stop IT context.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="83"/>
+ line="202">Stop IT context.</doc>
+ <source-position filename="../src/fw_iso_tx.h" line="81"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2422,7 +2479,7 @@ controller.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="232">A #HinokoFwIsoTx.</doc>
+ line="204">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
</parameters>
@@ -2430,9 +2487,9 @@ controller.</doc>
<method name="unmap_buffer" c:identifier="hinoko_fw_iso_tx_unmap_buffer">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="156">Unmap intermediate buffer shard with 1394 OHCI controller for payload
+ line="163">Unmap intermediate buffer shard with 1394 OHCI controller for payload
of IT context.</doc>
- <source-position filename="../src/fw_iso_tx.h" line="79"/>
+ <source-position filename="../src/fw_iso_tx.h" line="78"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2440,7 +2497,7 @@ of IT context.</doc>
<instance-parameter name="self" transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="158">A #HinokoFwIsoTx.</doc>
+ line="165">A #HinokoFwIsoTx.</doc>
<type name="FwIsoTx" c:type="HinokoFwIsoTx*"/>
</instance-parameter>
</parameters>
@@ -2454,8 +2511,15 @@ of IT context.</doc>
<glib:signal name="interrupted" when="last">
<doc xml:space="preserve"
filename="../src/fw_iso_tx.c"
- line="46">When registered packets are handled, #HinokoFwIsoTx::interrupted
-signal is emitted with timestamps of the packet.</doc>
+ line="46">When Linux FireWire subsystem generates interrupt event, the #HinokoFwIsoTx::interrupted
+signal is emitted. There are three cases for Linux FireWire subsystem to generate the
+event:
+
+- When OHCI 1394 controller generates hardware interrupt as a result of processing the
+ isochronous packet for the buffer chunk marked to generate hardware interrupt.
+- When the number of isochronous packets sent since the last interrupt event reaches
+ one quarter of memory page size (usually 4,096 / 4 = 1,024 packets).
+- When application calls #hinoko_fw_iso_ctx_flush_completions() explicitly.</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2499,13 +2563,13 @@ signal is emitted with timestamps of the packet.</doc>
<record name="FwIsoTxClass"
c:type="HinokoFwIsoTxClass"
glib:is-gtype-struct-for="FwIsoTx">
- <source-position filename="../src/fw_iso_tx.h" line="64"/>
+ <source-position filename="../src/fw_iso_tx.h" line="63"/>
<field name="parent_class">
<type name="FwIsoCtxClass" c:type="HinokoFwIsoCtxClass"/>
</field>
<field name="interrupted">
<callback name="interrupted">
- <source-position filename="../src/fw_iso_tx.h" line="61"/>
+ <source-position filename="../src/fw_iso_tx.h" line="60"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
@@ -2720,19 +2784,48 @@ signal is emitted with timestamps of the packet.</doc>
</parameter>
</parameters>
</function-macro>
+ <docsection name="cycle_timer">
+ <doc xml:space="preserve"
+ filename="../src/cycle_timer.c"
+ line="4">A #HinokoCycleTimer is an boxed object to represent the value of cycle
+timer and timestamp referring to clock_id.</doc>
+ </docsection>
+ <docsection name="fw_iso_ctx">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_ctx.c"
+ line="13">A #HinokoFwIsoCtx is an abstract object to maintain isochronous context by
+UAPI of Linux FireWire subsystem. All of operations utilize ioctl(2) with
+subsystem specific request commands. This object is designed for internal
+use, therefore a few method and properties are available for applications.</doc>
+ </docsection>
<function name="fw_iso_ctx_error_quark"
c:identifier="hinoko_fw_iso_ctx_error_quark"
moved-to="FwIsoCtxError.quark">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="48">Return the GQuark for error domain of GError which has code in #HinokoFwIsoCtxError.</doc>
+ line="46">Return the GQuark for error domain of GError which has code in #HinokoFwIsoCtxError.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve"
filename="../src/fw_iso_ctx.c"
- line="53">A #GQuark.</doc>
+ line="51">A #GQuark.</doc>
<type name="GLib.Quark" c:type="GQuark"/>
</return-value>
</function>
+ <docsection name="fw_iso_resource">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_resource.c"
+ line="12">A #HinokoFwIsoResource is an object to initiate requests and listen events
+of isochronous resource allocation/deallocation by file descriptor owned
+internally. This object is designed to be used for any derived object.</doc>
+ </docsection>
+ <docsection name="fw_iso_resource_auto">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_resource_auto.c"
+ line="8">A #HinokoFwIsoResourceAuto is an object to maintain isochronous resource
+during the lifetime of the object. The allocated isochronous resource is
+kept even if the generation of the bus updates. The maintenance of allocated
+isochronous resource is done by Linux FireWire subsystem.</doc>
+ </docsection>
<function name="fw_iso_resource_auto_error_quark"
c:identifier="hinoko_fw_iso_resource_auto_error_quark"
moved-to="FwIsoResourceAutoError.quark">
@@ -2759,6 +2852,27 @@ signal is emitted with timestamps of the packet.</doc>
<type name="GLib.Quark" c:type="GQuark"/>
</return-value>
</function>
+ <docsection name="fw_iso_rx_multiple">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_rx_multiple.c"
+ line="7">A #HinokoFwIsoRxMultiple receives isochronous packets for several channels by
+IR context for buffer-fill mode in 1394 OHCI.</doc>
+ </docsection>
+ <docsection name="fw_iso_rx_single">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_rx_single.c"
+ line="8">A #HinokoFwIsoRxSingle receives isochronous packets for single channel by IR
+context for packet-per-buffer mode in 1394 OHCI. The content of packet is
+split to two parts; context header and context payload in a manner of Linux
+FireWire subsystem.</doc>
+ </docsection>
+ <docsection name="fw_iso_tx">
+ <doc xml:space="preserve"
+ filename="../src/fw_iso_tx.c"
+ line="8">A #HinokoFwIsoTx transmits isochronous packets for single channel by IT
+context in 1394 OHCI. The content of packet is split to two parts; context
+header and context payload in a manner of Linux FireWire subsystem.</doc>
+ </docsection>
<function name="sigs_marshal_VOID__UINT_UINT_OBJECT"
c:identifier="hinoko_sigs_marshal_VOID__UINT_UINT_OBJECT">
<source-position filename="../src/hinoko_sigs_marshal.h" line="19"/>
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..2e13c53
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,18 @@
+====================
+Hinoko Rust bindings
+====================
+
+2021/12/19
+Takashi Sakamoto
+
+Introduction
+============
+
+* This repository includes FFI and API bindings for ``libhinoko 0`` which provides ``Hinoko-0.0.gir``.
+
+ * https://github.com/takaswie/libhinoko
+
+License
+=======
+
+MIT License
diff --git a/conf/gir-hinoko-sys.toml b/conf/gir-hinoko-sys.toml
index cfe9184..6aab9ee 100644
--- a/conf/gir-hinoko-sys.toml
+++ b/conf/gir-hinoko-sys.toml
@@ -2,6 +2,7 @@
work_mode = "sys"
library = "Hinoko"
version = "0.0"
+min_cfg_version = "0.6"
single_version_file = "."
external_libraries = [
"GLib",
diff --git a/conf/gir-hinoko.toml b/conf/gir-hinoko.toml
index da9d063..dbdce21 100644
--- a/conf/gir-hinoko.toml
+++ b/conf/gir-hinoko.toml
@@ -2,7 +2,7 @@
work_mode = "normal"
library = "Hinoko"
version = "0.0"
-target_path = "."
+min_cfg_version = "0.6"
single_version_file = true
generate = [
@@ -78,6 +78,10 @@ name = "Hinoko.FwIsoTx"
status = "generate"
manual_traits = ["FwIsoTxExtManual"]
[[object.function]]
+ name = "register_packet"
+ ignore = true
+ doc_trait_name = "FwIsoTxExtManual"
+ [[object.function]]
pattern = "start"
ignore = true
doc_trait_name = "FwIsoTxExtManual"
diff --git a/hinoko-sys/Cargo.toml b/hinoko-sys/Cargo.toml
index 4441cc2..2a03eec 100644
--- a/hinoko-sys/Cargo.toml
+++ b/hinoko-sys/Cargo.toml
@@ -1,11 +1,20 @@
[package]
name = "hinoko-sys"
-version = "0.0.1"
+version = "0.1.0"
+description = "FFI bindings for libhinoko0 library"
+authors = ["Takashi Sakamoto <o-takashi@sakamocchi.jp>"]
links = "hinoko"
build = "build.rs"
+license = "MIT"
+repository = "https://github.com/takaswie/hinoko-rs/"
+
[package.metadata.docs.rs]
features = ["dox"]
+[package.metadata.system-deps.hinoko]
+name = "hinoko"
+version = "0.6"
+
[lib]
name = "hinoko_sys"
@@ -16,10 +25,12 @@ gobject-sys = "0.10"
[build-dependencies]
pkg-config = "0.3.7"
+system-deps = "3"
[dev-dependencies]
shell-words = "0.1.0"
tempfile = "3"
[features]
+v0_6 = []
dox = []
diff --git a/hinoko-sys/build.rs b/hinoko-sys/build.rs
index 9f600d8..aa24dc4 100644
--- a/hinoko-sys/build.rs
+++ b/hinoko-sys/build.rs
@@ -32,7 +32,7 @@ fn find() -> Result<(), Error> {
let package_name = "hinoko";
let shared_libs = ["hinoko"];
let version = {
- "0.0"
+ "0.6"
};
if let Ok(inc_dir) = env::var("GTK_INCLUDE_DIR") {
diff --git a/hinoko-sys/src/lib.rs b/hinoko-sys/src/lib.rs
index 946daa1..c99fc12 100644
--- a/hinoko-sys/src/lib.rs
+++ b/hinoko-sys/src/lib.rs
@@ -343,6 +343,7 @@ extern "C" {
//=========================================================================
pub fn hinoko_fw_iso_ctx_get_type() -> GType;
pub fn hinoko_fw_iso_ctx_create_source(self_: *mut HinokoFwIsoCtx, gsrc: *mut *mut glib::GSource, error: *mut *mut glib::GError);
+ pub fn hinoko_fw_iso_ctx_flush_completions(self_: *mut HinokoFwIsoCtx, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_ctx_get_cycle_timer(self_: *mut HinokoFwIsoCtx, clock_id: c_int, cycle_timer: *const *mut HinokoCycleTimer, error: *mut *mut glib::GError);
//=========================================================================
@@ -389,8 +390,9 @@ extern "C" {
pub fn hinoko_fw_iso_rx_single_allocate(self_: *mut HinokoFwIsoRxSingle, path: *const c_char, channel: c_uint, header_size: c_uint, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_rx_single_get_payload(self_: *mut HinokoFwIsoRxSingle, index: c_uint, payload: *mut *const u8, length: *mut c_uint, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_rx_single_map_buffer(self_: *mut HinokoFwIsoRxSingle, maximum_bytes_per_payload: c_uint, payloads_per_buffer: c_uint, error: *mut *mut glib::GError);
+ pub fn hinoko_fw_iso_rx_single_register_packet(self_: *mut HinokoFwIsoRxSingle, schedule_interrupt: gboolean, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_rx_single_release(self_: *mut HinokoFwIsoRxSingle);
- pub fn hinoko_fw_iso_rx_single_start(self_: *mut HinokoFwIsoRxSingle, cycle_match: *const [u16; 2], sync: u32, tags: HinokoFwIsoCtxMatchFlag, packets_per_irq: c_uint, error: *mut *mut glib::GError);
+ pub fn hinoko_fw_iso_rx_single_start(self_: *mut HinokoFwIsoRxSingle, cycle_match: *const [u16; 2], sync: u32, tags: HinokoFwIsoCtxMatchFlag, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_rx_single_stop(self_: *mut HinokoFwIsoRxSingle);
pub fn hinoko_fw_iso_rx_single_unmap_buffer(self_: *mut HinokoFwIsoRxSingle);
@@ -401,9 +403,9 @@ extern "C" {
pub fn hinoko_fw_iso_tx_new() -> *mut HinokoFwIsoTx;
pub fn hinoko_fw_iso_tx_allocate(self_: *mut HinokoFwIsoTx, path: *const c_char, scode: HinokoFwScode, channel: c_uint, header_size: c_uint, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_tx_map_buffer(self_: *mut HinokoFwIsoTx, maximum_bytes_per_payload: c_uint, payloads_per_buffer: c_uint, error: *mut *mut glib::GError);
- pub fn hinoko_fw_iso_tx_register_packet(self_: *mut HinokoFwIsoTx, tags: HinokoFwIsoCtxMatchFlag, sy: c_uint, header: *const u8, header_length: c_uint, payload: *const u8, payload_length: c_uint, error: *mut *mut glib::GError);
+ pub fn hinoko_fw_iso_tx_register_packet(self_: *mut HinokoFwIsoTx, tags: HinokoFwIsoCtxMatchFlag, sy: c_uint, header: *const u8, header_length: c_uint, payload: *const u8, payload_length: c_uint, schedule_interrupt: gboolean, error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_tx_release(self_: *mut HinokoFwIsoTx);
- pub fn hinoko_fw_iso_tx_start(self_: *mut HinokoFwIsoTx, cycle_match: *const [u16; 2], packets_per_irq: c_uint, error: *mut *mut glib::GError);
+ pub fn hinoko_fw_iso_tx_start(self_: *mut HinokoFwIsoTx, cycle_match: *const [u16; 2], error: *mut *mut glib::GError);
pub fn hinoko_fw_iso_tx_stop(self_: *mut HinokoFwIsoTx);
pub fn hinoko_fw_iso_tx_unmap_buffer(self_: *mut HinokoFwIsoTx);
diff --git a/hinoko-sys/tests/manual.h b/hinoko-sys/tests/manual.h
index 33968c2..042ee96 100644
--- a/hinoko-sys/tests/manual.h
+++ b/hinoko-sys/tests/manual.h
@@ -1,2 +1,10 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
-
+#include <hinoko-0.0/cycle_timer.h>
+#include <hinoko-0.0/fw_iso_ctx.h>
+#include <hinoko-0.0/fw_iso_resource.h>
+#include <hinoko-0.0/fw_iso_resource_auto.h>
+#include <hinoko-0.0/fw_iso_rx_multiple.h>
+#include <hinoko-0.0/fw_iso_rx_single.h>
+#include <hinoko-0.0/fw_iso_tx.h>
+#include <hinoko-0.0/hinoko_enum_types.h>
+#include <hinoko-0.0/hinoko_enums.h>
diff --git a/hinoko/Cargo.toml b/hinoko/Cargo.toml
index ff2b52f..d6b3dff 100644
--- a/hinoko/Cargo.toml
+++ b/hinoko/Cargo.toml
@@ -1,7 +1,10 @@
[package]
name = "hinoko"
-version = "0.0.1"
+version = "0.1.0"
+description = "API bindings for libhinoko0 library"
authors = ["Takashi Sakamoto <o-takashi@sakamocchi.jp>"]
+license = "MIT"
+repository = "https://github.com/takaswie/hinoko-rs/"
[lib]
name = "hinoko"
@@ -12,7 +15,7 @@ bitflags = "1.0"
glib = "0.10"
glib-sys = "0.10"
gobject-sys = "0.10"
-hinoko-sys = { path = "../hinoko-sys", version = "0.0" }
+hinoko-sys = { path = "../hinoko-sys", version = "0.1" }
[dev-dependencies]
gir-format-check = "^0.1"
diff --git a/hinoko/src/auto/fw_iso_ctx.rs b/hinoko/src/auto/fw_iso_ctx.rs
index 674b672..4f31197 100644
--- a/hinoko/src/auto/fw_iso_ctx.rs
+++ b/hinoko/src/auto/fw_iso_ctx.rs
@@ -31,6 +31,8 @@ pub const NONE_FW_ISO_CTX: Option<&FwIsoCtx> = None;
pub trait FwIsoCtxExt: 'static {
fn create_source(&self) -> Result<glib::Source, glib::Error>;
+ fn flush_completions(&self) -> Result<(), glib::Error>;
+
fn get_property_bytes_per_chunk(&self) -> u32;
fn get_property_chunks_per_buffer(&self) -> u32;
@@ -56,6 +58,14 @@ impl<O: IsA<FwIsoCtx>> FwIsoCtxExt for O {
}
}
+ fn flush_completions(&self) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let _ = hinoko_sys::hinoko_fw_iso_ctx_flush_completions(self.as_ref().to_glib_none().0, &mut error);
+ if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ }
+ }
+
fn get_property_bytes_per_chunk(&self) -> u32 {
unsafe {
let mut value = Value::from_type(<u32 as StaticType>::static_type());
diff --git a/hinoko/src/auto/fw_iso_rx_single.rs b/hinoko/src/auto/fw_iso_rx_single.rs
index 8addc49..43517d2 100644
--- a/hinoko/src/auto/fw_iso_rx_single.rs
+++ b/hinoko/src/auto/fw_iso_rx_single.rs
@@ -39,6 +39,8 @@ pub trait FwIsoRxSingleExt: 'static {
fn map_buffer(&self, maximum_bytes_per_payload: u32, payloads_per_buffer: u32) -> Result<(), glib::Error>;
+ fn register_packet(&self, schedule_interrupt: bool) -> Result<(), glib::Error>;
+
fn release(&self);
fn stop(&self);
@@ -63,6 +65,14 @@ impl<O: IsA<FwIsoRxSingle>> FwIsoRxSingleExt for O {
}
}
+ fn register_packet(&self, schedule_interrupt: bool) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let _ = hinoko_sys::hinoko_fw_iso_rx_single_register_packet(self.as_ref().to_glib_none().0, schedule_interrupt.to_glib(), &mut error);
+ if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ }
+ }
+
fn release(&self) {
unsafe {
hinoko_sys::hinoko_fw_iso_rx_single_release(self.as_ref().to_glib_none().0);
diff --git a/hinoko/src/auto/fw_iso_tx.rs b/hinoko/src/auto/fw_iso_tx.rs
index 37d9d6f..eaecf62 100644
--- a/hinoko/src/auto/fw_iso_tx.rs
+++ b/hinoko/src/auto/fw_iso_tx.rs
@@ -9,7 +9,6 @@ use hinoko_sys;
use std::fmt;
use std::ptr;
use FwIsoCtx;
-use FwIsoCtxMatchFlag;
use FwScode;
glib_wrapper! {
@@ -41,8 +40,6 @@ pub trait FwIsoTxExt: 'static {
fn map_buffer(&self, maximum_bytes_per_payload: u32, payloads_per_buffer: u32) -> Result<(), glib::Error>;
- fn register_packet(&self, tags: FwIsoCtxMatchFlag, sy: u32, header: &[u8], payload: &[u8]) -> Result<(), glib::Error>;
-
fn release(&self);
fn stop(&self);
@@ -67,16 +64,6 @@ impl<O: IsA<FwIsoTx>> FwIsoTxExt for O {
}
}
- fn register_packet(&self, tags: FwIsoCtxMatchFlag, sy: u32, header: &[u8], payload: &[u8]) -> Result<(), glib::Error> {
- let header_length = header.len() as u32;
- let payload_length = payload.len() as u32;
- unsafe {
- let mut error = ptr::null_mut();
- let _ = hinoko_sys::hinoko_fw_iso_tx_register_packet(self.as_ref().to_glib_none().0, tags.to_glib(), sy, header.to_glib_none().0, header_length, payload.to_glib_none().0, payload_length, &mut error);
- if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
- }
- }
-
fn release(&self) {
unsafe {
hinoko_sys::hinoko_fw_iso_tx_release(self.as_ref().to_glib_none().0);
diff --git a/hinoko/src/fw_iso_rx_single.rs b/hinoko/src/fw_iso_rx_single.rs
index dc2fc2a..94bed70 100644
--- a/hinoko/src/fw_iso_rx_single.rs
+++ b/hinoko/src/fw_iso_rx_single.rs
@@ -17,7 +17,6 @@ pub trait FwIsoRxSingleExtManual {
cycle_match: Option<&[u16; 2]>,
sync: u32,
tags: FwIsoCtxMatchFlag,
- packets_per_irq: u32,
) -> Result<(), glib::Error>;
fn get_payload(&self, index: u32) -> Result<&[u8], glib::Error>;
@@ -33,7 +32,6 @@ impl<O: IsA<FwIsoRxSingle>> FwIsoRxSingleExtManual for O {
cycle_match: Option<&[u16; 2]>,
sync: u32,
tags: FwIsoCtxMatchFlag,
- packets_per_irq: u32,
) -> Result<(), glib::Error> {
unsafe {
let ptr: *const [u16; 2] = match cycle_match {
@@ -47,7 +45,6 @@ impl<O: IsA<FwIsoRxSingle>> FwIsoRxSingleExtManual for O {
ptr,
sync,
tags.to_glib(),
- packets_per_irq,
&mut error,
);
diff --git a/hinoko/src/fw_iso_tx.rs b/hinoko/src/fw_iso_tx.rs
index 215073c..c372d75 100644
--- a/hinoko/src/fw_iso_tx.rs
+++ b/hinoko/src/fw_iso_tx.rs
@@ -8,26 +8,66 @@ use glib_sys;
use hinoko_sys;
use libc::*;
-use FwIsoTx;
+use crate::{FwIsoCtxMatchFlag, FwIsoTx};
pub trait FwIsoTxExtManual {
- fn start(
+ fn register_packet(
&self,
- cycle_match: Option<&[u16; 2]>,
- packets_per_irq: u32,
+ tags: FwIsoCtxMatchFlag,
+ sy: u32,
+ header: Option<&[u8]>,
+ payload: Option<&[u8]>,
+ schedule_interrupt: bool
) -> Result<(), glib::Error>;
+ fn start(&self, cycle_match: Option<&[u16; 2]>) -> Result<(), glib::Error>;
+
fn connect_interrupted<F>(&self, f: F) -> SignalHandlerId
where
F: Fn(&Self, u32, u32, &[u8], u32) + 'static;
}
impl<O: IsA<FwIsoTx>> FwIsoTxExtManual for O {
- fn start(
+ fn register_packet(
&self,
- cycle_match: Option<&[u16; 2]>,
- packets_per_irq: u32,
+ tags: FwIsoCtxMatchFlag,
+ sy: u32,
+ header: Option<&[u8]>,
+ payload: Option<&[u8]>,
+ schedule_interrupt: bool
) -> Result<(), glib::Error> {
+ let (header_ptr, header_length) = match header {
+ Some(h) => (h.as_ptr(), h.len() as u32),
+ None => (std::ptr::null(), 0),
+ };
+ let (payload_ptr, payload_length) = match payload {
+ Some(p) => (p.as_ptr(), p.len() as u32),
+ None => (std::ptr::null(), 0),
+ };
+
+ unsafe {
+ let mut error = std::ptr::null_mut();
+ let _ = hinoko_sys::hinoko_fw_iso_tx_register_packet(
+ self.as_ref().to_glib_none().0,
+ tags.to_glib(),
+ sy,
+ header_ptr,
+ header_length,
+ payload_ptr,
+ payload_length,
+ schedule_interrupt.to_glib(),
+ &mut error
+ );
+
+ if error.is_null() {
+ Ok(())
+ } else {
+ Err(from_glib_full(error))
+ }
+ }
+ }
+
+ fn start(&self, cycle_match: Option<&[u16; 2]>) -> Result<(), glib::Error> {
unsafe {
let ptr: *const [u16; 2] = match cycle_match {
Some(data) => data,
@@ -38,7 +78,6 @@ impl<O: IsA<FwIsoTx>> FwIsoTxExtManual for O {
hinoko_sys::hinoko_fw_iso_tx_start(
self.as_ref().to_glib_none().0,
ptr,
- packets_per_irq,
&mut error,
);
diff --git a/hinoko/src/lib.rs b/hinoko/src/lib.rs
index bfce5ed..821ced3 100644
--- a/hinoko/src/lib.rs
+++ b/hinoko/src/lib.rs
@@ -30,39 +30,29 @@ pub use fw_iso_tx::*;
#[cfg(test)]
mod tests {
use glib;
- use FwIsoCtxExt;
- use FwIsoCtxMatchFlag;
- use FwIsoResource;
- use FwIsoResourceAuto;
- use FwIsoResourceAutoExt;
- use FwIsoResourceExt;
- use FwIsoRxMultiple;
- use FwIsoRxMultipleExt;
- use FwIsoRxMultipleExtManual;
- use FwIsoRxSingle;
- use FwIsoRxSingleExt;
- use FwIsoRxSingleExtManual;
- use FwIsoTx;
- use FwIsoTxExt;
- use FwIsoTxExtManual;
- use FwScode;
+ use crate::*;
+
+ use std::{cmp, sync, thread, time::Duration};
+
+ const PATH: &str = "/dev/fw1";
+ const DURATION: Duration = Duration::from_secs(1);
fn launch_dispatcher(
src: &glib::Source,
- ) -> (std::sync::Arc<glib::MainLoop>, std::thread::JoinHandle<()>) {
+ ) -> (sync::Arc<glib::MainLoop>, thread::JoinHandle<()>) {
let ctx = glib::MainContext::new();
src.attach(Some(&ctx));
let dispatcher = glib::MainLoop::new(Some(&ctx), false);
- let dispatcher_cntr = std::sync::Arc::new(dispatcher);
+ let dispatcher_cntr = sync::Arc::new(dispatcher);
let d = dispatcher_cntr.clone();
- let th = std::thread::spawn(move || {
+ let th = thread::spawn(move || {
d.run();
()
});
loop {
- std::thread::sleep(std::time::Duration::from_millis(10));
+ thread::sleep(Duration::from_millis(10));
if dispatcher_cntr.is_running() {
break;
@@ -74,42 +64,72 @@ mod tests {
#[test]
fn iso_rx_single() {
+ const ISOC_CHANNEL: u32 = 20;
+ const CTX_HEADER_SIZE: u32 = 8;
+ const MAXIMUM_BYTES_PER_PAYLOAD: u32 = 32;
+ const PAYLOADS_PER_BUFFER: u32 = 32;
+ const PAYLOADS_PER_INTERRUPT: u32 = 8;
+ const ISOC_SYNC: u32 = 0;
+ const ISOC_TAG: FwIsoCtxMatchFlag = FwIsoCtxMatchFlag::TAG1;
+
+ let packet_count_cntr: sync::Arc<sync::Mutex<u32>> = sync::Arc::new(sync::Mutex::new(0));
+
let ir = FwIsoRxSingle::new();
- if ir.allocate("/dev/fw1", 20, 8).is_err() {
- println!("Need to have access permission to /dev/fw1.");
+ if ir.allocate(PATH, ISOC_CHANNEL, CTX_HEADER_SIZE).is_err() {
+ println!("Need to have access permission to {}.", PATH);
return;
}
- ir.map_buffer(32, 32).unwrap();
+ ir.map_buffer(MAXIMUM_BYTES_PER_PAYLOAD, PAYLOADS_PER_BUFFER).unwrap();
- ir.connect_interrupted(|ir, sec: u32, cycle: u32, header: &[u8], count: u32| {
+ let cntr = packet_count_cntr.clone();
+ ir.connect_interrupted(move |ir, sec: u32, cycle: u32, header: &[u8], count: u32| {
let mut frames = [0; 4];
println!("sec: {}, cycle: {}, count: {}", sec, cycle, count);
- for i in 0..count {
- let index = 8 * i as usize;
- frames.copy_from_slice(&header[index..(index + 4)]);
- let header1 = u32::from_be_bytes(frames);
- frames.copy_from_slice(&header[(index + 4)..(index + 8)]);
- let header2 = u32::from_be_bytes(frames);
-
- let payload = ir.get_payload(i).unwrap();
- println!(
- " {:2}: {:08x} {:08x} {:2}",
- i,
- header1,
- header2,
- payload.len()
- );
+ if let Ok(mut packet_count) = cntr.lock() {
+ (0..count)
+ .for_each(|i| {
+ let mut ctx_header: [u32; 2] = [0; 2];
+ let pos: usize = (CTX_HEADER_SIZE * i) as usize;
+ frames.copy_from_slice(&header[pos..(pos+ 4)]);
+ ctx_header[0] = u32::from_be_bytes(frames);
+ frames.copy_from_slice(&header[(pos+ 4)..(pos + 8)]);
+ ctx_header[1] = u32::from_be_bytes(frames);
+
+ let payload = ir.get_payload(i).unwrap();
+ println!(
+ " {:2}: {:08x} {:08x} {:2}",
+ i,
+ ctx_header[0],
+ ctx_header[1],
+ payload.len()
+ );
+
+ *packet_count += 1;
+ if *packet_count >= u32::MAX {
+ *packet_count %= PAYLOADS_PER_INTERRUPT;
+ }
+ let schedule_interrupt = *packet_count % PAYLOADS_PER_INTERRUPT == 0;
+ ir.register_packet(schedule_interrupt).unwrap();
+ });
}
});
let src = ir.create_source().unwrap();
let (dispatcher_cntr, th) = launch_dispatcher(&src);
- ir.start(None, 0, FwIsoCtxMatchFlag::TAG1, 16).unwrap();
+ let init_count: u32 = cmp::min(PAYLOADS_PER_BUFFER / 2, PAYLOADS_PER_INTERRUPT * 2);
+ (0..init_count)
+ .for_each(|i| {
+ let schedule_interrupt = i % PAYLOADS_PER_INTERRUPT == 0;
+ ir.register_packet(schedule_interrupt).unwrap();
+ });
+ *packet_count_cntr.lock().unwrap() = init_count;
+
+ ir.start(None, ISOC_SYNC, ISOC_TAG).unwrap();
- std::thread::sleep(std::time::Duration::from_secs(1));
+ thread::sleep(DURATION);
ir.stop();
@@ -122,42 +142,49 @@ mod tests {
#[test]
fn iso_rx_multiple() {
+ const ISOC_CHANNELS: &[u8] = &[30, 31, 32, 33];
+ const BYTES_PER_CHUNK: u32 = 4096;
+ const CHUNKS_PER_BUFFER: u32 = 32;
+ const ISOC_SYNC: u32 = 0;
+ const CHUNKS_PER_INTERRUPT: u32 = 4;
+
+ let isoc_tags: FwIsoCtxMatchFlag = FwIsoCtxMatchFlag::TAG0
+ | FwIsoCtxMatchFlag::TAG1
+ | FwIsoCtxMatchFlag::TAG2
+ | FwIsoCtxMatchFlag::TAG3;
let ir = FwIsoRxMultiple::new();
- if ir.allocate("/dev/fw1", &[30, 31, 32, 33]).is_err() {
- println!("Need to have access permission to /dev/fw1.");
+ if ir.allocate(PATH, ISOC_CHANNELS).is_err() {
+ println!("Need to have access permission to {}.", PATH);
return;
}
- ir.map_buffer(4096, 32).unwrap();
+ ir.map_buffer(BYTES_PER_CHUNK, CHUNKS_PER_BUFFER).unwrap();
ir.connect_interrupted(|ir, count: u32| {
let mut frames = [0; 4];
- for i in 0..count {
- let data = ir.get_payload(i).unwrap();
+ (0..count)
+ .for_each(|i| {
+ let data = ir.get_payload(i).unwrap();
- frames.copy_from_slice(&data[0..4]);
- let iso_header = u32::from_le_bytes(frames);
+ frames.copy_from_slice(&data[0..4]);
+ let iso_header = u32::from_le_bytes(frames);
- let payload_size = data.len() - 8;
+ let payload_size = data.len() - 8;
- let end = data.len();
- frames.copy_from_slice(&data[(end - 4)..end]);
- let tstamp = u32::from_le_bytes(frames);
+ let end = data.len();
+ frames.copy_from_slice(&data[(end - 4)..end]);
+ let tstamp = u32::from_le_bytes(frames);
- println!("{:8x} {:8x} {:4}", tstamp, iso_header, payload_size);
- }
+ println!("{:8x} {:8x} {:4}", tstamp, iso_header, payload_size);
+ });
});
let src = ir.create_source().unwrap();
let (dispatcher_cntr, th) = launch_dispatcher(&src);
- let tags = FwIsoCtxMatchFlag::TAG0
- | FwIsoCtxMatchFlag::TAG1
- | FwIsoCtxMatchFlag::TAG2
- | FwIsoCtxMatchFlag::TAG3;
- ir.start(None, 0, tags, 4).unwrap();
+ ir.start(None, ISOC_SYNC, isoc_tags, CHUNKS_PER_INTERRUPT).unwrap();
- std::thread::sleep(std::time::Duration::from_secs(1));
+ thread::sleep(DURATION);
ir.stop();
@@ -170,38 +197,73 @@ mod tests {
#[test]
fn isoc_tx() {
+ const ISOC_SPEED: FwScode = FwScode::S400;
+ const ISOC_CHANNEL: u32 = 30;
+ const CTX_HEADER_SIZE: u32 = 8;
+ const MAXIMUM_BYTES_PER_PAYLOAD: u32 = 32;
+ const PAYLOADS_PER_BUFFER: u32 = 32;
+ const PAYLOADS_PER_INTERRUPT: u32 = 8;
+ const ISOC_SYNC: u32 = 0;
+ const ISOC_TAG: FwIsoCtxMatchFlag = FwIsoCtxMatchFlag::TAG0;
+
+ let packet_count_cntr: sync::Arc<sync::Mutex<u32>> = sync::Arc::new(sync::Mutex::new(0));
+
let it = FwIsoTx::new();
- if it.allocate("/dev/fw1", FwScode::S400, 30, 8).is_err() {
- println!("Need to have access permission to /dev/fw1.");
+ if it.allocate(PATH, ISOC_SPEED, ISOC_CHANNEL, CTX_HEADER_SIZE).is_err() {
+ println!("Need to have access permission to {}.", PATH);
return;
}
- it.map_buffer(32, 32).unwrap();
+ it.map_buffer(MAXIMUM_BYTES_PER_PAYLOAD, PAYLOADS_PER_BUFFER).unwrap();
- it.connect_interrupted(|it, sec: u32, cycle: u32, header: &[u8], count: u32| {
+ let cntr = packet_count_cntr.clone();
+ it.connect_interrupted(move |it, sec: u32, cycle: u32, header: &[u8], count: u32| {
let my_header = [0, 1, 2, 3, 4, 5, 6, 7];
let my_payload = [0, 1, 2, 3, 4, 5, 6, 7];
let mut frames = [0; 4];
println!("sec: {}, cycle: {}, count: {}", sec, cycle, count);
- for i in 0..count {
- let index = 4 * i as usize;
- frames.copy_from_slice(&header[index..(index + 4)]);
- let tstamp = u32::from_be_bytes(frames);
- println!(" {:2}: {:08x}", i, tstamp);
-
- it.register_packet(FwIsoCtxMatchFlag::TAG0, 0, &my_header, &my_payload)
- .unwrap();
+ if let Ok(mut packet_count) = cntr.lock() {
+ (0..count)
+ .for_each(|i| {
+ let index = 4 * i as usize;
+ frames.copy_from_slice(&header[index..(index + 4)]);
+ let tstamp = u32::from_be_bytes(frames);
+ println!(" {:2}: {:08x}", i, tstamp);
+
+ *packet_count += 1;
+ if *packet_count >= u32::MAX {
+ *packet_count %= PAYLOADS_PER_INTERRUPT;
+ }
+ let schedule_interrupt = *packet_count % PAYLOADS_PER_INTERRUPT == 0;
+
+ it.register_packet(
+ ISOC_TAG,
+ ISOC_SYNC,
+ Some(&my_header),
+ Some(&my_payload),
+ schedule_interrupt
+ )
+ .unwrap();
+ });
}
});
let src = it.create_source().unwrap();
let (dispatcher_cntr, th) = launch_dispatcher(&src);
- it.start(None, 16).unwrap();
+ let skip_count: u32 = cmp::min(PAYLOADS_PER_BUFFER / 2, PAYLOADS_PER_INTERRUPT * 2);
+ (0..skip_count)
+ .for_each(|i| {
+ let schedule_interrupt = i % PAYLOADS_PER_INTERRUPT == 0;
+ it.register_packet(ISOC_TAG, ISOC_SYNC, None, None, schedule_interrupt).unwrap();
+ });
+ *packet_count_cntr.lock().unwrap() = skip_count;
+
+ it.start(None).unwrap();
- std::thread::sleep(std::time::Duration::from_secs(1));
+ thread::sleep(DURATION);
it.stop();