0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef CTVMEM_H
0016 #define CTVMEM_H
0017
0018 #define CT_PTP_NUM 4
0019
0020 #include <linux/mutex.h>
0021 #include <linux/list.h>
0022 #include <linux/pci.h>
0023 #include <sound/memalloc.h>
0024
0025
0026
0027
0028 #define CT_PAGE_SIZE 4096
0029 #define CT_PAGE_SHIFT 12
0030 #define CT_PAGE_MASK (~(PAGE_SIZE - 1))
0031 #define CT_PAGE_ALIGN(addr) ALIGN(addr, CT_PAGE_SIZE)
0032
0033 struct ct_vm_block {
0034 unsigned int addr;
0035 unsigned int size;
0036 struct list_head list;
0037 };
0038
0039 struct snd_pcm_substream;
0040
0041
0042 struct ct_vm {
0043 struct snd_dma_buffer ptp[CT_PTP_NUM];
0044 unsigned int size;
0045 struct list_head unused;
0046 struct list_head used;
0047 struct mutex lock;
0048
0049
0050 struct ct_vm_block *(*map)(struct ct_vm *, struct snd_pcm_substream *,
0051 int size);
0052
0053 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
0054 dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
0055 };
0056
0057 int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
0058 void ct_vm_destroy(struct ct_vm *vm);
0059
0060 #endif