OpenMPTL - ARM Cortex (common)
C++ Microprocessor Template Library
nvic.hpp
Go to the documentation of this file.
1 /*
2  * OpenMPTL - C++ Microprocessor Template Library
3  *
4  * Copyright (C) 2012-2017 Axel Burri <axel@tty0.ch>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef ARM_CORTEX_COMMON_REG_NVIC_HPP_INCLUDED
22 #define ARM_CORTEX_COMMON_REG_NVIC_HPP_INCLUDED
23 
24 #include <register.hpp>
25 
26 namespace mptl {
27 
28 /**
29  * NVIC (Nested Vectored Interrupt Controller) Register
30  *
31  * For details, see "Cortex-M3 Technical Reference Manual":
32  * <http://infocenter.arm.com/help/topic/com.arm.doc.subset.cortexm.m3/index.html>
33  */
34 struct NVIC
35 {
36  /** Interrupt Controller Type Register */
38 
39  // TODO: The following registers are actually only 8bit wide.
40  // Check if access is better using 32bit or 8bit pointer
41 
42  /** Interrupt Set-Enable Registers */
43  template<unsigned reg_index>
44  class ISER : public reg<uint32_t, 0xE000E100 + 4 * reg_index, rw >
45  { static_assert(reg_index < 8, "invalid index for register"); };
46 
47  /** Interrupt Set-Enable Registers */
48  template<unsigned reg_index>
49  class ICER : public reg<uint32_t, 0xE000E180 + 4 * reg_index, rw >
50  { static_assert(reg_index < 8, "invalid index for register"); };
51 
52  /** Interrupt Set-Pending Registers */
53  template<unsigned reg_index>
54  class ISPR : public reg<uint32_t, 0xE000E200 + 4 * reg_index, rw >
55  { static_assert(reg_index < 8, "invalid index for register"); };
56 
57  /** Interrupt Clear-Pending Registers */
58  template<unsigned reg_index>
59  class ICPR : public reg<uint32_t, 0xE000E280 + 4 * reg_index, rw >
60  { static_assert(reg_index < 8, "invalid index for register"); };
61 
62  /** Interrupt Active Bit Register */
63  template<unsigned reg_index>
64  class IABR : public reg<uint32_t, 0xE000E300 + 4 * reg_index, ro >
65  { static_assert(reg_index < 8, "invalid index for register"); };
66 
67  /** Interrupt Priority Register */
68  template<unsigned reg_index>
69  class IPR : public reg<uint32_t, 0xE000E400 + 4 * reg_index, rw >
70  { static_assert(reg_index < 60, "invalid index for register"); };
71 };
72 
73 } // namespace mptl
74 
75 #endif // ARM_CORTEX_COMMON_REG_NVIC_HPP_INCLUDED
Interrupt Set-Pending Registers.
Definition: nvic.hpp:54
Interrupt Set-Enable Registers.
Definition: nvic.hpp:49
Interrupt Clear-Pending Registers.
Definition: nvic.hpp:59
NVIC (Nested Vectored Interrupt Controller) Register.
Definition: nvic.hpp:34
Interrupt Active Bit Register.
Definition: nvic.hpp:64
Interrupt Priority Register.
Definition: nvic.hpp:69
Interrupt Set-Enable Registers.
Definition: nvic.hpp:44