1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _MITE_H_
20#define _MITE_H_
21
22#include <linux/spinlock.h>
23
24#define MAX_MITE_DMA_CHANNELS 8
25
26struct comedi_device;
27struct comedi_subdevice;
28struct device;
29struct pci_dev;
30
31struct mite_dma_desc {
32 __le32 count;
33 __le32 addr;
34 __le32 next;
35 u32 dar;
36};
37
38struct mite_ring {
39 struct device *hw_dev;
40 unsigned int n_links;
41 struct mite_dma_desc *descs;
42 dma_addr_t dma_addr;
43};
44
45struct mite_channel {
46 struct mite *mite;
47 unsigned int channel;
48 int dir;
49 int done;
50 struct mite_ring *ring;
51};
52
53struct mite {
54 struct pci_dev *pcidev;
55 void __iomem *mmio;
56 struct mite_channel channels[MAX_MITE_DMA_CHANNELS];
57 int num_channels;
58 unsigned int fifo_size;
59
60 spinlock_t lock;
61};
62
63u32 mite_bytes_in_transit(struct mite_channel *);
64
65void mite_sync_dma(struct mite_channel *, struct comedi_subdevice *);
66void mite_ack_linkc(struct mite_channel *, struct comedi_subdevice *s,
67 bool sync);
68int mite_done(struct mite_channel *);
69
70void mite_dma_arm(struct mite_channel *);
71void mite_dma_disarm(struct mite_channel *);
72
73void mite_prep_dma(struct mite_channel *,
74 unsigned int num_device_bits, unsigned int num_memory_bits);
75
76struct mite_channel *mite_request_channel_in_range(struct mite *,
77 struct mite_ring *,
78 unsigned int min_channel,
79 unsigned int max_channel);
80struct mite_channel *mite_request_channel(struct mite *, struct mite_ring *);
81void mite_release_channel(struct mite_channel *);
82
83int mite_init_ring_descriptors(struct mite_ring *, struct comedi_subdevice *,
84 unsigned int nbytes);
85int mite_buf_change(struct mite_ring *, struct comedi_subdevice *);
86
87struct mite_ring *mite_alloc_ring(struct mite *);
88void mite_free_ring(struct mite_ring *);
89
90struct mite *mite_attach(struct comedi_device *, bool use_win1);
91void mite_detach(struct mite *);
92
93
94
95
96#define MITE_IODWBSR 0xc0
97#define MITE_IODWBSR_1 0xc4
98#define WENAB BIT(7)
99#define MITE_IODWCR_1 0xf4
100
101#endif
102