Numworks Epsilon  1.4.1
Graphing Calculator Operating System
fsmc.h
Go to the documentation of this file.
1 #ifndef REGS_FSMC_H
2 #define REGS_FSMC_H
3 
4 #include "register.h"
5 
6 class FSMC {
7 public:
8  class BCR : Register32 {
9  public:
10  enum class MTYP : uint8_t {
11  SRAM = 0,
12  PSRAM = 1,
13  NOR = 2
14  };
15  enum class MWID : uint8_t {
16  EIGHT_BITS = 0,
17  SIXTEEN_BITS = 1
18  };
19  REGS_BOOL_FIELD(MBKEN, 0);
20  REGS_BOOL_FIELD(MUXEN, 1);
21  REGS_TYPE_FIELD(MTYP, 3, 2);
22  REGS_TYPE_FIELD(MWID, 5, 4);
23  REGS_BOOL_FIELD(WREN, 12);
24  REGS_BOOL_FIELD(EXTMOD, 14);
25  };
26 
27  class BTR : Register32 {
28  public:
29  enum class ACCMOD : uint8_t {
30  A = 0,
31  B = 1,
32  C = 2,
33  D = 3
34  };
35  REGS_FIELD(ADDSET, uint8_t, 3, 0);
36  REGS_FIELD(ADDHLD, uint8_t, 7, 4);
37  REGS_FIELD(DATAST, uint8_t, 15, 8);
38  REGS_FIELD(BUSTURN, uint8_t, 19, 16);
39  REGS_FIELD(CLKDIV, uint8_t, 23, 20);
40  REGS_FIELD(DATLAT, uint8_t, 27, 24);
41  REGS_TYPE_FIELD(ACCMOD, 29, 28);
42  };
43 
44  class BWTR : Register32 {
45  public:
46  enum class ACCMOD : uint8_t {
47  A = 0,
48  B = 1,
49  C = 2,
50  D = 3
51  };
52  REGS_FIELD(ADDSET, uint8_t, 3, 0);
53  REGS_FIELD(ADDHLD, uint8_t, 7, 4);
54  REGS_FIELD(DATAST, uint8_t, 15, 8);
55  REGS_FIELD(BUSTURN, uint8_t, 19, 16);
56  REGS_FIELD(CLKDIV, uint8_t, 23, 20);
57  REGS_FIELD(DATLAT, uint8_t, 27, 24);
58  REGS_TYPE_FIELD(ACCMOD, 29, 28);
59  };
60 
61  constexpr FSMC() {}
62  volatile BCR * BCR(int index) const {
63  return (class BCR *)(Base() + 8*(index-1));
64  }
65  volatile BTR * BTR(int index) const {
66  return (class BTR *)(Base() + 4 + 8*(index-1));
67  }
68  volatile BWTR * BWTR(int index) const {
69  return (class BWTR *)(Base() + 0x104 + 8*(index-1));
70  }
71 private:
72  constexpr uint32_t Base() const {
73  return 0xA0000000;
74  };
75 };
76 
77 constexpr FSMC FSMC;
78 
79 #endif
Definition: fsmc.h:6
ACCMOD
Definition: fsmc.h:29
unsigned char uint8_t
Definition: stdint.h:4
REGS_FIELD(ADDSET, uint8_t, 3, 0)
unsigned int uint32_t
Definition: stdint.h:6
ACCMOD
Definition: fsmc.h:46
REGS_BOOL_FIELD(MBKEN, 0)
REGS_TYPE_FIELD(ACCMOD, 29, 28)
volatile BCR * BCR(int index) const
Definition: fsmc.h:62
volatile BTR * BTR(int index) const
Definition: fsmc.h:65
MTYP
Definition: fsmc.h:10
REGS_FIELD(ADDSET, uint8_t, 3, 0)
REGS_TYPE_FIELD(ACCMOD, 29, 28)
MWID
Definition: fsmc.h:15
Definition: fsmc.h:8
Definition: fsmc.h:27
volatile BWTR * BWTR(int index) const
Definition: fsmc.h:68
constexpr FSMC()
Definition: fsmc.h:61
constexpr FSMC FSMC
Definition: fsmc.h:77
REGS_TYPE_FIELD(MTYP, 3, 2)