24 #include <linux/list.h>
25 #include <linux/module.h>
26 #include <linux/kernel.h>
34 static unsigned int ts_debug;
38 #define dprintk(fmt, arg...) if (ts_debug) \
39 printk(KERN_DEBUG "%s/ts: " fmt, dev->name , ## arg)
48 dprintk(
"buffer_activate [%p]",buf);
55 dprintk(
"- [top] buf=%p next=%p\n",buf,next);
59 dprintk(
"- [bottom] buf=%p next=%p\n",buf,next);
80 unsigned int lines, llength,
size;
86 lines = dev->
ts.nr_packets;
88 size = lines * llength;
89 if (0 != buf->
vb.baddr && buf->
vb.bsize < size)
92 if (buf->
vb.size != size) {
100 dprintk(
"buffer_prepare: needs_init\n");
102 buf->
vb.width = llength;
103 buf->
vb.height = lines;
105 buf->
pt = &dev->
ts.pt_ts;
135 *count = dev->
ts.nr_bufs;
161 .buf_setup = buffer_setup,
162 .buf_prepare = buffer_prepare,
163 .buf_queue = buffer_queue,
164 .buf_release = buffer_release,
171 static unsigned int tsbufs = 8;
173 MODULE_PARM_DESC(tsbufs,
"number of ts buffers for read/write IO, range 2-32");
175 static unsigned int ts_nr_packets = 64;
190 ((((dev->
ts.nr_packets-1)>>16)&0x3f) | 0x00));
202 if (ts_nr_packets < 4)
204 if (ts_nr_packets > 312)
206 dev->
ts.nr_bufs = tsbufs;
207 dev->
ts.nr_packets = ts_nr_packets;
209 INIT_LIST_HEAD(&dev->
ts_q.queue);
214 dev->
ts_q.need_two = 1;
255 ((dev->
ts.nr_packets - 1) >> 8) & 0xff);
258 (((dev->
ts.nr_packets - 1) >> 16) & 0x3f) | 0x00);
262 (dev->
ts.pt_ts.dma >> 12));
304 spin_lock(&dev->
slock);
305 if (dev->
ts_q.curr) {
306 field = dev->
ts_q.curr->vb.field;
308 if ((status & 0x100000) != 0x000000)
311 if ((status & 0x100000) != 0x100000)
319 spin_unlock(&dev->
slock);