summaryrefslogtreecommitdiffstats
path: root/juju
diff options
context:
space:
mode:
authorGravatar Dan Dennedy 2008-04-23 17:44:36 -0700
committerGravatar Dan Dennedy 2008-04-23 17:44:36 -0700
commit0ea462ae9895ca903c8d3134910c06e1869560c4 (patch)
treec1b72a170cfca14c1b9cccd552e5cadc249bd483 /juju
parentFix configure.ac missing fi after initial merge. (diff)
First cut at integrating juju
This is currently working with legacy ieee1394 and tools/testlibraw.
Diffstat (limited to 'juju')
-rw-r--r--juju/Makefile.am2
-rw-r--r--juju/juju.h120
-rw-r--r--juju/raw1394-iso.c123
-rw-r--r--juju/raw1394.c292
4 files changed, 294 insertions, 243 deletions
diff --git a/juju/Makefile.am b/juju/Makefile.am
index 6fd6a5e..af7501a 100644
--- a/juju/Makefile.am
+++ b/juju/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libraw1394.la
-INCLUDES = -I$(JUJU_DIR)
+INCLUDES = -I$(FW_DIR)
libraw1394_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@
libraw1394_la_SOURCES = raw1394.c raw1394-iso.c juju.h
diff --git a/juju/juju.h b/juju/juju.h
index 8746ac2..fc0eba1 100644
--- a/juju/juju.h
+++ b/juju/juju.h
@@ -52,6 +52,8 @@ cpu_to_be32(__u32 q)
#define MAX_PORTS 16
+struct fw_handle;
+
struct epoll_closure {
int (*func)(raw1394handle_t handle,
struct epoll_closure *closure, __uint32_t events);
@@ -84,12 +86,12 @@ struct request_closure {
struct allocation;
-struct raw1394_handle {
+struct fw_handle {
struct port ports[MAX_PORTS];
int port_count;
int err;
int generation;
- void *user_data;
+ void *userdata;
int notify_bus_reset;
bus_reset_handler_t bus_reset_handler;
@@ -137,5 +139,119 @@ struct raw1394_handle {
char buffer[BUFFER_SIZE];
};
+typedef struct fw_handle *fw_handle_t;
+
+int fw_loop_iterate(raw1394handle_t handle);
+fw_handle_t fw_new_handle(void);
+void fw_destroy_handle(fw_handle_t handle);
+fw_handle_t fw_new_handle_on_port(int port);
+int fw_busreset_notify (fw_handle_t handle, int off_on_switch);
+int fw_get_fd(fw_handle_t handle);
+nodeid_t fw_get_local_id(fw_handle_t handle);
+nodeid_t fw_get_irm_id(fw_handle_t handle);
+int fw_get_nodecount(fw_handle_t handle);
+int fw_get_port_info(fw_handle_t handle, struct raw1394_portinfo *pinf,
+ int maxports);
+int fw_set_port(fw_handle_t handle, int port);
+int fw_reset_bus_new(fw_handle_t handle, int type);
+int fw_arm_register(fw_handle_t handle, nodeaddr_t start,
+ size_t length, byte_t *initial_value,
+ octlet_t arm_tag, arm_options_t access_rights,
+ arm_options_t notification_options,
+ arm_options_t client_transactions);
+int fw_arm_unregister(fw_handle_t handle, nodeaddr_t start);
+int fw_arm_set_buf(fw_handle_t handle, nodeaddr_t start,
+ size_t length, void *buf);
+int fw_arm_get_buf(fw_handle_t handle, nodeaddr_t start,
+ size_t length, void *buf);
+int fw_echo_request(fw_handle_t handle, quadlet_t data);
+int fw_wake_up(fw_handle_t handle);
+int fw_phy_packet_write (fw_handle_t handle, quadlet_t data);
+int fw_start_phy_packet_write(fw_handle_t handle,
+ quadlet_t data, unsigned long tag);
+int fw_start_read(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
+ size_t length, quadlet_t *buffer, unsigned long tag);
+int fw_start_write(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
+ size_t length, quadlet_t *data, unsigned long tag);
+int fw_start_lock(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
+ unsigned int extcode, quadlet_t data, quadlet_t arg,
+ quadlet_t *result, unsigned long tag);
+int fw_start_lock64(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
+ unsigned int extcode, octlet_t data, octlet_t arg,
+ octlet_t *result, unsigned long tag);
+int fw_start_async_stream(fw_handle_t handle, unsigned int channel,
+ unsigned int tag, unsigned int sy,
+ unsigned int speed, size_t length, quadlet_t *data,
+ unsigned long rawtag);
+int fw_start_async_send(fw_handle_t handle,
+ size_t length, size_t header_length,
+ unsigned int expect_response,
+ quadlet_t *data, unsigned long rawtag);
+int fw_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+ size_t length, quadlet_t *buffer);
+int fw_write(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+ size_t length, quadlet_t *data);
+int fw_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+ unsigned int extcode, quadlet_t data, quadlet_t arg,
+ quadlet_t *result);
+int fw_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+ unsigned int extcode, octlet_t data, octlet_t arg,
+ octlet_t *result);
+int fw_async_stream(fw_handle_t handle, unsigned int channel,
+ unsigned int tag, unsigned int sy, unsigned int speed,
+ size_t length, quadlet_t *data);
+int fw_async_send(fw_handle_t handle,
+ size_t length, size_t header_length,
+ unsigned int expect_response,
+ quadlet_t *data);
+int fw_start_fcp_listen(fw_handle_t handle);
+int fw_stop_fcp_listen(fw_handle_t handle);
+int fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
+ size_t size, unsigned char rom_version);
+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_channel_modify (raw1394handle_t handle,
+ unsigned int channel,
+ enum raw1394_modify_mode mode);
+
+int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
+ int prebuffer_packets);
+int fw_iso_recv_start(fw_handle_t handle, int start_on_cycle,
+ int tag_mask, int sync);
+int fw_iso_xmit_write(raw1394handle_t handle, unsigned char *data,
+ unsigned int len, unsigned char tag,
+ unsigned char sy);
+int fw_iso_xmit_sync(raw1394handle_t handle);
+int fw_iso_recv_flush(fw_handle_t handle);
+int fw_iso_xmit_init(fw_handle_t handle,
+ raw1394_iso_xmit_handler_t handler,
+ unsigned int buf_packets,
+ unsigned int max_packet_size,
+ unsigned char channel,
+ enum raw1394_iso_speed speed,
+ int irq_interval);
+int fw_iso_recv_init(fw_handle_t handle,
+ raw1394_iso_recv_handler_t handler,
+ unsigned int buf_packets,
+ unsigned int max_packet_size,
+ unsigned char channel,
+ enum raw1394_iso_dma_recv_mode mode,
+ int irq_interval);
+int fw_iso_multichannel_recv_init(fw_handle_t handle,
+ raw1394_iso_recv_handler_t handler,
+ unsigned int buf_packets,
+ unsigned int max_packet_size,
+ int irq_interval);
+int fw_iso_recv_listen_channel(fw_handle_t handle,
+ unsigned char channel);
+int fw_iso_recv_unlisten_channel(fw_handle_t handle,
+ unsigned char channel);
+int fw_iso_recv_set_channel_mask(fw_handle_t handle, u_int64_t mask);
+void fw_iso_stop(fw_handle_t handle);
+void fw_iso_shutdown(fw_handle_t handle);
#endif
diff --git a/juju/raw1394-iso.c b/juju/raw1394-iso.c
index ae8aaad..c02f0e3 100644
--- a/juju/raw1394-iso.c
+++ b/juju/raw1394-iso.c
@@ -29,9 +29,10 @@
#include <sys/ioctl.h>
#include "juju.h"
+#include "../src/raw1394_private.h"
static int
-queue_packet(raw1394handle_t handle,
+queue_packet(fw_handle_t handle,
unsigned int length, unsigned int header_length,
unsigned char tag, unsigned char sy)
{
@@ -80,21 +81,22 @@ queue_packet(raw1394handle_t handle,
static int
queue_xmit_packets(raw1394handle_t handle, int limit)
{
+ fw_handle_t fwhandle = handle->mode.fw;
enum raw1394_iso_disposition d;
unsigned char tag, sy;
int len, cycle, dropped;
- if (handle->iso.xmit_handler == NULL)
+ if (fwhandle->iso.xmit_handler == NULL)
return 0;
- while (handle->iso.packet_count < limit) {
+ while (fwhandle->iso.packet_count < limit) {
- d = handle->iso.xmit_handler(handle, handle->iso.head,
+ d = fwhandle->iso.xmit_handler(handle, fwhandle->iso.head,
&len, &tag, &sy, cycle, dropped);
switch (d) {
case RAW1394_ISO_OK:
- queue_packet(handle, len, 0, tag, sy);
+ queue_packet(fwhandle, len, 0, tag, sy);
break;
case RAW1394_ISO_DEFER:
case RAW1394_ISO_AGAIN:
@@ -103,7 +105,7 @@ queue_xmit_packets(raw1394handle_t handle, int limit)
case RAW1394_ISO_ERROR:
return -1;
case RAW1394_ISO_STOP:
- raw1394_iso_stop(handle);
+ fw_iso_stop(fwhandle);
return 0;
}
}
@@ -111,35 +113,36 @@ queue_xmit_packets(raw1394handle_t handle, int limit)
return 0;
}
-int raw1394_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
+int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
int prebuffer_packets)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct fw_cdev_start_iso start_iso;
int retval;
if (prebuffer_packets == -1)
- prebuffer_packets = handle->iso.irq_interval;
+ prebuffer_packets = fwhandle->iso.irq_interval;
- handle->iso.prebuffer = prebuffer_packets;
- handle->iso.start_on_cycle = start_on_cycle;
+ fwhandle->iso.prebuffer = prebuffer_packets;
+ fwhandle->iso.start_on_cycle = start_on_cycle;
queue_xmit_packets(handle, prebuffer_packets);
- if (handle->iso.prebuffer <= handle->iso.packet_count) {
+ if (fwhandle->iso.prebuffer <= fwhandle->iso.packet_count) {
start_iso.cycle = start_on_cycle;
start_iso.handle = 0;
- retval = ioctl(handle->iso.fd,
+ retval = ioctl(fwhandle->iso.fd,
FW_CDEV_IOC_START_ISO, &start_iso);
if (retval < 0)
return retval;
}
- return queue_xmit_packets(handle, handle->iso.buf_packets);
+ return queue_xmit_packets(handle, fwhandle->iso.buf_packets);
}
static int
-queue_recv_packets(raw1394handle_t handle)
+queue_recv_packets(fw_handle_t handle)
{
while (handle->iso.packet_count <= handle->iso.buf_packets)
queue_packet(handle, handle->iso.max_packet_size, 4, 0, 0);
@@ -151,6 +154,7 @@ static enum raw1394_iso_disposition
flush_recv_packets(raw1394handle_t handle,
struct fw_cdev_event_iso_interrupt *interrupt)
{
+ fw_handle_t fwhandle = handle->mode.fw;
enum raw1394_iso_disposition d;
quadlet_t header, *p, *end;
unsigned int len, cycle, dropped;
@@ -169,7 +173,7 @@ flush_recv_packets(raw1394handle_t handle,
channel = (header >> 8) & 0x3f;
sy = header & 0x0f;
- d = handle->iso.recv_handler(handle, handle->iso.tail, len,
+ d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len,
channel, tag, sy, cycle, dropped);
if (d != RAW1394_ISO_OK)
/* FIXME: we need to save the headers so we
@@ -177,11 +181,11 @@ flush_recv_packets(raw1394handle_t handle,
break;
cycle++;
- handle->iso.tail += handle->iso.max_packet_size;
- handle->iso.packet_count--;
+ fwhandle->iso.tail += fwhandle->iso.max_packet_size;
+ fwhandle->iso.packet_count--;
- if (handle->iso.tail + handle->iso.max_packet_size > handle->iso.buffer_end)
- handle->iso.tail = handle->iso.buffer;
+ if (fwhandle->iso.tail + fwhandle->iso.max_packet_size > fwhandle->iso.buffer_end)
+ fwhandle->iso.tail = fwhandle->iso.buffer;
}
switch (d) {
@@ -194,16 +198,16 @@ flush_recv_packets(raw1394handle_t handle,
return -1;
case RAW1394_ISO_STOP:
- raw1394_iso_stop(handle);
+ fw_iso_stop(fwhandle);
return 0;
}
- queue_recv_packets(handle);
+ queue_recv_packets(fwhandle);
return 0;
}
-int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle,
+int fw_iso_recv_start(fw_handle_t handle, int start_on_cycle,
int tag_mask, int sync)
{
struct fw_cdev_start_iso start_iso;
@@ -223,21 +227,22 @@ int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle,
static int handle_iso_event(raw1394handle_t handle,
struct epoll_closure *closure, __uint32_t events)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct fw_cdev_event_iso_interrupt *interrupt;
int len;
- len = read(handle->iso.fd, handle->buffer, sizeof handle->buffer);
+ len = read(fwhandle->iso.fd, fwhandle->buffer, sizeof fwhandle->buffer);
if (len < 0)
return -1;
- interrupt = (struct fw_cdev_event_iso_interrupt *) handle->buffer;
+ interrupt = (struct fw_cdev_event_iso_interrupt *) fwhandle->buffer;
if (interrupt->type != FW_CDEV_EVENT_ISO_INTERRUPT)
return 0;
- switch (handle->iso.type) {
+ switch (fwhandle->iso.type) {
case FW_CDEV_ISO_CONTEXT_TRANSMIT:
- handle->iso.packet_count -= handle->iso.irq_interval;
- return queue_xmit_packets(handle, handle->iso.buf_packets);
+ fwhandle->iso.packet_count -= fwhandle->iso.irq_interval;
+ return queue_xmit_packets(handle, fwhandle->iso.buf_packets);
case FW_CDEV_ISO_CONTEXT_RECEIVE:
return flush_recv_packets(handle, interrupt);
default:
@@ -246,38 +251,39 @@ static int handle_iso_event(raw1394handle_t handle,
}
}
-int raw1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data,
+int fw_iso_xmit_write(raw1394handle_t handle, unsigned char *data,
unsigned int len, unsigned char tag,
unsigned char sy)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct fw_cdev_queue_iso queue_iso;
struct fw_cdev_start_iso start_iso;
struct fw_cdev_iso_packet *p;
- if (len > handle->iso.max_packet_size) {
+ if (len > fwhandle->iso.max_packet_size) {
errno = EINVAL;
return -1;
}
/* Block until we have space for another packet. */
- while (handle->iso.packet_count + handle->iso.irq_interval >
- handle->iso.buf_packets)
- raw1394_loop_iterate(handle);
+ while (fwhandle->iso.packet_count + fwhandle->iso.irq_interval >
+ fwhandle->iso.buf_packets)
+ fw_loop_iterate(handle);
- memcpy(handle->iso.head, data, len);
- if (queue_packet(handle, len, 0, tag, sy) < 0)
+ memcpy(fwhandle->iso.head, data, len);
+ if (queue_packet(fwhandle, len, 0, tag, sy) < 0)
return -1;
/* Start the streaming if it's not already running and if
* we've buffered up enough packets. */
- if (handle->iso.prebuffer > 0 &&
- handle->iso.packet_count >= handle->iso.prebuffer) {
+ if (fwhandle->iso.prebuffer > 0 &&
+ fwhandle->iso.packet_count >= fwhandle->iso.prebuffer) {
/* Set this to 0 to indicate that we're running. */
- handle->iso.prebuffer = 0;
- start_iso.cycle = handle->iso.start_on_cycle;
+ fwhandle->iso.prebuffer = 0;
+ start_iso.cycle = fwhandle->iso.start_on_cycle;
start_iso.handle = 0;
- len = ioctl(handle->iso.fd,
+ len = ioctl(fwhandle->iso.fd,
FW_CDEV_IOC_START_ISO, &start_iso);
if (len < 0)
return len;
@@ -286,8 +292,9 @@ int raw1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data,
return 0;
}
-int raw1394_iso_xmit_sync(raw1394handle_t handle)
+int fw_iso_xmit_sync(raw1394handle_t handle)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct fw_cdev_iso_packet skip;
struct fw_cdev_queue_iso queue_iso;
int len;
@@ -298,29 +305,29 @@ int raw1394_iso_xmit_sync(raw1394handle_t handle)
queue_iso.data = 0;
queue_iso.handle = 0;
- len = ioctl(handle->iso.fd, FW_CDEV_IOC_QUEUE_ISO, &queue_iso);
+ len = ioctl(fwhandle->iso.fd, FW_CDEV_IOC_QUEUE_ISO, &queue_iso);
if (len < 0)
return -1;
/* Now that we've queued the skip packet, we'll get an
* interrupt when the transmit buffer is flushed, so all we do
* here is wait. */
- while (handle->iso.packet_count > 0)
- raw1394_loop_iterate(handle);
+ while (fwhandle->iso.packet_count > 0)
+ fw_loop_iterate(handle);
/* The iso mainloop thinks that interrutps indicate another
* irq_interval number of packets was sent, so the skip
* interrupt makes it go out of whack. We just reset it. */
- handle->iso.head = handle->iso.buffer;
- handle->iso.tail = handle->iso.buffer;
- handle->iso.first_payload = handle->iso.buffer;
- handle->iso.packet_phase = 0;
- handle->iso.packet_count = 0;
+ fwhandle->iso.head = fwhandle->iso.buffer;
+ fwhandle->iso.tail = fwhandle->iso.buffer;
+ fwhandle->iso.first_payload = fwhandle->iso.buffer;
+ fwhandle->iso.packet_phase = 0;
+ fwhandle->iso.packet_count = 0;
return 0;
}
-int raw1394_iso_recv_flush(raw1394handle_t handle)
+int fw_iso_recv_flush(fw_handle_t handle)
{
/* FIXME: huh, we'll need kernel support here... */
@@ -340,7 +347,7 @@ round_to_power_of_two(unsigned int value)
}
static int
-iso_init(raw1394handle_t handle, int type,
+iso_init(fw_handle_t handle, int type,
raw1394_iso_xmit_handler_t xmit_handler,
raw1394_iso_recv_handler_t recv_handler,
unsigned int buf_packets,
@@ -438,7 +445,7 @@ iso_init(raw1394handle_t handle, int type,
return 0;
}
-int raw1394_iso_xmit_init(raw1394handle_t handle,
+int fw_iso_xmit_init(fw_handle_t handle,
raw1394_iso_xmit_handler_t handler,
unsigned int buf_packets,
unsigned int max_packet_size,
@@ -451,7 +458,7 @@ int raw1394_iso_xmit_init(raw1394handle_t handle,
channel, speed, irq_interval);
}
-int raw1394_iso_recv_init(raw1394handle_t handle,
+int fw_iso_recv_init(fw_handle_t handle,
raw1394_iso_recv_handler_t handler,
unsigned int buf_packets,
unsigned int max_packet_size,
@@ -464,7 +471,7 @@ int raw1394_iso_recv_init(raw1394handle_t handle,
channel, 0, irq_interval);
}
-int raw1394_iso_multichannel_recv_init(raw1394handle_t handle,
+int fw_iso_multichannel_recv_init(fw_handle_t handle,
raw1394_iso_recv_handler_t handler,
unsigned int buf_packets,
unsigned int max_packet_size,
@@ -475,7 +482,7 @@ int raw1394_iso_multichannel_recv_init(raw1394handle_t handle,
return -1;
}
-int raw1394_iso_recv_listen_channel(raw1394handle_t handle,
+int fw_iso_recv_listen_channel(fw_handle_t handle,
unsigned char channel)
{
/* FIXME: multichannel */
@@ -483,7 +490,7 @@ int raw1394_iso_recv_listen_channel(raw1394handle_t handle,
return -1;
}
-int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle,
+int fw_iso_recv_unlisten_channel(fw_handle_t handle,
unsigned char channel)
{
/* FIXME: multichannel */
@@ -491,14 +498,14 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle,
return -1;
}
-int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask)
+int fw_iso_recv_set_channel_mask(fw_handle_t handle, u_int64_t mask)
{
/* FIXME: multichannel */
errno = ENOSYS;
return -1;
}
-void raw1394_iso_stop(raw1394handle_t handle)
+void fw_iso_stop(fw_handle_t handle)
{
struct fw_cdev_stop_iso stop_iso;
@@ -512,7 +519,7 @@ void raw1394_iso_stop(raw1394handle_t handle)
handle->iso.packet_count = 0;
}
-void raw1394_iso_shutdown(raw1394handle_t handle)
+void fw_iso_shutdown(fw_handle_t handle)
{
munmap(handle->iso.buffer,
handle->iso.buf_packets * handle->iso.max_packet_size);
diff --git a/juju/raw1394.c b/juju/raw1394.c
index 7f73b3b..73c8705 100644
--- a/juju/raw1394.c
+++ b/juju/raw1394.c
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 8 -*-
*
- * raw1394.c -- Emulation of the raw1394 API on the juju stack
+ * raw1394.c -- Emulation of the raw1394 API on the fw stack
*
* Copyright (C) 2007 Kristian Hoegsberg <krh@bitplanet.net>
*
@@ -32,15 +32,10 @@
#include <arpa/inet.h> /* for ntohl and htonl */
#include "juju.h"
-
-raw1394_errcode_t
-raw1394_get_errcode(raw1394handle_t handle)
-{
- return handle->err;
-}
+#include "../src/raw1394_private.h"
int
-raw1394_errcode_to_errno(raw1394_errcode_t errcode)
+fw_errcode_to_errno(raw1394_errcode_t errcode)
{
switch (errcode) {
@@ -67,17 +62,17 @@ raw1394_errcode_to_errno(raw1394_errcode_t errcode)
}
static int
-juju_to_raw1394_errcode(int rcode)
+fw_to_raw1394_errcode(int rcode)
{
- /* Best effort matching juju extended rcodes to raw1394 err
+ /* Best effort matching fw extended rcodes to raw1394 err
* code. Since the raw1394 errcode decoding are macros we try
- * to convert the juju rcodes to something that looks enough
+ * to convert the fw rcodes to something that looks enough
* like the raw1394 errcodes that we retain ABI compatibility.
*
* Juju rcodes less than 0x10 are standard ieee1394 rcodes,
* which we map to a raw1394 errcode by or'ing in an
* ACK_COMPLETE ack code in the upper 16 bits. Errors
- * internal to raw1394 are negative values, but juju encodes
+ * internal to raw1394 are negative values, but fw encodes
* these errors as rcodes greater than or equal to 0x10. In
* this case, we just the negated value, which will look like
* an raw1394 internal error code. */
@@ -115,15 +110,15 @@ default_arm_tag_handler(raw1394handle_t handle, unsigned long arm_tag,
}
static int
-default_bus_reset_handler(struct raw1394_handle *handle, unsigned int gen)
+default_bus_reset_handler(raw1394handle_t handle, unsigned int gen)
{
- raw1394_update_generation(handle, gen);
+ handle->mode.fw->generation = gen;
return 0;
}
static int
-scan_devices(raw1394handle_t handle)
+scan_devices(fw_handle_t handle)
{
DIR *dir;
struct dirent *de;
@@ -185,14 +180,14 @@ handle_echo_pipe(raw1394handle_t handle,
{
quadlet_t value;
- if (read(handle->pipe_fds[0], &value, sizeof value) < 0)
+ if (read(handle->mode.fw->pipe_fds[0], &value, sizeof value) < 0)
return -1;
return value;
}
static int
-handle_lost_device(raw1394handle_t handle, int i)
+handle_lost_device(fw_handle_t handle, int i)
{
int phy_id;
@@ -225,13 +220,13 @@ handle_fcp_request(raw1394handle_t handle, struct address_closure *ac,
response.length = 0;
response.data = 0;
- if (handle->fcp_handler == NULL)
+ if (handle->mode.fw->fcp_handler == NULL)
response.rcode = RCODE_ADDRESS_ERROR;
if (request->tcode >= TCODE_WRITE_RESPONSE)
response.rcode = RCODE_CONFLICT_ERROR;
- if (ioctl(handle->devices[i].fd,
+ if (ioctl(handle->mode.fw->devices[i].fd,
FW_CDEV_IOC_SEND_RESPONSE, &response) < 0)
return -1;
@@ -240,8 +235,8 @@ handle_fcp_request(raw1394handle_t handle, struct address_closure *ac,
is_response = request->offset >= CSR_REGISTER_BASE + CSR_FCP_RESPONSE;
- return handle->fcp_handler(handle,
- handle->devices[i].node_id,
+ return handle->mode.fw->fcp_handler(handle,
+ handle->mode.fw->devices[i].node_id,
is_response,
request->length,
(unsigned char *) request->data);
@@ -251,6 +246,7 @@ static int
handle_device_event(raw1394handle_t handle,
struct epoll_closure *ec, __uint32_t events)
{
+ fw_handle_t fwhandle = handle->mode.fw;
union fw_cdev_event *u;
struct device *device = (struct device *) ec;
struct address_closure *ac;
@@ -259,31 +255,31 @@ handle_device_event(raw1394handle_t handle,
int len, phy_id;
int i;
- i = device - handle->devices;
+ i = device - fwhandle->devices;
if (events == EPOLLHUP)
- return handle_lost_device(handle, i);
+ return handle_lost_device(fwhandle, i);
- len = read(handle->devices[i].fd,
- handle->buffer, sizeof handle->buffer);
+ len = read(fwhandle->devices[i].fd,
+ fwhandle->buffer, sizeof fwhandle->buffer);
if (len < 0)
return -1;
- u = (void *) handle->buffer;
+ u = (void *) fwhandle->buffer;
switch (u->common.type) {
case FW_CDEV_EVENT_BUS_RESET:
/* Clear old entry, unless it's been overwritten. */
- phy_id = handle->devices[i].node_id & 0x3f;
- if (handle->nodes[phy_id] == i)
- handle->nodes[phy_id] = -1;
- handle->nodes[u->bus_reset.node_id & 0x3f] = i;
- handle->devices[i].node_id = u->bus_reset.node_id;
- handle->devices[i].generation = u->bus_reset.generation;
+ phy_id = fwhandle->devices[i].node_id & 0x3f;
+ if (fwhandle->nodes[phy_id] == i)
+ fwhandle->nodes[phy_id] = -1;
+ fwhandle->nodes[u->bus_reset.node_id & 0x3f] = i;
+ fwhandle->devices[i].node_id = u->bus_reset.node_id;
+ fwhandle->devices[i].generation = u->bus_reset.generation;
if (u->bus_reset.node_id != u->bus_reset.local_node_id)
return 0;
- memcpy(&handle->reset, &u->bus_reset, sizeof handle->reset);
- return handle->bus_reset_handler(handle,
+ memcpy(&fwhandle->reset, &u->bus_reset, sizeof fwhandle->reset);
+ return fwhandle->bus_reset_handler(handle,
u->bus_reset.generation);
case FW_CDEV_EVENT_RESPONSE:
@@ -292,9 +288,9 @@ handle_device_event(raw1394handle_t handle,
if (rc->data != NULL)
memcpy(rc->data, u->response.data, rc->length);
- errcode = juju_to_raw1394_errcode(u->response.rcode);
+ errcode = fw_to_raw1394_errcode(u->response.rcode);
- return handle->tag_handler(handle, rc->tag, errcode);
+ return fwhandle->tag_handler(handle, rc->tag, errcode);
case FW_CDEV_EVENT_REQUEST:
ac = u64_to_ptr(u->request.closure);
@@ -311,6 +307,7 @@ static int
handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
__uint32_t events)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct inotify_event *event;
char filename[32];
struct fw_cdev_get_info info;
@@ -318,8 +315,8 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
struct epoll_event ep;
int i, len, fd, phy_id;
- event = (struct inotify_event *) handle->buffer;
- len = read(handle->inotify_fd, event, BUFFER_SIZE);
+ event = (struct inotify_event *) fwhandle->buffer;
+ len = read(fwhandle->inotify_fd, event, BUFFER_SIZE);
if (!(event->mask & IN_CREATE))
return -1;
if (strncmp(event->name,
@@ -354,7 +351,7 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
}
for (i = 0; i < MAX_DEVICES; i++)
- if (handle->devices[i].node_id == -1)
+ if (fwhandle->devices[i].node_id == -1)
break;
if (i == MAX_DEVICES) {
close(fd);
@@ -362,16 +359,16 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
}
phy_id = reset.node_id & 0x3f;
- handle->nodes[phy_id] = i;
- handle->devices[i].node_id = reset.node_id;
- handle->devices[i].generation = reset.generation;
- handle->devices[i].fd = fd;
- strncpy(handle->devices[i].filename, filename,
- sizeof handle->devices[i].filename);
- handle->devices[i].closure.func = handle_device_event;
+ fwhandle->nodes[phy_id] = i;
+ fwhandle->devices[i].node_id = reset.node_id;
+ fwhandle->devices[i].generation = reset.generation;
+ fwhandle->devices[i].fd = fd;
+ strncpy(fwhandle->devices[i].filename, filename,
+ sizeof fwhandle->devices[i].filename);
+ fwhandle->devices[i].closure.func = handle_device_event;
ep.events = EPOLLIN;
- ep.data.ptr = &handle->devices[i].closure;
- if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
+ ep.data.ptr = &fwhandle->devices[i].closure;
+ if (epoll_ctl(fwhandle->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
close(fd);
return -1;
}
@@ -379,13 +376,13 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec,
return 0;
}
-int raw1394_loop_iterate(raw1394handle_t handle)
+int fw_loop_iterate(raw1394handle_t handle)
{
int i, count, retval = 0;
struct epoll_closure *closure;
struct epoll_event ep[32];
- count = epoll_wait(handle->epoll_fd, ep, ARRAY_LENGTH(ep), -1);
+ count = epoll_wait(handle->mode.fw->epoll_fd, ep, ARRAY_LENGTH(ep), -1);
if (count < 0)
return -1;
@@ -396,14 +393,14 @@ int raw1394_loop_iterate(raw1394handle_t handle)
/* It looks like we have to add this work-around to get epoll
* to recompute the POLLIN status of the epoll_fd. */
- epoll_wait(handle->epoll_fd, ep, ARRAY_LENGTH(ep), 0);
+ epoll_wait(handle->mode.fw->epoll_fd, ep, ARRAY_LENGTH(ep), 0);
return retval;
}
-raw1394handle_t raw1394_new_handle(void)
+fw_handle_t fw_new_handle(void)
{
- raw1394handle_t handle;
+ fw_handle_t handle;
struct epoll_event ep;
int i;
@@ -469,7 +466,7 @@ raw1394handle_t raw1394_new_handle(void)
return NULL;
}
-void raw1394_destroy_handle(raw1394handle_t handle)
+void fw_destroy_handle(fw_handle_t handle)
{
int i;
@@ -491,58 +488,48 @@ void raw1394_destroy_handle(raw1394handle_t handle)
return;
}
-raw1394handle_t raw1394_new_handle_on_port(int port)
+fw_handle_t fw_new_handle_on_port(int port)
{
- raw1394handle_t handle;
+ fw_handle_t handle;
- handle = raw1394_new_handle();
+ handle = fw_new_handle();
if (handle == NULL)
return NULL;
- if (raw1394_set_port(handle, port) < 0)
+ if (fw_set_port(handle, port) < 0)
return NULL;
return handle;
}
-int raw1394_busreset_notify (raw1394handle_t handle, int off_on_switch)
+int fw_busreset_notify (fw_handle_t handle, int off_on_switch)
{
handle->notify_bus_reset = off_on_switch;
return 0;
}
-int raw1394_get_fd(raw1394handle_t handle)
+int fw_get_fd(fw_handle_t handle)
{
return handle->epoll_fd;
}
-void raw1394_set_userdata(raw1394handle_t handle, void *data)
-{
- handle->user_data = data;
-}
-
-void *raw1394_get_userdata(raw1394handle_t handle)
-{
- return handle->user_data;
-}
-
-nodeid_t raw1394_get_local_id(raw1394handle_t handle)
+nodeid_t fw_get_local_id(fw_handle_t handle)
{
return handle->reset.local_node_id;
}
-nodeid_t raw1394_get_irm_id(raw1394handle_t handle)
+nodeid_t fw_get_irm_id(fw_handle_t handle)
{
return handle->reset.irm_node_id;
}
-int raw1394_get_nodecount(raw1394handle_t handle)
+int fw_get_nodecount(fw_handle_t handle)
{
return (handle->reset.root_node_id & 0x3f) + 1;
}
-int raw1394_get_port_info(raw1394handle_t handle,
+int fw_get_port_info(fw_handle_t handle,
struct raw1394_portinfo *pinf,
int maxports)
{
@@ -560,7 +547,7 @@ int raw1394_get_port_info(raw1394handle_t handle,
return handle->port_count;
}
-int raw1394_set_port(raw1394handle_t handle, int port)
+int fw_set_port(fw_handle_t handle, int port)
{
struct fw_cdev_get_info get_info;
struct fw_cdev_event_bus_reset reset;
@@ -637,12 +624,7 @@ int raw1394_set_port(raw1394handle_t handle, int port)
return 0;
}
-int raw1394_reset_bus(raw1394handle_t handle)
-{
- return raw1394_reset_bus_new(handle, RAW1394_LONG_RESET);
-}
-
-int raw1394_reset_bus_new(raw1394handle_t handle, int type)
+int fw_reset_bus_new(fw_handle_t handle, int type)
{
struct fw_cdev_initiate_bus_reset initiate;
@@ -659,56 +641,6 @@ int raw1394_reset_bus_new(raw1394handle_t handle, int type)
FW_CDEV_IOC_INITIATE_BUS_RESET, &initiate);
}
-bus_reset_handler_t raw1394_set_bus_reset_handler(raw1394handle_t handle,
- bus_reset_handler_t new_h)
-{
- bus_reset_handler_t old_h = handle->bus_reset_handler;
-
- handle->bus_reset_handler = new_h;
-
- return old_h;
-}
-
-unsigned int raw1394_get_generation(raw1394handle_t handle)
-{
- return handle->generation;
-}
-
-void raw1394_update_generation(raw1394handle_t handle, unsigned int generation)
-{
- handle->generation = generation;
-}
-
-tag_handler_t
-raw1394_set_tag_handler(raw1394handle_t handle, tag_handler_t new_h)
-{
- tag_handler_t old_h = handle->tag_handler;
-
- handle->tag_handler = new_h;
-
- return old_h;
-}
-
-arm_tag_handler_t
-raw1394_set_arm_tag_handler(raw1394handle_t handle, arm_tag_handler_t new_h)
-{
- arm_tag_handler_t old_h = handle->arm_tag_handler;
-
- handle->arm_tag_handler = new_h;
-
- return old_h;
-}
-
-fcp_handler_t
-raw1394_set_fcp_handler(raw1394handle_t handle, fcp_handler_t new_h)
-{
- fcp_handler_t old_h = handle->fcp_handler;
-
- handle->fcp_handler = new_h;
-
- return old_h;
-}
-
struct request_response_block {
struct raw1394_arm_request_response request_response;
struct raw1394_arm_request request;
@@ -734,6 +666,7 @@ static int
handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
struct fw_cdev_event_request *request, int i)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct allocation *allocation = (struct allocation *) ac;
struct request_response_block *rrb;
struct fw_cdev_send_response response;
@@ -785,7 +718,7 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
response.rcode = RCODE_TYPE_ERROR;
response.length = 0;
response.data = 0;
- if (ioctl(handle->devices[i].fd,
+ if (ioctl(fwhandle->devices[i].fd,
FW_CDEV_IOC_SEND_RESPONSE, &response) < 0)
return -1;
} else if (!(allocation->client_transactions & type)) {
@@ -795,7 +728,7 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
else if (type == RAW1394_ARM_LOCK)
/* FIXME: do lock ops here */;
- if (ioctl(handle->devices[i].fd,
+ if (ioctl(fwhandle->devices[i].fd,
FW_CDEV_IOC_SEND_RESPONSE, &response) < 0)
return -1;
}
@@ -808,8 +741,8 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
rrb->request_response.request = &rrb->request;
rrb->request_response.response = &rrb->response;
- rrb->request.destination_nodeid = handle->reset.local_node_id;
- rrb->request.source_nodeid = handle->devices[i].node_id;
+ rrb->request.destination_nodeid = fwhandle->reset.local_node_id;
+ rrb->request.source_nodeid = fwhandle->devices[i].node_id;
rrb->request.destination_offset = request->offset;
rrb->request.tlabel = 0;
if (request->tcode < 0x10) {
@@ -819,7 +752,7 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
rrb->request.tcode = TCODE_LOCK_REQUEST;
rrb->request.extended_transaction_code = request->tcode - 0x10;
}
- rrb->request.generation = handle->reset.generation;
+ rrb->request.generation = fwhandle->reset.generation;
rrb->request.buffer_length = in_length;
memcpy(rrb->request.buffer, request->data, in_length);
@@ -828,13 +761,13 @@ handle_arm_request(raw1394handle_t handle, struct address_closure *ac,
memcpy(rrb->response.buffer,
allocation->data + offset, response.length);
- return handle->arm_tag_handler(handle, allocation->tag, type,
+ return fwhandle->arm_tag_handler(handle, allocation->tag, type,
request->length,
&rrb->request_response);
}
int
-raw1394_arm_register(raw1394handle_t handle, nodeaddr_t start,
+fw_arm_register(fw_handle_t handle, nodeaddr_t start,
size_t length, byte_t *initial_value,
octlet_t arm_tag, arm_options_t access_rights,
arm_options_t notification_options,
@@ -877,7 +810,7 @@ raw1394_arm_register(raw1394handle_t handle, nodeaddr_t start,
}
static struct allocation *
-lookup_allocation(raw1394handle_t handle, nodeaddr_t start, int delete)
+lookup_allocation(fw_handle_t handle, nodeaddr_t start, int delete)
{
struct allocation *a, **prev;
@@ -895,7 +828,7 @@ lookup_allocation(raw1394handle_t handle, nodeaddr_t start, int delete)
}
int
-raw1394_arm_unregister(raw1394handle_t handle, nodeaddr_t start)
+fw_arm_unregister(fw_handle_t handle, nodeaddr_t start)
{
struct fw_cdev_deallocate request;
struct allocation *allocation;
@@ -913,7 +846,7 @@ raw1394_arm_unregister(raw1394handle_t handle, nodeaddr_t start)
}
int
-raw1394_arm_set_buf(raw1394handle_t handle, nodeaddr_t start,
+fw_arm_set_buf(fw_handle_t handle, nodeaddr_t start,
size_t length, void *buf)
{
struct allocation *allocation;
@@ -930,7 +863,7 @@ raw1394_arm_set_buf(raw1394handle_t handle, nodeaddr_t start,
}
int
-raw1394_arm_get_buf(raw1394handle_t handle, nodeaddr_t start,
+fw_arm_get_buf(fw_handle_t handle, nodeaddr_t start,
size_t length, void *buf)
{
struct allocation *allocation;
@@ -947,24 +880,24 @@ raw1394_arm_get_buf(raw1394handle_t handle, nodeaddr_t start,
}
int
-raw1394_echo_request(raw1394handle_t handle, quadlet_t data)
+fw_echo_request(fw_handle_t handle, quadlet_t data)
{
return write(handle->pipe_fds[1], &data, sizeof data);
}
-int raw1394_wake_up(raw1394handle_t handle)
+int fw_wake_up(fw_handle_t handle)
{
- return raw1394_echo_request(handle, 0);
+ return fw_echo_request(handle, 0);
}
-int raw1394_phy_packet_write (raw1394handle_t handle, quadlet_t data)
+int fw_phy_packet_write (fw_handle_t handle, quadlet_t data)
{
errno = ENOSYS;
return -1;
}
int
-raw1394_start_phy_packet_write(raw1394handle_t handle,
+fw_start_phy_packet_write(fw_handle_t handle,
quadlet_t data, unsigned long tag)
{
errno = ENOSYS;
@@ -972,7 +905,7 @@ raw1394_start_phy_packet_write(raw1394handle_t handle,
}
static int
-send_request(raw1394handle_t handle, int tcode,
+send_request(fw_handle_t handle, int tcode,
nodeid_t node, nodeaddr_t addr,
size_t length, void *in, void *out, unsigned long tag)
{
@@ -982,27 +915,27 @@ send_request(raw1394handle_t handle, int tcode,
if (node > handle->reset.root_node_id) {
handle->err = -RCODE_NO_ACK;
- errno = raw1394_errcode_to_errno(handle->err);
+ errno = fw_errcode_to_errno(handle->err);
return -1;
}
i = handle->nodes[node & 0x3f];
if (i == -1) {
handle->err = -RCODE_NO_ACK;
- errno = raw1394_errcode_to_errno(handle->err);
+ errno = fw_errcode_to_errno(handle->err);
return -1;
}
if (handle->generation != handle->devices[i].generation) {
handle->err = -RCODE_GENERATION;
- errno = raw1394_errcode_to_errno(handle->err);
+ errno = fw_errcode_to_errno(handle->err);
return -1;
}
closure = malloc(sizeof *closure);
if (closure == NULL) {
handle->err = -RCODE_SEND_ERROR;
- errno = raw1394_errcode_to_errno(handle->err);
+ errno = fw_errcode_to_errno(handle->err);
return -1;
}
@@ -1022,7 +955,7 @@ send_request(raw1394handle_t handle, int tcode,
}
int
-raw1394_start_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_start_read(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
size_t length, quadlet_t *buffer, unsigned long tag)
{
int tcode;
@@ -1037,7 +970,7 @@ raw1394_start_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_start_write(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_start_write(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
size_t length, quadlet_t *data, unsigned long tag)
{
int tcode;
@@ -1098,7 +1031,7 @@ setup_lock64(int extcode, octlet_t data, octlet_t arg, octlet_t *buffer)
}
int
-raw1394_start_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_start_lock(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
unsigned int extcode, quadlet_t data, quadlet_t arg,
quadlet_t *result, unsigned long tag)
{
@@ -1114,7 +1047,7 @@ raw1394_start_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_start_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_start_lock64(fw_handle_t handle, nodeid_t node, nodeaddr_t addr,
unsigned int extcode, octlet_t data, octlet_t arg,
octlet_t *result, unsigned long tag)
{
@@ -1130,7 +1063,7 @@ raw1394_start_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_start_async_stream(raw1394handle_t handle, unsigned int channel,
+fw_start_async_stream(fw_handle_t handle, unsigned int channel,
unsigned int tag, unsigned int sy,
unsigned int speed, size_t length, quadlet_t *data,
unsigned long rawtag)
@@ -1141,7 +1074,7 @@ raw1394_start_async_stream(raw1394handle_t handle, unsigned int channel,
int
-raw1394_start_async_send(raw1394handle_t handle,
+fw_start_async_send(fw_handle_t handle,
size_t length, size_t header_length,
unsigned int expect_response,
quadlet_t *data, unsigned long rawtag)
@@ -1171,6 +1104,7 @@ send_request_sync(raw1394handle_t handle, int tcode,
nodeid_t node, nodeaddr_t addr,
size_t length, void *in, void *out)
{
+ fw_handle_t fwhandle = handle->mode.fw;
struct raw1394_reqhandle reqhandle;
struct sync_data sd = { 0, 0 };
int err;
@@ -1178,23 +1112,23 @@ send_request_sync(raw1394handle_t handle, int tcode,
reqhandle.callback = sync_callback;
reqhandle.data = &sd;
- err = send_request(handle, tcode, node, addr,
+ err = send_request(fwhandle, tcode, node, addr,
length, in, out, (unsigned long) &reqhandle);
while (!sd.done) {
if (err < 0)
return err;
- err = raw1394_loop_iterate(handle);
+ err = fw_loop_iterate(handle);
}
- handle->err = sd.err;
- errno = raw1394_errcode_to_errno(sd.err);
+ fwhandle->err = sd.err;
+ errno = fw_errcode_to_errno(sd.err);
return (errno ? -1 : 0);
}
int
-raw1394_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
size_t length, quadlet_t *buffer)
{
int tcode;
@@ -1209,7 +1143,7 @@ raw1394_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_write(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_write(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
size_t length, quadlet_t *data)
{
int tcode;
@@ -1224,7 +1158,7 @@ raw1394_write(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
unsigned int extcode, quadlet_t data, quadlet_t arg,
quadlet_t *result)
{
@@ -1240,7 +1174,7 @@ raw1394_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
+fw_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
unsigned int extcode, octlet_t data, octlet_t arg,
octlet_t *result)
{
@@ -1256,7 +1190,7 @@ raw1394_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
}
int
-raw1394_async_stream(raw1394handle_t handle, unsigned int channel,
+fw_async_stream(fw_handle_t handle, unsigned int channel,
unsigned int tag, unsigned int sy, unsigned int speed,
size_t length, quadlet_t *data)
{
@@ -1265,7 +1199,7 @@ raw1394_async_stream(raw1394handle_t handle, unsigned int channel,
}
int
-raw1394_async_send(raw1394handle_t handle,
+fw_async_send(fw_handle_t handle,
size_t length, size_t header_length,
unsigned int expect_response,
quadlet_t *data)
@@ -1275,7 +1209,7 @@ raw1394_async_send(raw1394handle_t handle,
}
int
-raw1394_start_fcp_listen(raw1394handle_t handle)
+fw_start_fcp_listen(fw_handle_t handle)
{
struct fw_cdev_allocate request;
struct address_closure *closure;
@@ -1298,7 +1232,7 @@ raw1394_start_fcp_listen(raw1394handle_t handle)
}
int
-raw1394_stop_fcp_listen(raw1394handle_t handle)
+fw_stop_fcp_listen(fw_handle_t handle)
{
struct fw_cdev_deallocate request;
@@ -1307,21 +1241,15 @@ raw1394_stop_fcp_listen(raw1394handle_t handle)
return ioctl(handle->local_fd, FW_CDEV_IOC_DEALLOCATE, &request);
}
-const char *
-raw1394_get_libversion(void)
-{
- return VERSION " (Juju)";
-}
-
int
-raw1394_update_config_rom(raw1394handle_t handle, const quadlet_t *new_rom,
+fw_update_config_rom(fw_handle_t handle, const quadlet_t *new_rom,
size_t size, unsigned char rom_version)
{
return -1;
}
int
-raw1394_get_config_rom(raw1394handle_t handle, quadlet_t *buffer,
+fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
size_t buffersize, size_t *rom_size,
unsigned char *rom_version)
{
@@ -1346,13 +1274,13 @@ raw1394_get_config_rom(raw1394handle_t handle, quadlet_t *buffer,
#define MAXIMUM_BANDWIDTH 4915
int
-raw1394_bandwidth_modify (raw1394handle_t handle,
+fw_bandwidth_modify (raw1394handle_t handle,
unsigned int bandwidth,
enum raw1394_modify_mode mode)
{
- quadlet_t buffer, compare, swap;
+ quadlet_t buffer, compare, swap;
nodeaddr_t addr;
- int result;
+ int result;
if (bandwidth == 0)
return 0;
@@ -1392,7 +1320,7 @@ raw1394_bandwidth_modify (raw1394handle_t handle,
}
int
-raw1394_channel_modify (raw1394handle_t handle,
+fw_channel_modify (raw1394handle_t handle,
unsigned int channel,
enum raw1394_modify_mode mode)
{