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 | 8eca90bb42cd58087eb5db3dc83e58b5e4222649 (patch) | |
tree | d4a521e832b46e50eacc382cb2b5871c04e7e4db | |
parent | 643009db8a09bebdd4b1bcc1651985c6b18dfe1c (diff) | |
download | libhinoko-8eca90bb42cd58087eb5db3dc83e58b5e4222649.tar.gz |
fw_iso_ctx: code refactoring to split flush completions function
It's planned to make Hinoko.FwIsoCtx as interface. It's convenient
for derived object to use private helper function apart from public API
to call virtual function.
This commit splits current implementaion of
Hinoko.FwIsoResource.flush_completions() into public API part and private
implementation.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r-- | src/fw_iso_ctx.c | 3 | ||||
-rw-r--r-- | src/fw_iso_ctx_private.c | 19 | ||||
-rw-r--r-- | src/fw_iso_ctx_private.h | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/fw_iso_ctx.c b/src/fw_iso_ctx.c index 72ec18c..1953d5a 100644 --- a/src/fw_iso_ctx.c +++ b/src/fw_iso_ctx.c @@ -553,6 +553,5 @@ void hinoko_fw_iso_ctx_flush_completions(HinokoFwIsoCtx *self, GError **error) g_return_if_fail(HINOKO_IS_FW_ISO_CTX(self)); priv = hinoko_fw_iso_ctx_get_instance_private(self); - if (ioctl(priv->fd, FW_CDEV_IOC_FLUSH_ISO) < 0) - generate_syscall_error(error, errno, "ioctl(%s)", "FW_CDEV_IOC_FLUSH_ISO"); + (void)fw_iso_ctx_state_flush_completions(priv, error); } diff --git a/src/fw_iso_ctx_private.c b/src/fw_iso_ctx_private.c index c8f6dc8..123cc8b 100644 --- a/src/fw_iso_ctx_private.c +++ b/src/fw_iso_ctx_private.c @@ -501,3 +501,22 @@ void fw_iso_ctx_state_read_frame(struct fw_iso_ctx_state *state, guint offset, g else *frame_size = bytes_per_buffer - offset; } + +/** + * fw_iso_ctx_state_flush_completions: + * @state: A [struct@FwIsoCtxState]. + * @error: A [struct@GLib.Error]. + * + * 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. + */ +gboolean fw_iso_ctx_state_flush_completions(struct fw_iso_ctx_state *state, GError **error) +{ + if (ioctl(state->fd, FW_CDEV_IOC_FLUSH_ISO) < 0) { + generate_syscall_error(error, errno, "ioctl(%s)", "FW_CDEV_IOC_FLUSH_ISO"); + return FALSE; + } + + return TRUE; +} diff --git a/src/fw_iso_ctx_private.h b/src/fw_iso_ctx_private.h index 8de0fdb..ffc23dd 100644 --- a/src/fw_iso_ctx_private.h +++ b/src/fw_iso_ctx_private.h @@ -66,6 +66,8 @@ void fw_iso_ctx_state_stop(struct fw_iso_ctx_state *state); void fw_iso_ctx_state_read_frame(struct fw_iso_ctx_state *state, guint offset, guint length, const guint8 **frame, guint *frame_size); +gboolean fw_iso_ctx_state_flush_completions(struct fw_iso_ctx_state *state, GError **error); + void hinoko_fw_iso_ctx_allocate(HinokoFwIsoCtx *self, const char *path, HinokoFwIsoCtxMode mode, HinokoFwScode scode, guint channel, guint header_size, |