diff options
Diffstat (limited to 'sound/pci/ctxfi/ctvmem.h')
-rw-r--r-- | sound/pci/ctxfi/ctvmem.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h new file mode 100644 index 000000000000..4eb5bdd5cad4 --- /dev/null +++ b/sound/pci/ctxfi/ctvmem.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /** | ||
2 | * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. | ||
3 | * | ||
4 | * This source file is released under GPL v2 license (no other versions). | ||
5 | * See the COPYING file included in the main directory of this source | ||
6 | * distribution for the license terms and conditions. | ||
7 | * | ||
8 | * @File ctvmem.h | ||
9 | * | ||
10 | * @Brief | ||
11 | * This file contains the definition of virtual memory management object | ||
12 | * for card device. | ||
13 | * | ||
14 | * @Author Liu Chun | ||
15 | * @Date Mar 28 2008 | ||
16 | */ | ||
17 | |||
18 | #ifndef CTVMEM_H | ||
19 | #define CTVMEM_H | ||
20 | |||
21 | #define CT_PTP_NUM 1 /* num of device page table pages */ | ||
22 | |||
23 | #include <linux/spinlock.h> | ||
24 | #include <linux/list.h> | ||
25 | |||
26 | struct ct_vm_block { | ||
27 | unsigned int addr; /* starting logical addr of this block */ | ||
28 | unsigned int size; /* size of this device virtual mem block */ | ||
29 | struct list_head list; | ||
30 | }; | ||
31 | |||
32 | /* Virtual memory management object for card device */ | ||
33 | struct ct_vm { | ||
34 | void *ptp[CT_PTP_NUM]; /* Device page table pages */ | ||
35 | unsigned int size; /* Available addr space in bytes */ | ||
36 | struct list_head unused; /* List of unused blocks */ | ||
37 | struct list_head used; /* List of used blocks */ | ||
38 | |||
39 | /* Map host addr (kmalloced/vmalloced) to device logical addr. */ | ||
40 | struct ct_vm_block *(*map)(struct ct_vm *, void *host_addr, int size); | ||
41 | /* Unmap device logical addr area. */ | ||
42 | void (*unmap)(struct ct_vm *, struct ct_vm_block *block); | ||
43 | void *(*get_ptp_virt)(struct ct_vm *vm, int index); | ||
44 | }; | ||
45 | |||
46 | int ct_vm_create(struct ct_vm **rvm); | ||
47 | void ct_vm_destroy(struct ct_vm *vm); | ||
48 | |||
49 | #endif /* CTVMEM_H */ | ||