aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-12-18 10:44:46 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-12-18 15:38:44 +0900
commite13e0d023c1197b5f19a22c76229533e0b60c8e1 (patch)
tree46073bee07da670ea487e587ee248a576459407c
parent308618374a3442cb20a13b20eb7a8fc2270547ba (diff)
downloadlibhinoko-e13e0d023c1197b5f19a22c76229533e0b60c8e1.tar.gz
enums: rename mode of isochronous contexts
In teminology of device driver development, the choice of word is device-oriented, thus 'rx' is for incoming data path to target device, and 'tx' is for outgoing data path from target device. Current implementation uses the words for different ways. This commit corrects the usage of words with loss of backward compatibility. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--src/fw_iso_ctx_private.c30
-rw-r--r--src/fw_iso_rx_multiple.c2
-rw-r--r--src/fw_iso_rx_single.c2
-rw-r--r--src/fw_iso_tx.c2
-rw-r--r--src/hinoko_enum_types.h12
-rw-r--r--tests/hinoko-enum6
6 files changed, 27 insertions, 27 deletions
diff --git a/src/fw_iso_ctx_private.c b/src/fw_iso_ctx_private.c
index 2c27d28..9f02157 100644
--- a/src/fw_iso_ctx_private.c
+++ b/src/fw_iso_ctx_private.c
@@ -82,9 +82,9 @@ gboolean fw_iso_ctx_state_allocate(struct fw_iso_ctx_state *state, const char *p
// Linux firewire stack supports three types of isochronous context
// described in 1394 OHCI specification.
- g_return_val_if_fail(mode == HINOKO_FW_ISO_CTX_MODE_TX ||
- mode == HINOKO_FW_ISO_CTX_MODE_RX_SINGLE ||
- mode == HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE, FALSE);
+ g_return_val_if_fail(mode == HINOKO_FW_ISO_CTX_MODE_IT ||
+ mode == HINOKO_FW_ISO_CTX_MODE_IR_SINGLE ||
+ mode == HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE, FALSE);
g_return_val_if_fail(scode == HINOKO_FW_SCODE_S100 ||
scode == HINOKO_FW_SCODE_S200 ||
@@ -99,10 +99,10 @@ gboolean fw_iso_ctx_state_allocate(struct fw_iso_ctx_state *state, const char *p
// Headers should be aligned to quadlet.
g_return_val_if_fail(header_size % 4 == 0, FALSE);
- if (mode == HINOKO_FW_ISO_CTX_MODE_RX_SINGLE) {
+ if (mode == HINOKO_FW_ISO_CTX_MODE_IR_SINGLE) {
// At least, 1 quadlet is required for iso_header.
g_return_val_if_fail(header_size >= 4, FALSE);
- } else if (mode == HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE) {
+ } else if (mode == HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE) {
// Needless.
g_return_val_if_fail(header_size == 0, FALSE);
g_return_val_if_fail(channel == 0, FALSE);
@@ -193,7 +193,7 @@ gboolean fw_iso_ctx_state_map_buffer(struct fw_iso_ctx_state *state, guint bytes
}
datum_size = sizeof(struct fw_cdev_iso_packet);
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX)
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT)
datum_size += state->header_size;
state->data = g_malloc_n(chunks_per_buffer, datum_size);
@@ -201,7 +201,7 @@ gboolean fw_iso_ctx_state_map_buffer(struct fw_iso_ctx_state *state, guint bytes
state->alloc_data_length = chunks_per_buffer * datum_size;
prot = PROT_READ;
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX)
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT)
prot |= PROT_WRITE;
// Align to size of page.
@@ -272,7 +272,7 @@ gboolean fw_iso_ctx_state_register_chunk(struct fw_iso_ctx_state *state, gboolea
g_return_val_if_fail(sync_code <= IEEE1394_MAX_SYNC_CODE, FALSE);
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX) {
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT) {
if (!skip) {
g_return_val_if_fail(header_length == state->header_size, FALSE);
g_return_val_if_fail(payload_length <= state->bytes_per_chunk, FALSE);
@@ -281,8 +281,8 @@ gboolean fw_iso_ctx_state_register_chunk(struct fw_iso_ctx_state *state, gboolea
g_return_val_if_fail(header_length == 0, FALSE);
g_return_val_if_fail(header == NULL, FALSE);
}
- } else if (state->mode == HINOKO_FW_ISO_CTX_MODE_RX_SINGLE ||
- state->mode == HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE) {
+ } else if (state->mode == HINOKO_FW_ISO_CTX_MODE_IR_SINGLE ||
+ state->mode == HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE) {
g_return_val_if_fail(tags == 0, FALSE);
g_return_val_if_fail(sync_code == 0, FALSE);
g_return_val_if_fail(header == NULL, FALSE);
@@ -308,13 +308,13 @@ gboolean fw_iso_ctx_state_register_chunk(struct fw_iso_ctx_state *state, gboolea
state->data_length += sizeof(*datum) + header_length;
++state->registered_chunk_count;
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX) {
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT) {
if (!skip)
memcpy(datum->header, header, header_length);
} else {
payload_length = state->bytes_per_chunk;
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_RX_SINGLE)
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IR_SINGLE)
header_length = state->header_size;
}
@@ -389,7 +389,7 @@ gboolean fw_iso_ctx_state_queue_chunks(struct fw_iso_ctx_state *state, GError **
}
datum_length = sizeof(*datum);
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX)
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT)
datum_length += header_length;
g_debug("%3d: %3d-%3d/%3d: %6d-%6d/%6d: %d",
@@ -480,7 +480,7 @@ gboolean fw_iso_ctx_state_start(struct fw_iso_ctx_state *state, const guint16 *c
return FALSE;
}
- if (state->mode == HINOKO_FW_ISO_CTX_MODE_TX) {
+ if (state->mode == HINOKO_FW_ISO_CTX_MODE_IT) {
g_return_val_if_fail(cycle_match == NULL ||
cycle_match[0] <= OHCI1394_IT_contextControl_cycleMatch_MAX_SEC ||
cycle_match[1] <= OHCI1394_IT_contextControl_cycleMatch_MAX_CYCLE,
@@ -731,7 +731,7 @@ gboolean fw_iso_ctx_state_create_source(struct fw_iso_ctx_state *state, HinokoFw
src = (FwIsoCtxSource *)(*source);
- if (state->mode != HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE) {
+ if (state->mode != HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE) {
// MEMO: Linux FireWire subsystem queues isochronous event
// independently of interrupt flag when the same number of
// bytes as one page is stored in the buffer of header. To
diff --git a/src/fw_iso_rx_multiple.c b/src/fw_iso_rx_multiple.c
index ad36136..2f11c00 100644
--- a/src/fw_iso_rx_multiple.c
+++ b/src/fw_iso_rx_multiple.c
@@ -375,7 +375,7 @@ gboolean hinoko_fw_iso_rx_multiple_allocate(HinokoFwIsoRxMultiple *self, const c
priv = hinoko_fw_iso_rx_multiple_get_instance_private(self);
- if (!fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE, 0,
+ if (!fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE, 0,
0, 0, error))
return FALSE;
diff --git a/src/fw_iso_rx_single.c b/src/fw_iso_rx_single.c
index cb8af63..3517daf 100644
--- a/src/fw_iso_rx_single.c
+++ b/src/fw_iso_rx_single.c
@@ -270,7 +270,7 @@ gboolean hinoko_fw_iso_rx_single_allocate(HinokoFwIsoRxSingle *self, const char
priv = hinoko_fw_iso_rx_single_get_instance_private(self);
- if (!fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_RX_SINGLE, 0,
+ if (!fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_IR_SINGLE, 0,
channel, header_size, error))
return FALSE;
diff --git a/src/fw_iso_tx.c b/src/fw_iso_tx.c
index 67508d2..8d082f6 100644
--- a/src/fw_iso_tx.c
+++ b/src/fw_iso_tx.c
@@ -247,7 +247,7 @@ gboolean hinoko_fw_iso_tx_allocate(HinokoFwIsoTx *self, const char *path, Hinoko
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
priv = hinoko_fw_iso_tx_get_instance_private(self);
- return fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_TX, scode,
+ return fw_iso_ctx_state_allocate(&priv->state, path, HINOKO_FW_ISO_CTX_MODE_IT, scode,
channel, header_size, error);
}
diff --git a/src/hinoko_enum_types.h b/src/hinoko_enum_types.h
index e429dab..c54fbd7 100644
--- a/src/hinoko_enum_types.h
+++ b/src/hinoko_enum_types.h
@@ -6,18 +6,18 @@ G_BEGIN_DECLS
/**
* HinokoFwIsoCtxMode:
- * @HINOKO_FW_ISO_CTX_MODE_TX: The mode of IT context of 1394 OHCI.
- * @HINOKO_FW_ISO_CTX_MODE_RX_SINGLE: The mode of IR context of 1394 OHCI with
+ * @HINOKO_FW_ISO_CTX_MODE_IT: The mode of IT context of 1394 OHCI.
+ * @HINOKO_FW_ISO_CTX_MODE_IR_SINGLE: The mode of IR context of 1394 OHCI with
* packer-per-buffer protocol
- * @HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE: The mode of IR context of 1394 OHCI with
+ * @HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE: The mode of IR context of 1394 OHCI with
* buffer-fill protocol.
*
* A set of mode for isochronous context of Linux FireWire subsystem.
*/
typedef enum {
- HINOKO_FW_ISO_CTX_MODE_TX = FW_CDEV_ISO_CONTEXT_TRANSMIT,
- HINOKO_FW_ISO_CTX_MODE_RX_SINGLE = FW_CDEV_ISO_CONTEXT_RECEIVE,
- HINOKO_FW_ISO_CTX_MODE_RX_MULTIPLE = FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL,
+ HINOKO_FW_ISO_CTX_MODE_IT = FW_CDEV_ISO_CONTEXT_TRANSMIT,
+ HINOKO_FW_ISO_CTX_MODE_IR_SINGLE = FW_CDEV_ISO_CONTEXT_RECEIVE,
+ HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE = FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL,
} HinokoFwIsoCtxMode;
/**
diff --git a/tests/hinoko-enum b/tests/hinoko-enum
index ff1aa7e..1c7c3e9 100644
--- a/tests/hinoko-enum
+++ b/tests/hinoko-enum
@@ -10,9 +10,9 @@ gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
fw_iso_ctx_mode_enumerators = (
- 'TX',
- 'RX_SINGLE',
- 'RX_MULTIPLE',
+ 'IT',
+ 'IR_SINGLE',
+ 'IR_MULTIPLE',
)
fw_scode_enumerators = (