blob: 14af196748ddb82f978e60d899e375d66d8f1490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* bmm_lib.h
*
* Buffer Management Module
*
* User level BMM Defines/Globals/Functions
*
* Li Li (lea.li@marvell.com)
*(C) Copyright 2007 Marvell International Ltd.
* All Rights Reserved
*/
#if !defined (__BMM_LIB_H__)
#define __BMM_LIB_H__
/* ioctl arguments: memory attributes */
#define BMM_ATTR_DEFAULT (0) /* cacheable bufferable */
#define BMM_ATTR_WRITECOMBINE (1 << 0) /* non-cacheable & bufferable */
#define BMM_ATTR_NONCACHED (1 << 1) /* non-cacheable & non-bufferable */
/* Note: extra attributes below are not supported yet! */
#define BMM_ATTR_HUGE_PAGE (1 << 2) /* 64KB page size */
#define BMM_ATTR_WRITETHROUGH (1 << 3) /* implies L1 Cacheable */
#define BMM_ATTR_L2_CACHEABLE (1 << 4) /* implies L1 Cacheable */
/* obsolete */
#define BMM_ATTR_NONBUFFERABLE (1 << 5) /* non-bufferable */
#define BMM_ATTR_NONCACHEABLE (1 << 6) /* non-cacheable */
/* ioctl arguments: cache flush direction */
#define BMM_DMA_BIDIRECTIONAL (0) /* DMA_BIDIRECTIONAL */
#define BMM_DMA_TO_DEVICE (1) /* DMA_TO_DEVICE */
#define BMM_DMA_FROM_DEVICE (2) /* DMA_FROM_DEVICE */
#define BMM_DMA_NONE (3) /* DMA_NONE */
#if defined (__cplusplus)
extern "C" {
#endif
int bmm_init();
void bmm_exit();
void *bmm_malloc(unsigned long size, int attr);
void *bmm_malloc_aligned(unsigned long size, int attr, unsigned align);
void bmm_free(void *vaddr);
void *bmm_attach(unsigned long paddr, unsigned long len);
void bmm_detach(void *vaddr, unsigned long len);
void *bmm_get_vaddr(unsigned long paddr);
unsigned long bmm_get_paddr(void *vaddr);
int bmm_get_mem_attr(void *vaddr);
int bmm_set_mem_attr(void *vaddr, int attr); /* Not supported yet */
unsigned long bmm_get_mem_size(void *vaddr);
unsigned long bmm_get_total_space();
unsigned long bmm_get_free_space();
unsigned long bmm_get_allocated_space();
void bmm_flush_cache(void *vaddr, int dir);
void bmm_flush_cache_range(void *start, size_t size, int direction);
void bmm_flush_user(void *start, long size, int direction);
void bmm_dump(); /* for debugging */
#if defined (__cplusplus)
}
#endif
#endif /* __BMM_LIB_H__ */
|