This source file includes following definitions.
- ivtv_might_use_pio
- ivtv_use_pio
- ivtv_might_use_dma
- ivtv_use_dma
- ivtv_buf_sync_for_cpu
- ivtv_buf_sync_for_device
- ivtv_stream_sync_for_cpu
- ivtv_stream_sync_for_device
1
2
3
4
5
6
7
8
9
10 #ifndef IVTV_QUEUE_H
11 #define IVTV_QUEUE_H
12
13 #define IVTV_DMA_UNMAPPED ((u32) -1)
14 #define SLICED_VBI_PIO 0
15
16
17
18 static inline int ivtv_might_use_pio(struct ivtv_stream *s)
19 {
20 return s->dma == PCI_DMA_NONE || (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI);
21 }
22
23 static inline int ivtv_use_pio(struct ivtv_stream *s)
24 {
25 struct ivtv *itv = s->itv;
26
27 return s->dma == PCI_DMA_NONE ||
28 (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set);
29 }
30
31 static inline int ivtv_might_use_dma(struct ivtv_stream *s)
32 {
33 return s->dma != PCI_DMA_NONE;
34 }
35
36 static inline int ivtv_use_dma(struct ivtv_stream *s)
37 {
38 return !ivtv_use_pio(s);
39 }
40
41 static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf)
42 {
43 if (ivtv_use_dma(s))
44 pci_dma_sync_single_for_cpu(s->itv->pdev, buf->dma_handle,
45 s->buf_size + 256, s->dma);
46 }
47
48 static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf)
49 {
50 if (ivtv_use_dma(s))
51 pci_dma_sync_single_for_device(s->itv->pdev, buf->dma_handle,
52 s->buf_size + 256, s->dma);
53 }
54
55 int ivtv_buf_copy_from_user(struct ivtv_stream *s, struct ivtv_buffer *buf, const char __user *src, int copybytes);
56 void ivtv_buf_swap(struct ivtv_buffer *buf);
57
58
59 void ivtv_queue_init(struct ivtv_queue *q);
60 void ivtv_enqueue(struct ivtv_stream *s, struct ivtv_buffer *buf, struct ivtv_queue *q);
61 struct ivtv_buffer *ivtv_dequeue(struct ivtv_stream *s, struct ivtv_queue *q);
62 int ivtv_queue_move(struct ivtv_stream *s, struct ivtv_queue *from, struct ivtv_queue *steal,
63 struct ivtv_queue *to, int needed_bytes);
64 void ivtv_flush_queues(struct ivtv_stream *s);
65
66
67 int ivtv_stream_alloc(struct ivtv_stream *s);
68 void ivtv_stream_free(struct ivtv_stream *s);
69
70 static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s)
71 {
72 if (ivtv_use_dma(s))
73 pci_dma_sync_single_for_cpu(s->itv->pdev, s->sg_handle,
74 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE);
75 }
76
77 static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s)
78 {
79 if (ivtv_use_dma(s))
80 pci_dma_sync_single_for_device(s->itv->pdev, s->sg_handle,
81 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE);
82 }
83
84 #endif