summaryrefslogtreecommitdiffstats
path: root/include/dma.h
blob: 3c45f7ac6bc375fc937ac495672b50b9d7b753df (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
#define PORT_DMA_BASE_ADDR0 0x00
#define PORT_DMA_WORD_COUNT0 0x01
#define PORT_DMA_BASE_ADDR1 0x02
#define PORT_DMA_WORD_COUNT1 0x03
#define PORT_DMA_BASE_ADDR2 0x04
#define PORT_DMA_WORD_COUNT2 0x05
#define PORT_DMA_BASE_ADDR3 0x06
#define PORT_DMA_WORD_COUNT3 0x07

#define PORT_DMA_COMMAND 0x08
#define PORT_DMA_WRITE_REQUEST 0x09
#define PORT_DMA_MASK 0x0A
#define PORT_DMA_MODE 0x0B
#define PORT_DMA_FF 0x0C

#define PORT_DMA_PAGE0 0x87
#define PORT_DMA_PAGE1 0x83
#define PORT_DMA_PAGE2 0x81
#define PORT_DMA_PAGE3 0x82

#define DMA_MODE_DEMAND 0x00
#define DMA_MODE_SINGLE 0x40
#define DMA_MODE_BLOCK 0x80
#define DMA_MODE_CASCADE 0xC0

#define DMA_MODE_VERIFY 0x00
#define DMA_MODE_READ 0x04
#define DMA_MODE_WRITE 0x08

#define DMA_MODE_INC_ADDR 0x00
#define DMA_MODE_DEC_ADDR 0x20


static unsigned char dma_page_ports[4] = {
	PORT_DMA_PAGE0,
	PORT_DMA_PAGE1,
	PORT_DMA_PAGE2,
	PORT_DMA_PAGE3
};


void dma_enable(unsigned char dma_nr);
void dma_disable(unsigned char dma_nr);
void dma_set_base_addr(unsigned char dma_nr, void *addr);
void dma_set_word_count(unsigned char dma_nr, unsigned short words);
void dma_set_mode(unsigned char dma_nr, unsigned char mode);
void dma_clear_ff();