aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/firewire.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/firewire.h')
-rw-r--r--include/linux/firewire.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index e584b7215e8b..9823946adbc5 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/completion.h> 4#include <linux/completion.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/dma-mapping.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7#include <linux/kref.h> 8#include <linux/kref.h>
8#include <linux/list.h> 9#include <linux/list.h>
@@ -355,4 +356,90 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
355 int generation, int speed, unsigned long long offset, 356 int generation, int speed, unsigned long long offset,
356 void *payload, size_t length); 357 void *payload, size_t length);
357 358
359static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
360{
361 return tag << 14 | channel << 8 | sy;
362}
363
364struct fw_descriptor {
365 struct list_head link;
366 size_t length;
367 u32 immediate;
368 u32 key;
369 const u32 *data;
370};
371
372int fw_core_add_descriptor(struct fw_descriptor *desc);
373void fw_core_remove_descriptor(struct fw_descriptor *desc);
374
375/*
376 * The iso packet format allows for an immediate header/payload part
377 * stored in 'header' immediately after the packet info plus an
378 * indirect payload part that is pointer to by the 'payload' field.
379 * Applications can use one or the other or both to implement simple
380 * low-bandwidth streaming (e.g. audio) or more advanced
381 * scatter-gather streaming (e.g. assembling video frame automatically).
382 */
383struct fw_iso_packet {
384 u16 payload_length; /* Length of indirect payload. */
385 u32 interrupt:1; /* Generate interrupt on this packet */
386 u32 skip:1; /* Set to not send packet at all. */
387 u32 tag:2;
388 u32 sy:4;
389 u32 header_length:8; /* Length of immediate header. */
390 u32 header[0];
391};
392
393#define FW_ISO_CONTEXT_TRANSMIT 0
394#define FW_ISO_CONTEXT_RECEIVE 1
395
396#define FW_ISO_CONTEXT_MATCH_TAG0 1
397#define FW_ISO_CONTEXT_MATCH_TAG1 2
398#define FW_ISO_CONTEXT_MATCH_TAG2 4
399#define FW_ISO_CONTEXT_MATCH_TAG3 8
400#define FW_ISO_CONTEXT_MATCH_ALL_TAGS 15
401
402/*
403 * An iso buffer is just a set of pages mapped for DMA in the
404 * specified direction. Since the pages are to be used for DMA, they
405 * are not mapped into the kernel virtual address space. We store the
406 * DMA address in the page private. The helper function
407 * fw_iso_buffer_map() will map the pages into a given vma.
408 */
409struct fw_iso_buffer {
410 enum dma_data_direction direction;
411 struct page **pages;
412 int page_count;
413};
414
415int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
416 int page_count, enum dma_data_direction direction);
417void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
418
419struct fw_iso_context;
420typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
421 u32 cycle, size_t header_length,
422 void *header, void *data);
423struct fw_iso_context {
424 struct fw_card *card;
425 int type;
426 int channel;
427 int speed;
428 size_t header_size;
429 fw_iso_callback_t callback;
430 void *callback_data;
431};
432
433struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
434 int type, int channel, int speed, size_t header_size,
435 fw_iso_callback_t callback, void *callback_data);
436int fw_iso_context_queue(struct fw_iso_context *ctx,
437 struct fw_iso_packet *packet,
438 struct fw_iso_buffer *buffer,
439 unsigned long payload);
440int fw_iso_context_start(struct fw_iso_context *ctx,
441 int cycle, int sync, int tags);
442int fw_iso_context_stop(struct fw_iso_context *ctx);
443void fw_iso_context_destroy(struct fw_iso_context *ctx);
444
358#endif /* _LINUX_FIREWIRE_H */ 445#endif /* _LINUX_FIREWIRE_H */