-
Notifications
You must be signed in to change notification settings - Fork 0
/
dma.h
36 lines (29 loc) · 791 Bytes
/
dma.h
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
#ifndef DMA_H
#define DMA_H
#define IO_TO_BUS(x) (void*)((unsigned int)(x) & 0x00ffffff | 0x7e000000)
// Assigned channels
#define DMA_CHAN_EMMC 0
// Control block
struct dma_cb {
unsigned int ti;
void *source_ad;
void *dest_ad;
unsigned int txfr_len;
unsigned int stride;
void *nextconbk;
};
// Transfer Information
#define DMA_TI_INTEN 1<<0
#define DMA_TI_WAIT_RESP 1<<3
#define DMA_TI_DEST_INC 1<<4
#define DMA_TI_DEST_WIDTH 1<<5
#define DMA_TI_DEST_DREQ 1<<6
#define DMA_TI_SRC_INC 1<<8
#define DMA_TI_SRC_WIDTH 1<<9
#define DMA_TI_SRC_DREQ 1<<10
#define DMA_TI_PERMAP_EMMC DMA_TI_PERMAP(11)
#define DMA_TI_PERMAP(x) (x)<<16
// Functions
void dma_reset(unsigned int chan);
int dma_initiate(unsigned int chan, struct dma_cb *ctrl_block);
#endif