diff options
Diffstat (limited to 'include/dma.h')
-rw-r--r-- | include/dma.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/dma.h b/include/dma.h new file mode 100644 index 0000000..3c45f7a --- /dev/null +++ b/include/dma.h @@ -0,0 +1,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(); |