diff options
Diffstat (limited to 'include/linux/firewire.h')
| -rw-r--r-- | include/linux/firewire.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index e584b7215e8b..d44f47d3b2d9 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> |
| @@ -130,6 +131,13 @@ struct fw_card { | |||
| 130 | bool broadcast_channel_allocated; | 131 | bool broadcast_channel_allocated; |
| 131 | u32 broadcast_channel; | 132 | u32 broadcast_channel; |
| 132 | u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; | 133 | u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; |
| 134 | /* Only non-NULL if firewire-ipv4 is active on this card. */ | ||
| 135 | void *netdev; | ||
| 136 | /* | ||
| 137 | * The nodes get probed before the card, so we need a place to store | ||
| 138 | * them independent of card->netdev | ||
| 139 | */ | ||
| 140 | struct list_head ipv4_nodes; | ||
| 133 | }; | 141 | }; |
| 134 | 142 | ||
| 135 | static inline struct fw_card *fw_card_get(struct fw_card *card) | 143 | static inline struct fw_card *fw_card_get(struct fw_card *card) |
| @@ -355,4 +363,90 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, | |||
| 355 | int generation, int speed, unsigned long long offset, | 363 | int generation, int speed, unsigned long long offset, |
| 356 | void *payload, size_t length); | 364 | void *payload, size_t length); |
| 357 | 365 | ||
| 366 | static inline int fw_stream_packet_destination_id(int tag, int channel, int sy) | ||
| 367 | { | ||
| 368 | return tag << 14 | channel << 8 | sy; | ||
| 369 | } | ||
| 370 | |||
| 371 | struct fw_descriptor { | ||
| 372 | struct list_head link; | ||
| 373 | size_t length; | ||
| 374 | u32 immediate; | ||
| 375 | u32 key; | ||
| 376 | const u32 *data; | ||
| 377 | }; | ||
| 378 | |||
| 379 | int fw_core_add_descriptor(struct fw_descriptor *desc); | ||
| 380 | void fw_core_remove_descriptor(struct fw_descriptor *desc); | ||
| 381 | |||
| 382 | /* | ||
| 383 | * The iso packet format allows for an immediate header/payload part | ||
| 384 | * stored in 'header' immediately after the packet info plus an | ||
| 385 | * indirect payload part that is pointer to by the 'payload' field. | ||
| 386 | * Applications can use one or the other or both to implement simple | ||
| 387 | * low-bandwidth streaming (e.g. audio) or more advanced | ||
| 388 | * scatter-gather streaming (e.g. assembling video frame automatically). | ||
| 389 | */ | ||
| 390 | struct fw_iso_packet { | ||
| 391 | u16 payload_length; /* Length of indirect payload. */ | ||
| 392 | u32 interrupt:1; /* Generate interrupt on this packet */ | ||
| 393 | u32 skip:1; /* Set to not send packet at all. */ | ||
| 394 | u32 tag:2; | ||
| 395 | u32 sy:4; | ||
| 396 | u32 header_length:8; /* Length of immediate header. */ | ||
| 397 | u32 header[0]; | ||
| 398 | }; | ||
| 399 | |||
| 400 | #define FW_ISO_CONTEXT_TRANSMIT 0 | ||
| 401 | #define FW_ISO_CONTEXT_RECEIVE 1 | ||
| 402 | |||
| 403 | #define FW_ISO_CONTEXT_MATCH_TAG0 1 | ||
| 404 | #define FW_ISO_CONTEXT_MATCH_TAG1 2 | ||
| 405 | #define FW_ISO_CONTEXT_MATCH_TAG2 4 | ||
| 406 | #define FW_ISO_CONTEXT_MATCH_TAG3 8 | ||
| 407 | #define FW_ISO_CONTEXT_MATCH_ALL_TAGS 15 | ||
| 408 | |||
| 409 | /* | ||
| 410 | * An iso buffer is just a set of pages mapped for DMA in the | ||
| 411 | * specified direction. Since the pages are to be used for DMA, they | ||
| 412 | * are not mapped into the kernel virtual address space. We store the | ||
| 413 | * DMA address in the page private. The helper function | ||
| 414 | * fw_iso_buffer_map() will map the pages into a given vma. | ||
| 415 | */ | ||
| 416 | struct fw_iso_buffer { | ||
| 417 | enum dma_data_direction direction; | ||
| 418 | struct page **pages; | ||
| 419 | int page_count; | ||
| 420 | }; | ||
| 421 | |||
| 422 | int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, | ||
| 423 | int page_count, enum dma_data_direction direction); | ||
| 424 | void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); | ||
| 425 | |||
| 426 | struct fw_iso_context; | ||
| 427 | typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, | ||
| 428 | u32 cycle, size_t header_length, | ||
| 429 | void *header, void *data); | ||
| 430 | struct fw_iso_context { | ||
| 431 | struct fw_card *card; | ||
| 432 | int type; | ||
| 433 | int channel; | ||
| 434 | int speed; | ||
| 435 | size_t header_size; | ||
| 436 | fw_iso_callback_t callback; | ||
| 437 | void *callback_data; | ||
| 438 | }; | ||
| 439 | |||
| 440 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, | ||
| 441 | int type, int channel, int speed, size_t header_size, | ||
| 442 | fw_iso_callback_t callback, void *callback_data); | ||
| 443 | int fw_iso_context_queue(struct fw_iso_context *ctx, | ||
| 444 | struct fw_iso_packet *packet, | ||
| 445 | struct fw_iso_buffer *buffer, | ||
| 446 | unsigned long payload); | ||
| 447 | int fw_iso_context_start(struct fw_iso_context *ctx, | ||
| 448 | int cycle, int sync, int tags); | ||
| 449 | int fw_iso_context_stop(struct fw_iso_context *ctx); | ||
| 450 | void fw_iso_context_destroy(struct fw_iso_context *ctx); | ||
| 451 | |||
| 358 | #endif /* _LINUX_FIREWIRE_H */ | 452 | #endif /* _LINUX_FIREWIRE_H */ |
