1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifndef CTVMEM_H
16 #define CTVMEM_H
17
18 #define CT_PTP_NUM 4
19
20 #include <linux/mutex.h>
21 #include <linux/list.h>
22 #include <linux/pci.h>
23 #include <sound/memalloc.h>
24
25
26
27
28 #define CT_PAGE_SIZE 4096
29 #define CT_PAGE_SHIFT 12
30 #define CT_PAGE_MASK (~(PAGE_SIZE - 1))
31 #define CT_PAGE_ALIGN(addr) ALIGN(addr, CT_PAGE_SIZE)
32
33 struct ct_vm_block {
34 unsigned int addr;
35 unsigned int size;
36 struct list_head list;
37 };
38
39 struct snd_pcm_substream;
40
41
42 struct ct_vm {
43 struct snd_dma_buffer ptp[CT_PTP_NUM];
44 unsigned int size;
45 struct list_head unused;
46 struct list_head used;
47 struct mutex lock;
48
49
50 struct ct_vm_block *(*map)(struct ct_vm *, struct snd_pcm_substream *,
51 int size);
52
53 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
54 dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
55 };
56
57 int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
58 void ct_vm_destroy(struct ct_vm *vm);
59
60 #endif