aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-02-20 06:13:49 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-02-24 14:36:54 -0500
commitabfe5a01ef1e463cbafdae461b693db34e308c02 (patch)
treee33056c7d8b80a3128f7714c31b083091be3ea9b /include
parentfd6e0c518121d22b50060d26c8aec2b701c6aab7 (diff)
firewire: cdev: add more flexible cycle timer ioctl
The system time from CLOCK_REALTIME is not monotonic, hence problematic for the main user of the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl. This issue exists in its successor ABI, i.e. raw1394, too. http://subversion.ffado.org/ticket/242 We now offer an alternative ioctl which lets the caller choose between CLOCK_REALTIME, CLOCK_MONOTONIC, and CLOCK_MONOTONIC_RAW as source of the local time, very similar to the clock_gettime libc function. The format of the local time return value matches that of clock_gettime (seconds and nanoseconds, instead of a single microseconds value from the existing ioctl). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/firewire-cdev.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 520ecf86cbb3..baa8290c8416 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -248,6 +248,9 @@ union fw_cdev_event {
248#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) 248#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) 249#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
250 250
251/* available since kernel version 2.6.34 */
252#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
253
251/* 254/*
252 * FW_CDEV_VERSION History 255 * FW_CDEV_VERSION History
253 * 1 (2.6.22) - initial version 256 * 1 (2.6.22) - initial version
@@ -544,14 +547,15 @@ struct fw_cdev_stop_iso {
544/** 547/**
545 * struct fw_cdev_get_cycle_timer - read cycle timer register 548 * struct fw_cdev_get_cycle_timer - read cycle timer register
546 * @local_time: system time, in microseconds since the Epoch 549 * @local_time: system time, in microseconds since the Epoch
547 * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 550 * @cycle_timer: Cycle Time register contents
548 * 551 *
549 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 552 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
550 * and also the system clock. This allows to express the receive time of an 553 * and also the system clock (%CLOCK_REALTIME). This allows to express the
551 * isochronous packet as a system time with microsecond accuracy. 554 * receive time of an isochronous packet as a system time.
552 * 555 *
553 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and 556 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
554 * 12 bits cycleOffset, in host byte order. 557 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
558 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
555 */ 559 */
556struct fw_cdev_get_cycle_timer { 560struct fw_cdev_get_cycle_timer {
557 __u64 local_time; 561 __u64 local_time;
@@ -559,6 +563,25 @@ struct fw_cdev_get_cycle_timer {
559}; 563};
560 564
561/** 565/**
566 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
567 * @tv_sec: system time, seconds
568 * @tv_nsec: system time, sub-seconds part in nanoseconds
569 * @clk_id: input parameter, clock from which to get the system time
570 * @cycle_timer: Cycle Time register contents
571 *
572 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
573 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
574 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
575 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
576 */
577struct fw_cdev_get_cycle_timer2 {
578 __s64 tv_sec;
579 __s32 tv_nsec;
580 __s32 clk_id;
581 __u32 cycle_timer;
582};
583
584/**
562 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth 585 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
563 * @closure: Passed back to userspace in correponding iso resource events 586 * @closure: Passed back to userspace in correponding iso resource events
564 * @channels: Isochronous channels of which one is to be (de)allocated 587 * @channels: Isochronous channels of which one is to be (de)allocated