aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/dma-memcpy/dma-ext.h
blob: b9195e6890def9a6f3baf62066703562d22487de (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
#ifndef __DMA_EXT_H__
#define __DMA_EXT_H__

#define SRC_STRIDE 0
#define DST_STRIDE 1
#define SEGMENT_SIZE 2
#define NSEGMENTS 3
#define ALLOC 4
#define RESP_STATUS 5

#define ALLOC_GET 1
#define ALLOC_PUT 2

static inline void dma_write_cr(int regnum, unsigned long value)
{
	asm volatile ("custom2 0, %[regnum], %[value], 5" ::
			[regnum] "r" (regnum), [value] "r" (value));
}

static inline unsigned long dma_read_cr(int regnum)
{
	int value;
	asm volatile ("custom2 %[value], %[regnum], 0, 4" : 
			[value] "=r" (value) : [regnum] "r" (regnum));
	return value;
}

static inline void dma_transfer(void *dst, void *src)
{
	asm volatile ("custom2 0, %[dst], %[src], 0" ::
			[dst] "r" (dst), [src] "r" (src));
}

static inline void dma_read_prefetch(void *dst)
{
	asm volatile ("custom2 0, %[dst], 0, 2" :: [dst] "r" (dst));
}

static inline void dma_write_prefetch(void *dst)
{
	asm volatile ("custom2 0, %[dst], 0, 3" :: [dst] "r" (dst));
}

#endif