-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathpoe2.hpp
190 lines (161 loc) · 5.84 KB
/
poe2.hpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#pragma once
//=========================================================================//
/*! @file
@brief RX ポートアウトプットイネーブル POE2a 定義 @n
RX111/RX113 @n
RX130/RX140 @n
RX210/RX220
@author 平松邦仁 ([email protected])
@copyright Copyright (C) 2022, 2025 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=========================================================================//
#include "common/device.hpp"
namespace device {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief POE2a クラス
@param[in] per ペリフェラル型
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
template <peripheral per>
struct poe2_t {
static constexpr auto PERIPHERAL = per; ///< ペリフェラル型
static constexpr auto OEI1 = ICU::VECTOR::OEI1; ///< OEI1 割り込みベクター
static constexpr auto OEI2 = ICU::VECTOR::OEI2; ///< OEI2 割り込みベクター
//-----------------------------------------------------------------//
/*!
@brief 入力レベルコントロール / ステータスレジスタ 1(ICSR1)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct icsr1_t : public rw16_t<base> {
typedef rw16_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 2> POE0M;
bits_rw_t<io_, bitpos::B2, 2> POE1M;
bits_rw_t<io_, bitpos::B4, 2> POE2M;
bits_rw_t<io_, bitpos::B6, 2> POE3M;
bit_rw_t <io_, bitpos::B8> PIE1;
bit_rw_t <io_, bitpos::B12> POE0F;
bit_rw_t <io_, bitpos::B13> POE1F;
bit_rw_t <io_, bitpos::B14> POE2F;
bit_rw_t <io_, bitpos::B15> POE3F;
};
static inline icsr1_t<0x0008'8900> ICSR1;
//-----------------------------------------------------------------//
/*!
@brief 出力レベルコントロール / ステータスレジスタ 1(OCSR1)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct ocsr1_t : public rw16_t<base> {
typedef rw16_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B8> OIE1;
bit_rw_t<io_, bitpos::B9> OCE1;
bit_rw_t<io_, bitpos::B15> OSF1;
};
static inline ocsr1_t<0x0008'8902> OCSR1;
//-----------------------------------------------------------------//
/*!
@brief 入力レベルコントロール / ステータスレジスタ 2(ICSR2)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct icsr2_t : public rw16_t<base> {
typedef rw16_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 2> POE8M;
bit_rw_t <io_, bitpos::B8> PIE2;
bit_rw_t <io_, bitpos::B9> POE8E;
bit_rw_t <io_, bitpos::B12> POE8F;
};
static inline icsr2_t<0x0008'8908> ICSR2;
//-----------------------------------------------------------------//
/*!
@brief ソフトウェアポートアウトプットイネーブルレジスタ(SPOER)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct spoer_t : public rw8_t<base> {
typedef rw8_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> CH34HIZ;
bit_rw_t<io_, bitpos::B1> CH0HIZ;
};
static inline spoer_t<0x0008'890A> SPOER;
//-----------------------------------------------------------------//
/*!
@brief ポートアウトプットイネーブルコントロールレジスタ 1(POECR1)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct poecr1_t : public rw8_t<base> {
typedef rw8_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PE0ZE;
bit_rw_t<io_, bitpos::B1> PE1ZE;
bit_rw_t<io_, bitpos::B2> PE2ZE;
bit_rw_t<io_, bitpos::B3> PE3ZE;
};
static inline poecr1_t<0x0008'890B> POECR1;
//-----------------------------------------------------------------//
/*!
@brief ポートアウトプットイネーブルコントロールレジスタ 2(POECR2)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct poecr2_t : public rw16_t<base> {
typedef rw16_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B4> P3CZE;
bit_rw_t<io_, bitpos::B5> P2CZE;
bit_rw_t<io_, bitpos::B6> P1CZE;
};
static inline poecr2_t<0x0008'890C> POECR2;
//-----------------------------------------------------------------//
/*!
@brief 入力レベルコントロール / ステータスレジスタ 3(ICSR3)
@param[in] base ベースアドレス
*/
//-----------------------------------------------------------------//
template <uint32_t base>
struct icsr3_t : public rw16_t<base> {
typedef rw16_t<base> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t <io_, bitpos::B9> OSTSTE;
bit_rw_t <io_, bitpos::B12> OSTSTF;
};
static inline icsr3_t<0x0008'890E> ICSR3;
};
typedef poe2_t<peripheral::POE2> POE2;
}