View | Details | Raw Unified | Return to bug 7773 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.6.20-rc5/drivers/ieee1394/ieee1394-ioctl.h (+2 lines)
Lines 100-104 Link Here
100
	_IO  ('#', 0x28)
100
	_IO  ('#', 0x28)
101
#define RAW1394_IOC_ISO_RECV_FLUSH		\
101
#define RAW1394_IOC_ISO_RECV_FLUSH		\
102
	_IO  ('#', 0x29)
102
	_IO  ('#', 0x29)
103
#define RAW1394_IOC_GET_CYCLE_TIMER		\
104
	_IOR ('#', 0x30, struct _raw1394_cycle_timer)
103
105
104
#endif /* __IEEE1394_IOCTL_H */
106
#endif /* __IEEE1394_IOCTL_H */
(-)linux-2.6.20-rc5/drivers/ieee1394/ieee1394_core.c (+43 lines)
Lines 33-39 Link Here
33
#include <linux/skbuff.h>
33
#include <linux/skbuff.h>
34
#include <linux/suspend.h>
34
#include <linux/suspend.h>
35
#include <linux/kthread.h>
35
#include <linux/kthread.h>
36
#include <linux/preempt.h>
37
#include <linux/time.h>
36
38
39
#include <asm/system.h>
37
#include <asm/byteorder.h>
40
#include <asm/byteorder.h>
38
41
39
#include "ieee1394_types.h"
42
#include "ieee1394_types.h"
Lines 186-191 int hpsb_reset_bus(struct hpsb_host *hos Link Here
186
	}
189
	}
187
}
190
}
188
191
192
/**
193
 * hpsb_read_cycle_timer - read cycle timer register and system time
194
 * @host: host whose isochronous cycle timer register is read
195
 * @cycle_timer: address of bitfield to return the register contents
196
 * @local_time: address to return the system time
197
 *
198
 * The format of * @cycle_timer, is described in OHCI 1.1 clause 5.13. This
199
 * format is also read from non-OHCI controllers. * @local_time contains the
200
 * system time in microseconds since the Epoch, read at the moment when the
201
 * cycle timer was read.
202
 *
203
 * Return value: 0 for success or error number otherwise.
204
 */
205
int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer,
206
			  u64 *local_time)
207
{
208
	int ctr;
209
	struct timeval tv;
210
	unsigned long flags;
211
212
	if (!host || !cycle_timer || !local_time)
213
		return -EINVAL;
214
215
	preempt_disable();
216
	local_irq_save(flags);
217
218
	ctr = host->driver->devctl(host, GET_CYCLE_COUNTER, 0);
219
	if (ctr)
220
		do_gettimeofday(&tv);
221
222
	local_irq_restore(flags);
223
	preempt_enable();
224
225
	if (!ctr)
226
		return -EIO;
227
	*cycle_timer = ctr;
228
	*local_time = tv.tv_sec * 1000000ULL + tv.tv_usec;
229
	return 0;
230
}
189
231
190
int hpsb_bus_reset(struct hpsb_host *host)
232
int hpsb_bus_reset(struct hpsb_host *host)
191
{
233
{
Lines 1190-1195 EXPORT_SYMBOL(hpsb_alloc_packet); Link Here
1190
EXPORT_SYMBOL(hpsb_free_packet);
1232
EXPORT_SYMBOL(hpsb_free_packet);
1191
EXPORT_SYMBOL(hpsb_send_packet);
1233
EXPORT_SYMBOL(hpsb_send_packet);
1192
EXPORT_SYMBOL(hpsb_reset_bus);
1234
EXPORT_SYMBOL(hpsb_reset_bus);
1235
EXPORT_SYMBOL(hpsb_read_cycle_timer);
1193
EXPORT_SYMBOL(hpsb_bus_reset);
1236
EXPORT_SYMBOL(hpsb_bus_reset);
1194
EXPORT_SYMBOL(hpsb_selfid_received);
1237
EXPORT_SYMBOL(hpsb_selfid_received);
1195
EXPORT_SYMBOL(hpsb_selfid_complete);
1238
EXPORT_SYMBOL(hpsb_selfid_complete);
(-)linux-2.6.20-rc5/drivers/ieee1394/ieee1394_core.h (+3 lines)
Lines 127-132 int hpsb_send_packet_and_wait(struct hps Link Here
127
 * progress, 0 otherwise. */
127
 * progress, 0 otherwise. */
128
int hpsb_reset_bus(struct hpsb_host *host, int type);
128
int hpsb_reset_bus(struct hpsb_host *host, int type);
129
129
130
int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer,
131
			  u64 *local_time);
132
130
/*
133
/*
131
 * The following functions are exported for host driver module usage.  All of
134
 * The following functions are exported for host driver module usage.  All of
132
 * them are safe to use in interrupt contexts, although some are quite
135
 * them are safe to use in interrupt contexts, although some are quite
(-)linux-2.6.20-rc5/drivers/ieee1394/raw1394.c (+20 lines)
Lines 2664-2669 static void raw1394_iso_shutdown(struct Link Here
2664
	fi->iso_state = RAW1394_ISO_INACTIVE;
2664
	fi->iso_state = RAW1394_ISO_INACTIVE;
2665
}
2665
}
2666
2666
2667
static int raw1394_read_cycle_timer(struct file_info *fi, void __user * uaddr)
2668
{
2669
	struct _raw1394_cycle_timer ct;
2670
	int err;
2671
2672
	err = hpsb_read_cycle_timer(fi->host, &ct.cycle_timer, &ct.local_time);
2673
	if (!err)
2674
		if (copy_to_user(uaddr, &ct, sizeof(ct)))
2675
			err = -EFAULT;
2676
	return err;
2677
}
2678
2667
/* mmap the rawiso xmit/recv buffer */
2679
/* mmap the rawiso xmit/recv buffer */
2668
static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
2680
static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
2669
{
2681
{
Lines 2772-2777 static int raw1394_ioctl(struct inode *i Link Here
2772
		break;
2784
		break;
2773
	}
2785
	}
2774
2786
2787
	/* state-independent commands */
2788
	switch(cmd) {
2789
	case RAW1394_IOC_GET_CYCLE_TIMER:
2790
		return raw1394_read_cycle_timer(fi, argp);
2791
	default:
2792
		break;
2793
	}
2794
2775
	return -EINVAL;
2795
	return -EINVAL;
2776
}
2796
}
2777
2797
(-)linux-2.6.20-rc5/drivers/ieee1394/raw1394.h (+10 lines)
Lines 178-181 struct raw1394_iso_status { Link Here
178
	__s16 xmit_cycle;
178
	__s16 xmit_cycle;
179
};
179
};
180
180
181
/* argument to RAW1394_IOC_GET_CYCLE_TIMER ioctl */
182
struct _raw1394_cycle_timer {
183
	/* contents of Isochronous Cycle Timer register,
184
	   as in OHCI 1.1 clause 5.13 (also with non-OHCI hosts) */
185
	__u32 cycle_timer;
186
187
	/* local time in microseconds since Epoch,
188
	   simultaneously read with cycle timer */
189
	__u64 local_time;
190
};
181
#endif /* IEEE1394_RAW1394_H */
191
#endif /* IEEE1394_RAW1394_H */

Return to bug 7773