diff options
| author | 2008-12-02 12:48:23 +0100 | |
|---|---|---|
| committer | 2008-12-03 19:56:36 -0800 | |
| commit | fbe1fa46c66d45af8fb93cf82d4d4344cc6d431b (patch) | |
| tree | 9045df29caacc8efcd99c4792b2b0825cb2a3eed /src/fw.c | |
| parent | [libraw1394 patch] Fix raw1394_channel_modify() on firewire-core (diff) | |
[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>
Diffstat (limited to 'src/fw.c')
| -rw-r--r-- | src/fw.c | 49 |
1 files changed, 0 insertions, 49 deletions
@@ -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; -} |
