diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2022-05-05 11:37:24 +0900 |
---|---|---|
committer | 坂本 貴史 <o-takashi@sakamocchi.jp> | 2022-05-05 16:09:50 +0900 |
commit | d0680011baf0b56e6a5068de1e0229bc78c80746 (patch) | |
tree | da9eb57614049120a23a83247f11ceff201cb90e | |
parent | 64cebf1549a3dea1499f9e9db0f457e54bb3efb1 (diff) | |
download | libhinoko-d0680011baf0b56e6a5068de1e0229bc78c80746.tar.gz |
fw_iso_ctx: add public API to unmap shared buffer
The signature of functions to unmap shared buffer is the same between
GObject-derived object classes implementing Hinoko.FwIsoCtx.
This commit adds public API for the porpose in the interface.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r-- | src/fw_iso_ctx.c | 16 | ||||
-rw-r--r-- | src/fw_iso_ctx.h | 4 | ||||
-rw-r--r-- | src/fw_iso_rx_multiple.c | 40 | ||||
-rw-r--r-- | src/fw_iso_rx_multiple.h | 1 | ||||
-rw-r--r-- | src/fw_iso_rx_single.c | 30 | ||||
-rw-r--r-- | src/fw_iso_rx_single.h | 1 | ||||
-rw-r--r-- | src/fw_iso_tx.c | 30 | ||||
-rw-r--r-- | src/fw_iso_tx.h | 1 | ||||
-rw-r--r-- | src/hinoko.map | 4 |
9 files changed, 65 insertions, 62 deletions
diff --git a/src/fw_iso_ctx.c b/src/fw_iso_ctx.c index 12b004b..3591c82 100644 --- a/src/fw_iso_ctx.c +++ b/src/fw_iso_ctx.c @@ -121,6 +121,22 @@ void hinoko_fw_iso_ctx_stop(HinokoFwIsoCtx *self) } /** + * hinoko_fw_iso_ctx_unmap_buffer: + * @self: A [iface@FwIsoCtx]. + * + * Unmap intermediate buffer shared with 1394 OHCI controller for the context. + * + * Since: 0.7. + */ +void hinoko_fw_iso_ctx_unmap_buffer(HinokoFwIsoCtx *self) +{ + g_return_if_fail(HINOKO_IS_FW_ISO_CTX(self)); + + hinoko_fw_iso_ctx_stop(self); + HINOKO_FW_ISO_CTX_GET_IFACE(self)->unmap_buffer(self); +} + +/** * hinoko_fw_iso_ctx_flush_completions: * @self: A [iface@FwIsoCtx]. * @error: A [struct@GLib.Error]. diff --git a/src/fw_iso_ctx.h b/src/fw_iso_ctx.h index 9986ece..7144506 100644 --- a/src/fw_iso_ctx.h +++ b/src/fw_iso_ctx.h @@ -19,6 +19,8 @@ struct _HinokoFwIsoCtxInterface { void (*stop)(HinokoFwIsoCtx *self); + void (*unmap_buffer)(HinokoFwIsoCtx *self); + gboolean (*get_cycle_timer)(HinokoFwIsoCtx *self, gint clock_id, HinokoCycleTimer *const *cycle_timer, GError **error); @@ -38,6 +40,8 @@ struct _HinokoFwIsoCtxInterface { void hinoko_fw_iso_ctx_stop(HinokoFwIsoCtx *self); +void hinoko_fw_iso_ctx_unmap_buffer(HinokoFwIsoCtx *self); + void hinoko_fw_iso_ctx_get_cycle_timer(HinokoFwIsoCtx *self, gint clock_id, HinokoCycleTimer *const *cycle_timer, GError **error); diff --git a/src/fw_iso_rx_multiple.c b/src/fw_iso_rx_multiple.c index 08bfea5..650ebb1 100644 --- a/src/fw_iso_rx_multiple.c +++ b/src/fw_iso_rx_multiple.c @@ -136,6 +136,23 @@ static void fw_iso_rx_multiple_stop(HinokoFwIsoCtx *inst) g_signal_emit_by_name(G_OBJECT(inst), "stopped", NULL); } +static void fw_iso_rx_multiple_unmap_buffer(HinokoFwIsoCtx *inst) +{ + HinokoFwIsoRxMultiple *self; + HinokoFwIsoRxMultiplePrivate *priv; + + g_return_if_fail(HINOKO_IS_FW_ISO_RX_MULTIPLE(inst)); + self = HINOKO_FW_ISO_RX_MULTIPLE(inst); + priv = hinoko_fw_iso_rx_multiple_get_instance_private(self); + + fw_iso_ctx_state_unmap_buffer(&priv->state); + + if (priv->concat_frames != NULL) + free(priv->concat_frames); + + priv->concat_frames = NULL; +} + static gboolean fw_iso_rx_multiple_get_cycle_timer(HinokoFwIsoCtx *inst, gint clock_id, HinokoCycleTimer *const *cycle_timer, GError **error) @@ -285,6 +302,7 @@ gboolean fw_iso_rx_multiple_create_source(HinokoFwIsoCtx *inst, GSource **source static void fw_iso_ctx_iface_init(HinokoFwIsoCtxInterface *iface) { iface->stop = fw_iso_rx_multiple_stop; + iface->unmap_buffer = fw_iso_rx_multiple_unmap_buffer; iface->get_cycle_timer = fw_iso_rx_multiple_get_cycle_timer; iface->flush_completions = fw_iso_rx_multiple_flush_completions; iface->create_source = fw_iso_rx_multiple_create_source; @@ -431,28 +449,6 @@ void hinoko_fw_iso_rx_multiple_map_buffer(HinokoFwIsoRxMultiple *self, } /** - * hinoko_fw_iso_rx_multiple_unmap_buffer: - * @self: A [class@FwIsoRxMultiple]. - * - * Unmap intermediate buffer shard with 1394 OHCI controller for payload of IR context. - */ -void hinoko_fw_iso_rx_multiple_unmap_buffer(HinokoFwIsoRxMultiple *self) -{ - HinokoFwIsoRxMultiplePrivate *priv; - - g_return_if_fail(HINOKO_IS_FW_ISO_RX_MULTIPLE(self)); - priv = hinoko_fw_iso_rx_multiple_get_instance_private(self); - - hinoko_fw_iso_ctx_stop(HINOKO_FW_ISO_CTX(self)); - fw_iso_ctx_state_unmap_buffer(&priv->state); - - if (priv->concat_frames != NULL) - free(priv->concat_frames); - - priv->concat_frames = NULL; -} - -/** * hinoko_fw_iso_rx_multiple_start: * @self: A [class@FwIsoRxMultiple]. * @cycle_match: (array fixed-size=2) (element-type guint16) (in) (nullable): The isochronous cycle diff --git a/src/fw_iso_rx_multiple.h b/src/fw_iso_rx_multiple.h index 80a577c..060eeaf 100644 --- a/src/fw_iso_rx_multiple.h +++ b/src/fw_iso_rx_multiple.h @@ -37,7 +37,6 @@ void hinoko_fw_iso_rx_multiple_map_buffer(HinokoFwIsoRxMultiple *self, guint bytes_per_chunk, guint chunks_per_buffer, GError **error); -void hinoko_fw_iso_rx_multiple_unmap_buffer(HinokoFwIsoRxMultiple *self); void hinoko_fw_iso_rx_multiple_start(HinokoFwIsoRxMultiple *self, const guint16 *cycle_match, guint32 sync, diff --git a/src/fw_iso_rx_single.c b/src/fw_iso_rx_single.c index bdbc4ea..e39e49d 100644 --- a/src/fw_iso_rx_single.c +++ b/src/fw_iso_rx_single.c @@ -117,6 +117,18 @@ static void fw_iso_rx_single_stop(HinokoFwIsoCtx *inst) g_signal_emit_by_name(G_OBJECT(inst), "stopped", NULL); } +static void fw_iso_rx_single_unmap_buffer(HinokoFwIsoCtx *inst) +{ + HinokoFwIsoRxSingle *self; + HinokoFwIsoRxSinglePrivate *priv; + + g_return_if_fail(HINOKO_IS_FW_ISO_RX_SINGLE(inst)); + self = HINOKO_FW_ISO_RX_SINGLE(inst); + priv = hinoko_fw_iso_rx_single_get_instance_private(self); + + fw_iso_ctx_state_unmap_buffer(&priv->state); +} + static gboolean fw_iso_rx_single_get_cycle_timer(HinokoFwIsoCtx *inst, gint clock_id, HinokoCycleTimer *const *cycle_timer, GError **error) @@ -194,6 +206,7 @@ gboolean fw_iso_rx_single_create_source(HinokoFwIsoCtx *inst, GSource **source, static void fw_iso_ctx_iface_init(HinokoFwIsoCtxInterface *iface) { iface->stop = fw_iso_rx_single_stop; + iface->unmap_buffer = fw_iso_rx_single_unmap_buffer; iface->get_cycle_timer = fw_iso_rx_single_get_cycle_timer; iface->flush_completions = fw_iso_rx_single_flush_completions; iface->create_source = fw_iso_rx_single_create_source; @@ -285,23 +298,6 @@ void hinoko_fw_iso_rx_single_map_buffer(HinokoFwIsoRxSingle *self, } /** - * hinoko_fw_iso_rx_single_unmap_buffer: - * @self: A [class@FwIsoRxSingle]. - * - * Unmap intermediate buffer shard with 1394 OHCI controller for payload of IR context. - */ -void hinoko_fw_iso_rx_single_unmap_buffer(HinokoFwIsoRxSingle *self) -{ - HinokoFwIsoRxSinglePrivate *priv; - - g_return_if_fail(HINOKO_IS_FW_ISO_RX_SINGLE(self)); - priv = hinoko_fw_iso_rx_single_get_instance_private(self); - - hinoko_fw_iso_ctx_stop(HINOKO_FW_ISO_CTX(self)); - fw_iso_ctx_state_unmap_buffer(&priv->state); -} - -/** * hinoko_fw_iso_rx_single_register_packet: * @self: A [class@FwIsoRxSingle]. * @schedule_interrupt: Whether to schedule hardware interrupt at isochronous cycle for the packet. diff --git a/src/fw_iso_rx_single.h b/src/fw_iso_rx_single.h index 0eb497e..45c9649 100644 --- a/src/fw_iso_rx_single.h +++ b/src/fw_iso_rx_single.h @@ -43,7 +43,6 @@ void hinoko_fw_iso_rx_single_map_buffer(HinokoFwIsoRxSingle *self, guint maximum_bytes_per_payload, guint payloads_per_buffer, GError **error); -void hinoko_fw_iso_rx_single_unmap_buffer(HinokoFwIsoRxSingle *self); void hinoko_fw_iso_rx_single_register_packet(HinokoFwIsoRxSingle *self, gboolean schedule_interrupt, GError **error); diff --git a/src/fw_iso_tx.c b/src/fw_iso_tx.c index 0c3bd9f..6cb74de 100644 --- a/src/fw_iso_tx.c +++ b/src/fw_iso_tx.c @@ -108,6 +108,18 @@ static void fw_iso_tx_stop(HinokoFwIsoCtx *inst) g_signal_emit_by_name(G_OBJECT(inst), "stopped", NULL); } +void fw_iso_tx_unmap_buffer(HinokoFwIsoCtx *inst) +{ + HinokoFwIsoTx *self; + HinokoFwIsoTxPrivate *priv; + + g_return_if_fail(HINOKO_IS_FW_ISO_TX(inst)); + self = HINOKO_FW_ISO_TX(inst); + priv = hinoko_fw_iso_tx_get_instance_private(self); + + fw_iso_ctx_state_unmap_buffer(&priv->state); +} + static gboolean fw_iso_tx_get_cycle_timer(HinokoFwIsoCtx *inst, gint clock_id, HinokoCycleTimer *const *cycle_timer, GError **error) @@ -176,6 +188,7 @@ gboolean fw_iso_tx_create_source(HinokoFwIsoCtx *inst, GSource **source, GError static void fw_iso_ctx_iface_init(HinokoFwIsoCtxInterface *iface) { iface->stop = fw_iso_tx_stop; + iface->unmap_buffer = fw_iso_tx_unmap_buffer; iface->get_cycle_timer = fw_iso_tx_get_cycle_timer; iface->flush_completions = fw_iso_tx_flush_completions; iface->create_source = fw_iso_tx_create_source; @@ -262,23 +275,6 @@ void hinoko_fw_iso_tx_map_buffer(HinokoFwIsoTx *self, } /** - * hinoko_fw_iso_tx_unmap_buffer: - * @self: A [class@FwIsoTx]. - * - * Unmap intermediate buffer shard with 1394 OHCI controller for payload of IT context. - */ -void hinoko_fw_iso_tx_unmap_buffer(HinokoFwIsoTx *self) -{ - HinokoFwIsoTxPrivate *priv; - - g_return_if_fail(HINOKO_IS_FW_ISO_TX(self)); - priv = hinoko_fw_iso_tx_get_instance_private(self); - - hinoko_fw_iso_ctx_stop(HINOKO_FW_ISO_CTX(self)); - fw_iso_ctx_state_unmap_buffer(&priv->state); -} - -/** * hinoko_fw_iso_tx_start: * @self: A [class@FwIsoTx]. * @cycle_match: (array fixed-size=2) (element-type guint16) (in) (nullable): The isochronous cycle diff --git a/src/fw_iso_tx.h b/src/fw_iso_tx.h index 06793e7..e47ccc7 100644 --- a/src/fw_iso_tx.h +++ b/src/fw_iso_tx.h @@ -41,7 +41,6 @@ void hinoko_fw_iso_tx_map_buffer(HinokoFwIsoTx *self, guint maximum_bytes_per_payload, guint payloads_per_buffer, GError **error); -void hinoko_fw_iso_tx_unmap_buffer(HinokoFwIsoTx *self); void hinoko_fw_iso_tx_start(HinokoFwIsoTx *self, const guint16 *cycle_match, GError **error); diff --git a/src/hinoko.map b/src/hinoko.map index 05f3fc7..7ef5421 100644 --- a/src/hinoko.map +++ b/src/hinoko.map @@ -11,14 +11,12 @@ HINOKO_0_1_0 { "hinoko_fw_iso_rx_single_allocate"; "hinoko_fw_iso_rx_single_release"; "hinoko_fw_iso_rx_single_map_buffer"; - "hinoko_fw_iso_rx_single_unmap_buffer"; "hinoko_fw_iso_rx_single_get_payload"; "hinoko_fw_iso_rx_multiple_new"; "hinoko_fw_iso_rx_multiple_allocate"; "hinoko_fw_iso_rx_multiple_release"; "hinoko_fw_iso_rx_multiple_map_buffer"; - "hinoko_fw_iso_rx_multiple_unmap_buffer"; "hinoko_fw_iso_rx_multiple_start"; "hinoko_fw_iso_rx_multiple_get_payload"; @@ -26,7 +24,6 @@ HINOKO_0_1_0 { "hinoko_fw_iso_tx_allocate"; "hinoko_fw_iso_tx_release"; "hinoko_fw_iso_tx_map_buffer"; - "hinoko_fw_iso_tx_unmap_buffer"; local: *; }; @@ -76,6 +73,7 @@ HINOKO_0_7_0 { global: "hinoko_fw_iso_ctx_get_type"; "hinoko_fw_iso_ctx_stop"; + "hinoko_fw_iso_ctx_unmap_buffer"; "hinoko_fw_iso_rx_single_get_type"; "hinoko_fw_iso_rx_multiple_get_type"; |