Subversion Repositories Kolibri OS

Rev

Rev 4568 | Rev 6588 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4568 Serge 1
#ifndef _LINUX_DMA_MAPPING_H
2
#define _LINUX_DMA_MAPPING_H
3
 
6102 serge 4
#include 
5
#include 
6
#include 
7
#include 
4568 Serge 8
#include 
9
#include 
10
 
6102 serge 11
extern void *
12
dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
13
		   gfp_t flag);
14
#define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
4568 Serge 15
 
6102 serge 16
#define DMA_MASK_NONE	0x0ULL
17
 
18
static inline int valid_dma_direction(int dma_direction)
19
{
20
	return ((dma_direction == DMA_BIDIRECTIONAL) ||
21
		(dma_direction == DMA_TO_DEVICE) ||
22
		(dma_direction == DMA_FROM_DEVICE));
23
}
24
 
25
static inline int is_device_dma_capable(struct device *dev)
26
{
27
	return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
28
}
29
#ifndef dma_max_pfn
30
static inline unsigned long dma_max_pfn(struct device *dev)
31
{
32
	return *dev->dma_mask >> PAGE_SHIFT;
33
}
4568 Serge 34
#endif
6102 serge 35
 
36
static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
37
					dma_addr_t *dma_handle, gfp_t flag)
38
{
39
	void *ret = dma_alloc_coherent(dev, size, dma_handle,
40
				       flag | __GFP_ZERO);
41
	return ret;
42
}
43
 
44
#endif