Numworks Epsilon  1.4.1
Graphing Calculator Operating System
dma.h
Go to the documentation of this file.
1 #ifndef REGS_DMA_H
2 #define REGS_DMA_H
3 
4 #include "register.h"
5 
6 class DMA {
7 public:
8  class LIFCR : public Register32 {
9  };
10  class SCR : Register32 {
11  public:
12  enum class Burst {
13  Single = 0,
14  Incremental4 = 1,
15  Incremental8 = 2,
16  Incremental16 = 3
17  };
18  enum class DataSize {
19  Byte = 0,
20  HalfWord = 1,
21  Word = 2
22  };
23  enum class Direction {
26  MemoryToMemory = 2
27  };
28  REGS_FIELD(CHSEL, uint8_t, 27, 25);
29  REGS_FIELD(MBURST, Burst, 24, 23);
30  REGS_FIELD(PBURST, Burst, 22, 21);
31  REGS_FIELD(MSIZE, DataSize, 14, 13);
32  REGS_FIELD(PSIZE, DataSize, 12, 11);
33  REGS_BOOL_FIELD(MINC, 10);
34  REGS_BOOL_FIELD(PINC, 9);
35  REGS_BOOL_FIELD(CIRC, 8);
36  REGS_FIELD(DIR, Direction, 7, 6);
37  REGS_BOOL_FIELD(EN, 0);
38  };
39  class SNDTR : public Register32 {
40  };
41  class SPAR : public Register32 {
42  };
43  class SM0AR : public Register32 {
44  };
45 
46  constexpr DMA(int i) : m_index(i) {}
47  //constexpr operator int() const { return m_index; }
48  REGS_REGISTER_AT(LIFCR, 0x08);
49  volatile SCR * SCR(int i ) const { return (class SCR *)(Base() + 0x10 + 0x18*i); };
50  volatile SNDTR * SNDTR(int i ) const { return (class SNDTR *)(Base() + 0x14 + 0x18*i); };
51  volatile SPAR * SPAR(int i ) const { return (class SPAR *)(Base() + 0x18 + 0x18*i); };
52  volatile SM0AR * SM0AR(int i ) const { return (class SM0AR *)(Base() + 0x1C + 0x18*i); };
53 private:
54  constexpr uint32_t Base() const {
55  return 0x40026000 + 0x400*m_index;
56  };
57  int m_index;
58 };
59 
60 constexpr DMA DMA1(0);
61 constexpr DMA DMA2(1);
62 
63 #endif
volatile SM0AR * SM0AR(int i) const
Definition: dma.h:52
REGS_FIELD(CHSEL, uint8_t, 27, 25)
REGS_BOOL_FIELD(MINC, 10)
constexpr DMA DMA2(1)
DataSize
Definition: dma.h:18
Definition: dma.h:10
unsigned char uint8_t
Definition: stdint.h:4
Definition: dma.h:41
REGS_REGISTER_AT(LIFCR, 0x08)
Direction
Definition: dma.h:23
Definition: dma.h:43
Definition: dma.h:8
unsigned int uint32_t
Definition: stdint.h:6
volatile SNDTR * SNDTR(int i) const
Definition: dma.h:50
constexpr DMA(int i)
Definition: dma.h:46
constexpr DMA DMA1(0)
volatile SCR * SCR(int i) const
Definition: dma.h:49
Burst
Definition: dma.h:12
volatile SPAR * SPAR(int i) const
Definition: dma.h:51
Definition: dma.h:39
Definition: dma.h:6