libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
ri.h
Go to the documentation of this file.
1
/** @defgroup ri_defines Routing Interface registers
2
*
3
* @brief <b>Register definitions for the STM32L1xx Routing Interface</b>
4
*
5
* @ingroup STM32L1xx
6
*
7
* @version 1.0.0
8
*
9
* LGPL License Terms @ref lgpl_license
10
*/
11
/*
12
* This file is part of the libopencm3 project.
13
*
14
* Copyright (C) 2016 Marek Koza <qyx@krtko.org>
15
*
16
* This library is free software: you can redistribute it and/or modify
17
* it under the terms of the GNU Lesser General Public License as published by
18
* the Free Software Foundation, either version 3 of the License, or
19
* (at your option) any later version.
20
*
21
* This library is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU Lesser General Public License for more details.
25
*
26
* You should have received a copy of the GNU Lesser General Public License
27
* along with this library. If not, see <http://www.gnu.org/licenses/>.
28
*
29
* Based on the RM0038 Reference manual
30
* (STM32L100xx, STM32L151xx, STM32L152xx and STM32L162xx advanced ARMĀ®-based
31
* 32-bit MCUs)
32
*/
33
/**@{*/
34
35
/*
36
* There is a mismatch in the RM0038 in the RI register offset addresses (they
37
* are relative to the COMP base address instead of the RI base address for an
38
* unknown reason). We are subtracting 4 in order to use them with ROUTING_BASE.
39
*/
40
#define RI_BASE ROUTING_BASE - 0x04
41
42
#define RI_ICR MMIO32(RI_BASE + 0x04)
43
#define RI_ASCR1 MMIO32(RI_BASE + 0x08)
44
#define RI_ASCR2 MMIO32(RI_BASE + 0x0c)
45
#define RI_HYSCR1 MMIO32(RI_BASE + 0x10)
46
#define RI_HYSCR2 MMIO32(RI_BASE + 0x14)
47
#define RI_HYSCR3 MMIO32(RI_BASE + 0x18)
48
#define RI_HYSCR4 MMIO32(RI_BASE + 0x1c)
49
#define RI_ASMR1 MMIO32(RI_BASE + 0x20)
50
#define RI_CMR1 MMIO32(RI_BASE + 0x24)
51
#define RI_CICR1 MMIO32(RI_BASE + 0x28)
52
#define RI_ASMR2 MMIO32(RI_BASE + 0x2c)
53
#define RI_CMR2 MMIO32(RI_BASE + 0x30)
54
#define RI_CICR2 MMIO32(RI_BASE + 0x34)
55
#define RI_ASMR3 MMIO32(RI_BASE + 0x38)
56
#define RI_CMR3 MMIO32(RI_BASE + 0x3c)
57
#define RI_CICR3 MMIO32(RI_BASE + 0x40)
58
#define RI_ASMR4 MMIO32(RI_BASE + 0x44)
59
#define RI_CMR4 MMIO32(RI_BASE + 0x48)
60
#define RI_CICR4 MMIO32(RI_BASE + 0x4c)
61
#define RI_ASMR5 MMIO32(RI_BASE + 0x50)
62
#define RI_CMR5 MMIO32(RI_BASE + 0x54)
63
#define RI_CICR5 MMIO32(RI_BASE + 0x58)
64
65
/**
66
* RI input capture register
67
*
68
* The RI_ICR register is used to select the routing of 4 full ports to the
69
* input captures of TIM2, TIM3 and TIM4.
70
*/
71
#define RI_ICR_IC1IOS_SHIFT 0
72
#define RI_ICR_IC1IOS_MASK 0xf
73
#define RI_ICR_IC2IOS_SHIFT 4
74
#define RI_ICR_IC2IOS_MASK 0xf
75
#define RI_ICR_IC3IOS_SHIFT 8
76
#define RI_ICR_IC3IOS_MASK 0xf
77
#define RI_ICR_IC4IOS_SHIFT 12
78
#define RI_ICR_IC4IOS_MASK 0xf
79
#define RI_ICR_TIM_SHIFT 16
80
#define RI_ICR_TIM_MASK 0x3
81
#define RI_ICR_IC1 (1 << 18)
82
#define RI_ICR_IC2 (1 << 19)
83
#define RI_ICR_IC3 (1 << 20)
84
#define RI_ICR_IC4 (1 << 21)
85
/* bits 22-31 reserved */
86
87
/**
88
* RI analog switches control register 1
89
*
90
* The RI_ASCR1 register is used to configure the analog switches of the I/Os
91
* linked to the ADC. These I/Os are pointed to by the ADC channel number.
92
*/
93
#define RI_ASCR1_CH0_GR1_1 (1 << 0)
94
#define RI_ASCR1_CH1_GR1_2 (1 << 1)
95
#define RI_ASCR1_CH2_GR1_3 (1 << 2)
96
#define RI_ASCR1_CH3_GR1_4 (1 << 3)
97
#define RI_ASCR1_CH4 (1 << 4)
98
#define RI_ASCR1_CH5 (1 << 5)
99
#define RI_ASCR1_CH6_GR2_1 (1 << 6)
100
#define RI_ASCR1_CH7_GR2_2 (1 << 7)
101
#define RI_ASCR1_CH8_GR3_1 (1 << 8)
102
#define RI_ASCR1_CH9_GR3_2 (1 << 9)
103
#define RI_ASCR1_CH10_GR8_1 (1 << 10)
104
#define RI_ASCR1_CH11_GR8_2 (1 << 11)
105
#define RI_ASCR1_CH12_GR8_3 (1 << 12)
106
#define RI_ASCR1_CH13_GR8_4 (1 << 13)
107
#define RI_ASCR1_CH14_GR9_1 (1 << 14)
108
#define RI_ASCR1_CH15_GR9_2 (1 << 15)
109
#define RI_ASCR1_CH31_GR11_5 (1 << 16)
110
/* bit 17 reserved */
111
#define RI_ASCR1_CH18_GR7_1 (1 << 18)
112
#define RI_ASCR1_CH19_GR7_2 (1 << 19)
113
#define RI_ASCR1_CH20_GR7_3 (1 << 20)
114
#define RI_ASCR1_CH21_GR7_4 (1 << 21)
115
#define RI_ASCR1_CH22 (1 << 22)
116
#define RI_ASCR1_CH23 (1 << 23)
117
#define RI_ASCR1_CH24 (1 << 24)
118
#define RI_ASCR1_CH25 (1 << 25)
119
#define RI_ASCR1_VCOMP (1 << 26)
120
#define RI_ASCR1_CH27_GR11_1 (1 << 27)
121
#define RI_ASCR1_CH28_GR11_2 (1 << 28)
122
#define RI_ASCR1_CH29_GR11_3 (1 << 29)
123
#define RI_ASCR1_CH30_GR11_4 (1 << 30)
124
#define RI_ASCR1_SCM (1 << 31)
125
126
/**
127
* RI analog switches control register 2
128
*
129
* The RI_ASCR2 register is used to configure the analog switches of groups of
130
* I/Os not linked to the ADC. In this way, predefined groups of I/Os can be
131
* connected together.
132
*/
133
#define RI_ASCR2_GR10_1 (1 << 0)
134
#define RI_ASCR2_GR10_2 (1 << 1)
135
#define RI_ASCR2_GR10_3 (1 << 2)
136
#define RI_ASCR2_GR10_4 (1 << 3)
137
#define RI_ASCR2_GR6_1 (1 << 4)
138
#define RI_ASCR2_GR6_2 (1 << 5)
139
#define RI_ASCR2_GR5_1 (1 << 6)
140
#define RI_ASCR2_GR5_2 (1 << 7)
141
#define RI_ASCR2_GR5_3 (1 << 8)
142
#define RI_ASCR2_GR4_1 (1 << 9)
143
#define RI_ASCR2_GR4_2 (1 << 10)
144
#define RI_ASCR2_GR4_3 (1 << 11)
145
/* bits 12-15 reserved */
146
#define RI_ASCR2_CH0B_GR3_3 (1 << 16)
147
#define RI_ASCR2_CH1B_GR3_4 (1 << 17)
148
#define RI_ASCR2_CH2B_GR3_5 (1 << 18)
149
#define RI_ASCR2_CH3B_GR9_3 (1 << 19)
150
#define RI_ASCR2_CH6B_GR9_4 (1 << 20)
151
#define RI_ASCR2_CH7B_GR2_3 (1 << 21)
152
#define RI_ASCR2_CH8B_GR2_4 (1 << 22)
153
#define RI_ASCR2_CH9B_GR2_5 (1 << 23)
154
#define RI_ASCR2_CH10B_GR7_5 (1 << 24)
155
#define RI_ASCR2_CH11B_GR7_6 (1 << 25)
156
#define RI_ASCR2_CH12B_GR7_7 (1 << 26)
157
#define RI_ASCR2_GR6_3 (1 << 27)
158
#define RI_ASCR2_GR6_4 (1 << 28)
159
/* bits 29-31 reserved */
160
161
/**
162
* RI hysteresis control register 1
163
*
164
* The RI_HYSCR1 register is used to enable/disable the hysteresis of the input
165
* Schmitt trigger of ports A and B.
166
*
167
* GPIO0-GPIO15 defines should be used as parameters.
168
*/
169
#define RI_HYSCR1_PA(x) (x)
170
#define RI_HYSCR1_PB(x) (x << 16)
171
172
/**
173
* RI hysteresis control register 2
174
*
175
* RI_HYSCR2 register allows to enable/disable hysteresis of input Schmitt
176
* trigger of ports C and D.
177
*
178
* GPIO0-GPIO15 defines should be used as parameters.
179
*/
180
#define RI_HYSCR2_PC(x) (x)
181
#define RI_HYSCR2_PD(x) (x << 16)
182
183
/**
184
* RI hysteresis control register 3
185
*
186
* The RI_HYSCR3 register is used to enable/disable the hysteresis of the input
187
* Schmitt trigger of the entire port E and F.
188
*
189
* GPIO0-GPIO15 defines should be used as parameters.
190
*/
191
#define RI_HYSCR3_PE(x) (x)
192
#define RI_HYSCR3_PF(x) (x << 16)
193
194
/**
195
* RI hysteresis control register 4
196
*
197
* The RI_HYSCR4 register is used to enable/disable the hysteresis of the input
198
* Schmitt trigger of the entire port G.
199
*
200
* GPIO0-GPIO15 defines should be used as parameters.
201
*/
202
#define RI_HYSCR2_PG(x) (x)
203
/* bits 16-31 reserved */
204
205
/**
206
* Analog switch mode register (RI_ASMR1)
207
*
208
* The RI_ASMR1 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
209
* only and is used to select if analog switches of port A are to be controlled
210
* by the timer OC or through the ADC interface or RI_ASCRx registers.
211
*
212
* GPIO0-GPIO15 defines should be used as parameters.
213
*/
214
#define RI_ASMR1_PA(x) (x)
215
/* bits 16-31 reserved */
216
217
/**
218
* Channel mask register (RI_CMR1)
219
*
220
* RI_CMR1 is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices only and is
221
* used to mask a port A channel designated as a timer input capture (after
222
* acquisition completion to avoid triggering multiple detections).
223
*
224
* GPIO0-GPIO15 defines should be used as parameters.
225
*/
226
#define RI_CMR1_PA(x) (x)
227
/* bits 16-31 reserved */
228
229
/**
230
* Channel identification for capture register (RI_CICR1)
231
*
232
* The RI_CICR1 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
233
* only and is used when analog switches are controlled by a timer OC. RI_CICR1
234
* allows a channel to be identified for timer input capture.
235
*
236
* GPIO0-GPIO15 defines should be used as parameters.
237
*/
238
#define RI_CICR1_PA(x) (x)
239
/* bits 16-31 reserved */
240
241
/**
242
* Analog switch mode register (RI_ASMR2)
243
*
244
* The RI_ASMR2 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
245
* only and is used to select if analog switches of port B are to be controlled
246
* by the timer OC or through the ADC interface or RI_ASCRx registers.
247
*
248
* GPIO0-GPIO15 defines should be used as parameters.
249
*/
250
#define RI_ASMR2_PB(x) (x)
251
/* bits 16-31 reserved */
252
253
/**
254
* Channel mask register (RI_CMR2)
255
*
256
* RI_CMR2 is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices only and is
257
* used to mask a port B channel designated as a timer input capture (after
258
* acquisition completion to avoid triggering multiple detections).
259
*
260
* GPIO0-GPIO15 defines should be used as parameters.
261
*/
262
#define RI_CMR2_PB(x) (x)
263
/* bits 16-31 reserved */
264
265
/**
266
* Channel identification for capture register (RI_CICR2)
267
*
268
* The RI_CICR2 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
269
* only and is used when analog switches are controlled by a timer OC. RI_CICR2
270
* allows a channel to be identified for timer input capture.
271
*
272
* GPIO0-GPIO15 defines should be used as parameters.
273
*/
274
#define RI_CICR2_PB(x) (x)
275
/* bits 16-31 reserved */
276
277
/**
278
* Analog switch mode register (RI_ASMR3)
279
*
280
* The RI_ASMR3 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
281
* only and is used to select if analog switches of port C are to be controlled
282
* by the timer OC or through the ADC interface or RI_ASCRx registers.
283
*
284
* GPIO0-GPIO15 defines should be used as parameters.
285
*/
286
#define RI_ASMR3_PC(x) (x)
287
/* bits 16-31 reserved */
288
289
/**
290
* Channel mask register (RI_CMR3)
291
*
292
* RI_CMR3 is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices only and is
293
* used to mask a port C channel designated as a timer input capture (after
294
* acquisition completion to avoid triggering multiple detections).
295
*
296
* GPIO0-GPIO15 defines should be used as parameters.
297
*/
298
#define RI_CMR3_PC(x) (x)
299
/* bits 16-31 reserved */
300
301
/**
302
* Channel identification for capture register (RI_CICR3)
303
*
304
* The RI_CICR3 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
305
* only and is used when analog switches are controlled by a timer OC. RI_CICR3
306
* allows a channel to be identified for timer input capture.
307
*
308
* GPIO0-GPIO15 defines should be used as parameters.
309
*/
310
#define RI_CICR3_PC(x) (x)
311
/* bits 16-31 reserved */
312
313
/**
314
* Analog switch mode register (RI_ASMR4)
315
*
316
* The RI_ASMR4 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
317
* only and is used to select if analog switches of port F are to be controlled
318
* by the timer OC or through the ADC interface or RI_ASCRx registers.
319
*
320
* GPIO0-GPIO15 defines should be used as parameters.
321
*/
322
#define RI_ASMR4_PF(x) (x)
323
/* bits 16-31 reserved */
324
325
/**
326
* Channel mask register (RI_CMRF)
327
*
328
* RI_CMR4 is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices only and is
329
* used to mask a port F channel designated as a timer input capture (after
330
* acquisition completion to avoid triggering multiple detections).
331
*
332
* GPIO0-GPIO15 defines should be used as parameters.
333
*/
334
#define RI_CMR4_PF(x) (x)
335
/* bits 16-31 reserved */
336
337
/**
338
* Channel identification for capture register (RI_CICR4)
339
*
340
* The RI_CICR4 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
341
* only and is used when analog switches are controlled by a timer OC. RI_CICR4
342
* allows a channel to be identified for timer input capture.
343
*
344
* GPIO0-GPIO15 defines should be used as parameters.
345
*/
346
#define RI_CICR4_PF(x) (x)
347
/* bits 16-31 reserved */
348
349
/**
350
* Analog switch mode register (RI_ASMR5)
351
*
352
* The RI_ASMR5 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
353
* only and is used to select if analog switches of port G are to be controlled
354
* by the timer OC or through the ADC interface or RI_ASCRx registers.
355
*
356
* GPIO0-GPIO15 defines should be used as parameters.
357
*/
358
#define RI_ASMR5_PG(x) (x)
359
/* bits 16-31 reserved */
360
361
/**
362
* Channel mask register (RI_CMR5)
363
*
364
* RI_CMR1 is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices only and is
365
* used to mask a port G channel designated as a timer input capture (after
366
* acquisition completion to avoid triggering multiple detections).
367
*
368
* GPIO0-GPIO15 defines should be used as parameters.
369
*/
370
#define RI_CMR5_PG(x) (x)
371
/* bits 16-31 reserved */
372
373
/**
374
* Channel identification for capture register (RI_CICR5)
375
*
376
* The RI_CICR5 register is available in Cat.3, Cat.4, Cat.5 and Cat.6 devices
377
* only and is used when analog switches are controlled by a timer OC. RI_CICR5
378
* allows a channel to be identified for timer input capture.
379
*
380
* GPIO0-GPIO15 defines should be used as parameters.
381
*/
382
#define RI_CICR5_PG(x) (x)
383
/* bits 16-31 reserved */
384
385
/**@}*/
386
include
libopencm3
stm32
l1
ri.h
Generated on Tue Mar 7 2023 16:12:05 for libopencm3 by
1.9.4