aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-12-02 12:48:23 +0100
committerDan Dennedy <dan@dennedy.org>2008-12-03 19:56:36 -0800
commitfbe1fa46c66d45af8fb93cf82d4d4344cc6d431b (patch)
tree9045df29caacc8efcd99c4792b2b0825cb2a3eed
parent788442d4031ecf06f00415e865cdd776d3c579f2 (diff)
downloadlibraw1394-fbe1fa46c66d45af8fb93cf82d4d4344cc6d431b.tar.gz
[libraw1394 patch] Unify {ieee1394,fw}_bandwidth_modify()
because they do the same. We only may want a separate fw_bandwidth_modify() in the future when firewire-core gains a special ioctl() for that. (Not runtime-tested, but it looks good to me.) Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Dan Dennedy <dan@dennedy.org>
-rw-r--r--src/dispatch.c5
-rw-r--r--src/fw.c49
-rw-r--r--src/fw.h3
3 files changed, 1 insertions, 56 deletions
diff --git a/src/dispatch.c b/src/dispatch.c
index b5b123e..49ceca2 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -541,10 +541,7 @@ int raw1394_bandwidth_modify (raw1394handle_t handle, unsigned int bandwidth,
errno = EINVAL;
return -1;
}
- if (handle->is_fw)
- return fw_bandwidth_modify(handle, bandwidth, mode);
- else
- return ieee1394_bandwidth_modify(handle, bandwidth, mode);
+ return ieee1394_bandwidth_modify(handle, bandwidth, mode);
}
int raw1394_channel_modify (raw1394handle_t handle, unsigned int channel,
diff --git a/src/fw.c b/src/fw.c
index f5a9d95..03e34a7 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -1293,52 +1293,3 @@ fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
return 0;
}
-
-#define MAXIMUM_BANDWIDTH 4915
-
-int
-fw_bandwidth_modify (raw1394handle_t handle,
- unsigned int bandwidth,
- enum raw1394_modify_mode mode)
-{
- quadlet_t buffer, compare, swap;
- nodeaddr_t addr;
- int result;
-
- if (bandwidth == 0)
- return 0;
-
- addr = CSR_REGISTER_BASE + CSR_BANDWIDTH_AVAILABLE;
- /* Read current bandwidth usage from IRM. */
- result = raw1394_read (handle, raw1394_get_irm_id (handle), addr,
- sizeof buffer, &buffer);
- if (result < 0)
- return -1;
-
- compare = ntohl (buffer);
- switch (mode) {
- case RAW1394_MODIFY_ALLOC:
- if (compare < bandwidth)
- return -1;
-
- swap = compare - bandwidth;
- break;
-
- case RAW1394_MODIFY_FREE:
- swap = compare + bandwidth;
- if (swap > MAXIMUM_BANDWIDTH)
- swap = MAXIMUM_BANDWIDTH;
- break;
-
- default:
- return -1;
- }
-
- result = raw1394_lock(handle, raw1394_get_irm_id (handle), addr,
- RAW1394_EXTCODE_COMPARE_SWAP,
- htonl(swap), htonl(compare), &buffer);
- if (result < 0 || ntohl(buffer) != compare)
- return -1;
-
- return 0;
-}
diff --git a/src/fw.h b/src/fw.h
index 0bb3fcd..5b99245 100644
--- a/src/fw.h
+++ b/src/fw.h
@@ -211,9 +211,6 @@ int fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
int fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
size_t buffersize, size_t *rom_size,
unsigned char *rom_version);
-int fw_bandwidth_modify (raw1394handle_t handle,
- unsigned int bandwidth,
- enum raw1394_modify_mode mode);
int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
int prebuffer_packets);