Numworks Epsilon  1.4.1
Graphing Calculator Operating System
cm4.h
Go to the documentation of this file.
1 #ifndef REGS_CM4_H
2 #define REGS_CM4_H
3 
4 #include "register.h"
5 
6 class CM4 {
7 public:
8  // Vector table offset register
9  // http://www.st.com/content/ccc/resource/technical/document/programming_manual/6c/3a/cb/e7/e4/ea/44/9b/DM00046982.pdf/files/DM00046982.pdf/jcr:content/translations/en.DM00046982.pdf
10  class VTOR : Register32 {
11  public:
12  void setVTOR(void *address) volatile { setBitRange(29, 9, (uint32_t)address); }
13  };
14 
15  // Coprocessor Access Control Register
16  // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/BEHBJHIG.html
17  class CPACR : public Register32 {
18  public:
19  enum class Access {
20  Denied = 0,
21  PrivilegedOnly = 1,
22  Full = 3
23  };
24  void setAccess(int index, Access a) volatile { setBitRange(2*index+1, 2*index, (uint32_t)a); }
25  };
26 
27 
28  // Application Interrupt and Reset Control Register
29  // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihehdge.html
30  class AIRCR : public Register32 {
31  public:
32  void requestReset() volatile {
33  set(0x5FA<<16 |(1<<2));
34  }
35  };
36 
37  // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/Cihhjgdh.html
38  class SCR : public Register32 {
39  public:
40  REGS_BOOL_FIELD(SLEEPDEEP, 2);
41  };
42 
43  constexpr CM4() {};
44  REGS_REGISTER_AT(VTOR, 0x08);
45  REGS_REGISTER_AT(AIRCR, 0x0C);
46  REGS_REGISTER_AT(SCR, 0x10);
47  REGS_REGISTER_AT(CPACR, 0x88);
48 private:
49  constexpr uint32_t Base() const {
50  return 0xE000ED00;
51  }
52 };
53 
54 constexpr CM4 CM4;
55 
56 #endif
constexpr CM4 CM4
Definition: cm4.h:54
Definition: cm4.h:6
constexpr CM4()
Definition: cm4.h:43
unsigned int uint32_t
Definition: stdint.h:6
REGS_REGISTER_AT(VTOR, 0x08)
void requestReset() volatile
Definition: cm4.h:32
void setAccess(int index, Access a) volatile
Definition: cm4.h:24
void setBitRange(uint8_t high, uint8_t low, T value) volatile
Definition: register.h:21
Definition: cm4.h:30
Definition: cm4.h:10
Access
Definition: cm4.h:19
Definition: cm4.h:17
Definition: cm4.h:38
REGS_BOOL_FIELD(SLEEPDEEP, 2)
void setVTOR(void *address) volatile
Definition: cm4.h:12