summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-transaction.c
diff options
context:
space:
mode:
authorJay Fenlason <fenlason@redhat.com>2009-03-05 19:08:40 +0100
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-03-24 20:56:49 +0100
commitf8c2287c65f8f72000102fc058232669e4540bc4 (patch)
treea82393fbdd3a2b20f8e499537b10eb9e61dae941 /drivers/firewire/fw-transaction.c
parentba27e1f7bf220799cd3d7503f82bda71b8ebe8c5 (diff)
firewire: implement asynchronous stream transmission
Allow userspace and other firewire drivers (fw-ipv4 I'm looking at you!) to send Asynchronous Transmit Streams as described in 7.8.3 of release 1.1 of the 1394 Open Host Controller Interface Specification. Signed-off-by: Jay Fenlason <fenlason@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (tweaks)
Diffstat (limited to 'drivers/firewire/fw-transaction.c')
-rw-r--r--drivers/firewire/fw-transaction.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 76938fe432a..e3da5899196 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -37,6 +37,10 @@
#include "fw-topology.h"
#include "fw-device.h"
+#define HEADER_TAG(tag) ((tag) << 14)
+#define HEADER_CHANNEL(ch) ((ch) << 8)
+#define HEADER_SY(sy) ((sy) << 0)
+
#define HEADER_PRI(pri) ((pri) << 0)
#define HEADER_TCODE(tcode) ((tcode) << 4)
#define HEADER_RETRY(retry) ((retry) << 8)
@@ -293,6 +297,27 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
}
EXPORT_SYMBOL(fw_send_request);
+void fw_send_stream_packet(struct fw_card *card, struct fw_packet *p,
+ int generation, int speed, int channel, int sy, int tag,
+ void *payload, size_t length, fw_packet_callback_t callback)
+{
+ p->callback = callback;
+ p->header[0] =
+ HEADER_DATA_LENGTH(length)
+ | HEADER_TAG(tag)
+ | HEADER_CHANNEL(channel)
+ | HEADER_TCODE(TCODE_STREAM_DATA)
+ | HEADER_SY(sy);
+ p->header_length = 4;
+ p->payload = payload;
+ p->payload_length = length;
+ p->speed = speed;
+ p->generation = generation;
+ p->ack = 0;
+
+ card->driver->send_request(card, p);
+}
+
struct transaction_callback_data {
struct completion done;
void *payload;