aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/firewire-cdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/firewire-cdev.h')
-rw-r--r--include/linux/firewire-cdev.h125
1 files changed, 96 insertions, 29 deletions
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index c6b3ca3af6df..68f883b30a53 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -1,21 +1,26 @@
1/* 1/*
2 * Char device interface. 2 * Char device interface.
3 * 3 *
4 * Copyright (C) 2005-2006 Kristian Hoegsberg <krh@bitplanet.net> 4 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * it under the terms of the GNU General Public License as published by 7 * copy of this software and associated documentation files (the "Software"),
8 * the Free Software Foundation; either version 2 of the License, or 8 * to deal in the Software without restriction, including without limitation
9 * (at your option) any later version. 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * This program is distributed in the hope that it will be useful, 11 * Software is furnished to do so, subject to the following conditions:
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * The above copyright notice and this permission notice (including the next
14 * GNU General Public License for more details. 14 * paragraph) shall be included in all copies or substantial portions of the
15 * 15 * Software.
16 * You should have received a copy of the GNU General Public License 16 *
17 * along with this program; if not, write to the Free Software Foundation, 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
19 */ 24 */
20 25
21#ifndef _LINUX_FIREWIRE_CDEV_H 26#ifndef _LINUX_FIREWIRE_CDEV_H
@@ -248,13 +253,20 @@ union fw_cdev_event {
248#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) 253#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
249#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) 254#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
250 255
256/* available since kernel version 2.6.34 */
257#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
258
251/* 259/*
252 * FW_CDEV_VERSION History 260 * FW_CDEV_VERSION History
253 * 1 (2.6.22) - initial version 261 * 1 (2.6.22) - initial version
254 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if 262 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
255 * &fw_cdev_create_iso_context.header_size is 8 or more 263 * &fw_cdev_create_iso_context.header_size is 8 or more
264 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
265 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
266 * dual-buffer or packet-per-buffer depending on hardware
267 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
256 */ 268 */
257#define FW_CDEV_VERSION 2 269#define FW_CDEV_VERSION 3
258 270
259/** 271/**
260 * struct fw_cdev_get_info - General purpose information ioctl 272 * struct fw_cdev_get_info - General purpose information ioctl
@@ -340,6 +352,9 @@ struct fw_cdev_send_response {
340 * The @closure field is passed back to userspace in the response event. 352 * The @closure field is passed back to userspace in the response event.
341 * The @handle field is an out parameter, returning a handle to the allocated 353 * The @handle field is an out parameter, returning a handle to the allocated
342 * range to be used for later deallocation of the range. 354 * range to be used for later deallocation of the range.
355 *
356 * The address range is allocated on all local nodes. The address allocation
357 * is exclusive except for the FCP command and response registers.
343 */ 358 */
344struct fw_cdev_allocate { 359struct fw_cdev_allocate {
345 __u64 offset; 360 __u64 offset;
@@ -377,7 +392,7 @@ struct fw_cdev_initiate_bus_reset {
377 * @immediate: If non-zero, immediate key to insert before pointer 392 * @immediate: If non-zero, immediate key to insert before pointer
378 * @key: Upper 8 bits of root directory pointer 393 * @key: Upper 8 bits of root directory pointer
379 * @data: Userspace pointer to contents of descriptor block 394 * @data: Userspace pointer to contents of descriptor block
380 * @length: Length of descriptor block data, in bytes 395 * @length: Length of descriptor block data, in quadlets
381 * @handle: Handle to the descriptor, written by the kernel 396 * @handle: Handle to the descriptor, written by the kernel
382 * 397 *
383 * Add a descriptor block and optionally a preceding immediate key to the local 398 * Add a descriptor block and optionally a preceding immediate key to the local
@@ -391,6 +406,8 @@ struct fw_cdev_initiate_bus_reset {
391 * If not 0, the @immediate field specifies an immediate key which will be 406 * If not 0, the @immediate field specifies an immediate key which will be
392 * inserted before the root directory pointer. 407 * inserted before the root directory pointer.
393 * 408 *
409 * @immediate, @key, and @data array elements are CPU-endian quadlets.
410 *
394 * If successful, the kernel adds the descriptor and writes back a handle to the 411 * If successful, the kernel adds the descriptor and writes back a handle to the
395 * kernel-side object to be used for later removal of the descriptor block and 412 * kernel-side object to be used for later removal of the descriptor block and
396 * immediate key. 413 * immediate key.
@@ -426,7 +443,7 @@ struct fw_cdev_remove_descriptor {
426 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE 443 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
427 * @header_size: Header size to strip for receive contexts 444 * @header_size: Header size to strip for receive contexts
428 * @channel: Channel to bind to 445 * @channel: Channel to bind to
429 * @speed: Speed to transmit at 446 * @speed: Speed for transmit contexts
430 * @closure: To be returned in &fw_cdev_event_iso_interrupt 447 * @closure: To be returned in &fw_cdev_event_iso_interrupt
431 * @handle: Handle to context, written back by kernel 448 * @handle: Handle to context, written back by kernel
432 * 449 *
@@ -439,6 +456,9 @@ struct fw_cdev_remove_descriptor {
439 * If a context was successfully created, the kernel writes back a handle to the 456 * If a context was successfully created, the kernel writes back a handle to the
440 * context, which must be passed in for subsequent operations on that context. 457 * context, which must be passed in for subsequent operations on that context.
441 * 458 *
459 * For receive contexts, @header_size must be at least 4 and must be a multiple
460 * of 4.
461 *
442 * Note that the effect of a @header_size > 4 depends on 462 * Note that the effect of a @header_size > 4 depends on
443 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. 463 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
444 */ 464 */
@@ -469,10 +489,34 @@ struct fw_cdev_create_iso_context {
469 * 489 *
470 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. 490 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
471 * 491 *
472 * Use the FW_CDEV_ISO_ macros to fill in @control. The sy and tag fields are 492 * Use the FW_CDEV_ISO_ macros to fill in @control.
473 * specified by IEEE 1394a and IEC 61883. 493 *
474 * 494 * For transmit packets, the header length must be a multiple of 4 and specifies
475 * FIXME - finish this documentation 495 * the numbers of bytes in @header that will be prepended to the packet's
496 * payload; these bytes are copied into the kernel and will not be accessed
497 * after the ioctl has returned. The sy and tag fields are copied to the iso
498 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
499 * The skip flag specifies that no packet is to be sent in a frame; when using
500 * this, all other fields except the interrupt flag must be zero.
501 *
502 * For receive packets, the header length must be a multiple of the context's
503 * header size; if the header length is larger than the context's header size,
504 * multiple packets are queued for this entry. The sy and tag fields are
505 * ignored. If the sync flag is set, the context drops all packets until
506 * a packet with a matching sy field is received (the sync value to wait for is
507 * specified in the &fw_cdev_start_iso structure). The payload length defines
508 * how many payload bytes can be received for one packet (in addition to payload
509 * quadlets that have been defined as headers and are stripped and returned in
510 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
511 * additional bytes are dropped. If less bytes are received, the remaining
512 * bytes in this part of the payload buffer will not be written to, not even by
513 * the next packet, i.e., packets received in consecutive frames will not
514 * necessarily be consecutive in memory. If an entry has queued multiple
515 * packets, the payload length is divided equally among them.
516 *
517 * When a packet with the interrupt flag set has been completed, the
518 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
519 * multiple receive packets is completed when its last packet is completed.
476 */ 520 */
477struct fw_cdev_iso_packet { 521struct fw_cdev_iso_packet {
478 __u32 control; 522 __u32 control;
@@ -489,7 +533,7 @@ struct fw_cdev_iso_packet {
489 * Queue a number of isochronous packets for reception or transmission. 533 * Queue a number of isochronous packets for reception or transmission.
490 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, 534 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
491 * which describe how to transmit from or receive into a contiguous region 535 * which describe how to transmit from or receive into a contiguous region
492 * of a mmap()'ed payload buffer. As part of the packet descriptors, 536 * of a mmap()'ed payload buffer. As part of transmit packet descriptors,
493 * a series of headers can be supplied, which will be prepended to the 537 * a series of headers can be supplied, which will be prepended to the
494 * payload during DMA. 538 * payload during DMA.
495 * 539 *
@@ -539,14 +583,18 @@ struct fw_cdev_stop_iso {
539/** 583/**
540 * struct fw_cdev_get_cycle_timer - read cycle timer register 584 * struct fw_cdev_get_cycle_timer - read cycle timer register
541 * @local_time: system time, in microseconds since the Epoch 585 * @local_time: system time, in microseconds since the Epoch
542 * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 586 * @cycle_timer: Cycle Time register contents
543 * 587 *
544 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 588 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
545 * and also the system clock. This allows to express the receive time of an 589 * and also the system clock (%CLOCK_REALTIME). This allows to express the
546 * isochronous packet as a system time with microsecond accuracy. 590 * receive time of an isochronous packet as a system time.
547 * 591 *
548 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and 592 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
549 * 12 bits cycleOffset, in host byte order. 593 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
594 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
595 *
596 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
597 * monotonic) @cycle_timer values on certain controllers.
550 */ 598 */
551struct fw_cdev_get_cycle_timer { 599struct fw_cdev_get_cycle_timer {
552 __u64 local_time; 600 __u64 local_time;
@@ -554,6 +602,25 @@ struct fw_cdev_get_cycle_timer {
554}; 602};
555 603
556/** 604/**
605 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
606 * @tv_sec: system time, seconds
607 * @tv_nsec: system time, sub-seconds part in nanoseconds
608 * @clk_id: input parameter, clock from which to get the system time
609 * @cycle_timer: Cycle Time register contents
610 *
611 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
612 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
613 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
614 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
615 */
616struct fw_cdev_get_cycle_timer2 {
617 __s64 tv_sec;
618 __s32 tv_nsec;
619 __s32 clk_id;
620 __u32 cycle_timer;
621};
622
623/**
557 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth 624 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
558 * @closure: Passed back to userspace in correponding iso resource events 625 * @closure: Passed back to userspace in correponding iso resource events
559 * @channels: Isochronous channels of which one is to be (de)allocated 626 * @channels: Isochronous channels of which one is to be (de)allocated
@@ -585,8 +652,8 @@ struct fw_cdev_get_cycle_timer {
585 * instead of allocated. 652 * instead of allocated.
586 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. 653 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
587 * 654 *
588 * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources 655 * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
589 * for the lifetime of the fd or handle. 656 * for the lifetime of the fd or @handle.
590 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources 657 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
591 * for the duration of a bus generation. 658 * for the duration of a bus generation.
592 * 659 *