summaryrefslogtreecommitdiff
path: root/dma/dma.h
blob: 30d1346ade23ff65781f7b97120062e4b0375f4f (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
#ifndef DMA_H
#define DMA_H

#include <stdint.h>

struct DMA_stream_reg_t {
	volatile uint32_t CR;
	volatile uint32_t NDTR;
	volatile uint32_t PAR;
	volatile uint32_t M0AR;
	volatile uint32_t M1AR;
	volatile uint32_t FCR;
};

struct DMA_reg_t {
	volatile uint32_t LISR;
	volatile uint32_t HISR;
	volatile uint32_t LIFCR;
	volatile uint32_t HIFCR;
	DMA_stream_reg_t S[8];
};

class DMA_t {
	public:
		DMA_reg_t& reg;
		
		DMA_t(uint32_t reg_addr) : reg(*(DMA_reg_t*)reg_addr) {}
};

#if defined(STM32F1)

#elif defined(STM32F4)
static DMA_t DMA1(0x40026000);
static DMA_t DMA2(0x40026400);
#endif

#endif