summaryrefslogtreecommitdiff
path: root/bmm_lib.h
blob: a381f25ede57b95da62797e99587b6f4e583b4df (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
/*
 *  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);
void bmm_exit(void);

int bmm_dmabuf_alloc(unsigned long size, int attr, unsigned align);
void *bmm_dmabuf_map(int fd, unsigned offset, unsigned size);
void bmm_dmabuf_unmap(void *addr);
int bmm_dmabuf_flush(int fd, void *addr, unsigned offset, unsigned size, unsigned direction);
int bmm_dmabuf_fd(void *addr);
void bmm_dmabuf_free(int fd);

#if defined (__cplusplus)
}
#endif

#endif /* __BMM_LIB_H__ */