1
2
3
4
5
6
7
8
9
10#ifndef IEEE1394_DMA_H
11#define IEEE1394_DMA_H
12
13#include <asm/types.h>
14
15struct file;
16struct pci_dev;
17struct scatterlist;
18struct vm_area_struct;
19
20
21
22
23
24
25
26
27
28
29
30struct dma_prog_region {
31 unsigned char *kvirt;
32 struct pci_dev *dev;
33 unsigned int n_pages;
34 dma_addr_t bus_addr;
35};
36
37
38void dma_prog_region_init(struct dma_prog_region *prog);
39int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
40 struct pci_dev *dev);
41void dma_prog_region_free(struct dma_prog_region *prog);
42
43static inline dma_addr_t dma_prog_region_offset_to_bus(
44 struct dma_prog_region *prog, unsigned long offset)
45{
46 return prog->bus_addr + offset;
47}
48
49
50
51
52
53
54
55
56
57
58
59
60
61struct dma_region {
62 unsigned char *kvirt;
63 struct pci_dev *dev;
64 unsigned int n_pages;
65 unsigned int n_dma_pages;
66 struct scatterlist *sglist;
67 int direction;
68};
69
70void dma_region_init(struct dma_region *dma);
71int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
72 struct pci_dev *dev, int direction);
73void dma_region_free(struct dma_region *dma);
74void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,
75 unsigned long len);
76void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,
77 unsigned long len);
78int dma_region_mmap(struct dma_region *dma, struct file *file,
79 struct vm_area_struct *vma);
80dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,
81 unsigned long offset);
82
83
84
85
86#define dma_region_i(_dma, _type, _index) \
87 ( ((_type*) ((_dma)->kvirt)) + (_index) )
88
89#endif
90