Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
  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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# nrfx UART configuration

# Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

menuconfig UART_NRFX
	bool "nRF UART nrfx drivers"
	default y
	select SERIAL_HAS_DRIVER
	select SERIAL_SUPPORT_INTERRUPT
	select SERIAL_SUPPORT_ASYNC
	depends on SOC_FAMILY_NRF
	help
	  Enable support for nrfx UART drivers for nRF MCU series.
	  Peripherals with the same instance ID cannot be used together,
	  e.g. UART_0 and UARTE_0.

if UART_NRFX

config UART_ASYNC_TX_CACHE_SIZE
	int "TX cache buffer size"
	depends on UART_ASYNC_API
	depends on NRF_UARTE_PERIPHERAL
	default 8
	help
	  For UARTE, TX cache buffer is used when provided TX buffer is not located
	  in RAM, because EasyDMA in UARTE peripherals can only transfer data
	  from RAM.

# Workaround for not being able to have commas in macro arguments
DT_COMPAT_NORDIC_NRF_UART  := nordic,nrf-uart
DT_COMPAT_NORDIC_NRF_UARTE := nordic,nrf-uarte

# ----------------- port 0 -----------------
config UART_0_NRF_UART
	def_bool $(dt_nodelabel_has_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UART))
	select NRF_UART_PERIPHERAL
	help
	  Enable nRF UART without EasyDMA on port 0.

config UART_0_NRF_UARTE
	def_bool $(dt_nodelabel_has_compat,uart0,$(DT_COMPAT_NORDIC_NRF_UARTE))
	select NRF_UARTE_PERIPHERAL
	help
	  Enable nRF UART with EasyDMA on port 0.

if UART_0_NRF_UART || UART_0_NRF_UARTE

config UART_0_ENHANCED_POLL_OUT
	bool "Efficient poll out on port 0"
	default y
	depends on UART_0_NRF_UARTE
	help
	  When enabled, polling out does not trigger interrupt which stops TX.
	  Feature uses a PPI channel.

config UART_0_INTERRUPT_DRIVEN
	bool "Enable interrupt support on port 0"
	depends on UART_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART interrupt support on port 0.

config UART_0_ASYNC
	bool "Enable Asynchronous API support on port 0"
	depends on UART_ASYNC_API && !UART_0_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART Asynchronous API support on port 0.

config UART_0_NRF_PARITY_BIT
	bool "Enable parity bit"
	help
	  Enable parity bit.

config UART_0_NRF_TX_BUFFER_SIZE
	int "Size of RAM buffer"
	depends on UART_0_NRF_UARTE
	range 1 65535
	default 32
	help
	  Size of the transmit buffer for API function: fifo_fill.
	  This value is limited by range of TXD.MAXCNT register for
	  particular SoC.

config UART_0_NRF_HW_ASYNC
	bool "Use hardware RX byte counting"
	depends on UART_0_NRF_UARTE
	depends on UART_ASYNC_API
	help
	  If default driver uses interrupts to count incoming bytes, it is possible
	  that with higher speeds and/or high cpu load some data can be lost.
	  It is recommended to use hardware byte counting in such scenarios.
	  Hardware RX byte counting requires timer instance and one PPI channel

config UART_0_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	depends on UART_0_NRF_UARTE
	depends on UART_ASYNC_API
	help
	  When enabled, UARTE is enabled before each TX or RX usage and disabled
	  when not used. Disabling UARTE while in idle allows to achieve lowest
	  power consumption. It is only feasible if receiver is not always on.

config UART_0_NRF_HW_ASYNC_TIMER
	int "Timer instance"
	depends on UART_0_NRF_HW_ASYNC

config UART_0_GPIO_MANAGEMENT
	bool "Enable GPIO management on port 0"
	depends on PM_DEVICE
	default y
	help
	  If enabled, the driver will configure the GPIOs used by the uart to
	  their default configuration when device is powered down. The GPIOs
	  will be configured back to correct state when UART is powered up.

endif # UART_0_NRF_UART || UART_0_NRF_UARTE

# ----------------- port 1 -----------------
config UART_1_NRF_UARTE
	def_bool $(dt_nodelabel_has_compat,uart1,$(DT_COMPAT_NORDIC_NRF_UARTE))
	select NRF_UARTE_PERIPHERAL
	help
	  Enable nRF UART with EasyDMA on port 1.

if UART_1_NRF_UARTE

config UART_1_INTERRUPT_DRIVEN
	bool "Enable interrupt support on port 1"
	depends on UART_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART interrupt support on port 1.

config UART_1_ASYNC
	bool "Enable Asynchronous API support on port 1"
	depends on UART_ASYNC_API && !UART_1_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART Asynchronous API support on port 1.

config UART_1_ENHANCED_POLL_OUT
	bool "Efficient poll out on port 1"
	default y
	help
	  When enabled, polling out does not trigger interrupt which stops TX.
	  Feature uses a PPI channel.

config UART_1_NRF_PARITY_BIT
	bool "Enable parity bit"
	help
	  Enable parity bit.

config UART_1_NRF_TX_BUFFER_SIZE
	int "Size of RAM buffer"
	depends on UART_INTERRUPT_DRIVEN
	range 1 65535
	default 32
	help
	  Size of the transmit buffer for API function: fifo_fill.
	  This value is limited by range of TXD.MAXCNT register for
	  particular SoC.

config UART_1_NRF_HW_ASYNC
	bool "Use hardware RX byte counting"
	depends on UART_1_ASYNC
	help
	  If default driver uses interrupts to count incoming bytes, it is possible
	  that with higher speeds and/or high cpu load some data can be lost.
	  It is recommended to use hardware byte counting in such scenarios.
	  Hardware RX byte counting requires timer instance and one PPI channel

config UART_1_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	depends on UART_ASYNC_API
	help
	  When enabled, UARTE is enabled before each TX or RX usage and disabled
	  when not used. Disabling UARTE while in idle allows to achieve lowest
	  power consumption. It is only feasible if receiver is not always on.

config UART_1_NRF_HW_ASYNC_TIMER
	int "Timer instance"
	depends on UART_1_NRF_HW_ASYNC

config UART_1_GPIO_MANAGEMENT
	bool "Enable GPIO management on port 1"
	depends on PM_DEVICE
	default y
	help
	  If enabled, the driver will configure the GPIOs used by the uart to
	  their default configuration when device is powered down. The GPIOs
	  will be configured back to correct state when UART is powered up.

endif # UART_1_NRF_UARTE

# ----------------- port 2 -----------------
config UART_2_NRF_UARTE
	def_bool $(dt_nodelabel_has_compat,uart2,$(DT_COMPAT_NORDIC_NRF_UARTE))
	select NRF_UARTE_PERIPHERAL
	help
	  Enable nRF UART with EasyDMA on port 2.

if UART_2_NRF_UARTE

config UART_2_INTERRUPT_DRIVEN
	bool "Enable interrupt support on port 2"
	depends on UART_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART interrupt support on port 2.

config UART_2_ASYNC
	bool "Enable Asynchronous API support on port 2"
	depends on UART_ASYNC_API && !UART_2_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART Asynchronous API support on port 2.

config UART_2_ENHANCED_POLL_OUT
	bool "Efficient poll out on port 2"
	default y
	help
	  When enabled, polling out does not trigger interrupt which stops TX.
	  Feature uses a PPI channel.

config UART_2_NRF_PARITY_BIT
	bool "Enable parity bit"
	help
	  Enable parity bit.

config UART_2_NRF_TX_BUFFER_SIZE
	int "Size of RAM buffer"
	range 1 65535
	default 32
	help
	  Size of the transmit buffer for API function: fifo_fill.
	  This value is limited by range of TXD.MAXCNT register for
	  particular SoC.

config UART_2_NRF_HW_ASYNC
	bool "Use hardware RX byte counting"
	depends on UART_2_ASYNC
	help
	  If default driver uses interrupts to count incoming bytes, it is possible
	  that with higher speeds and/or high cpu load some data can be lost.
	  It is recommended to use hardware byte counting in such scenarios.
	  Hardware RX byte counting requires timer instance and one PPI channel

config UART_2_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	depends on UART_ASYNC_API
	help
	  When enabled, UARTE is enabled before each TX or RX usage and disabled
	  when not used. Disabling UARTE while in idle allows to achieve lowest
	  power consumption. It is only feasible if receiver is not always on.

config UART_2_NRF_HW_ASYNC_TIMER
	int "Timer instance"
	depends on UART_2_NRF_HW_ASYNC

config UART_2_GPIO_MANAGEMENT
	bool "Enable GPIO management on port 2"
	depends on PM_DEVICE
	default y
	help
	  If enabled, the driver will configure the GPIOs used by the uart to
	  their default configuration when device is powered down. The GPIOs
	  will be configured back to correct state when UART is powered up.

endif # UART_2_NRF_UARTE

# ----------------- port 3 -----------------
config UART_3_NRF_UARTE
	def_bool $(dt_nodelabel_has_compat,uart3,$(DT_COMPAT_NORDIC_NRF_UARTE))
	select NRF_UARTE_PERIPHERAL
	help
	  Enable nRF UART with EasyDMA on port 3.

if UART_3_NRF_UARTE

config UART_3_INTERRUPT_DRIVEN
	bool "Enable interrupt support on port 3"
	depends on UART_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART interrupt support on port 3.

config UART_3_ASYNC
	bool "Enable Asynchronous API support on port 3"
	depends on UART_ASYNC_API && !UART_3_INTERRUPT_DRIVEN
	default y
	help
	  This option enables UART Asynchronous API support on port 3.

config UART_3_ENHANCED_POLL_OUT
	bool "Efficient poll out on port 3"
	default y
	help
	  When enabled, polling out does not trigger interrupt which stops TX.
	  Feature uses a PPI channel.

config UART_3_NRF_PARITY_BIT
	bool "Enable parity bit"
	help
	  Enable parity bit.

config UART_3_NRF_TX_BUFFER_SIZE
	int "Size of RAM buffer"
	range 1 65535
	default 32
	help
	  Size of the transmit buffer for API function: fifo_fill.
	  This value is limited by range of TXD.MAXCNT register for
	  particular SoC.

config UART_3_NRF_HW_ASYNC
	bool "Use hardware RX byte counting"
	depends on UART_3_ASYNC
	help
	  If default driver uses interrupts to count incoming bytes, it is possible
	  that with higher speeds and/or high cpu load some data can be lost.
	  It is recommended to use hardware byte counting in such scenarios.
	  Hardware RX byte counting requires timer instance and one PPI channel

config UART_3_NRF_ASYNC_LOW_POWER
	bool "Low power mode"
	depends on UART_ASYNC_API
	help
	  When enabled, UARTE is enabled before each TX or RX usage and disabled
	  when not used. Disabling UARTE while in idle allows to achieve lowest
	  power consumption. It is only feasible if receiver is not always on.

config UART_3_NRF_HW_ASYNC_TIMER
	int "Timer instance"
	depends on UART_3_NRF_HW_ASYNC

config UART_3_GPIO_MANAGEMENT
	bool "Enable GPIO management on port 3"
	depends on PM_DEVICE
	default y
	help
	  If enabled, the driver will configure the GPIOs used by the uart to
	  their default configuration when device is powered down. The GPIOs
	  will be configured back to correct state when UART is powered up.

endif # UART_3_NRF_UARTE


config NRFX_TIMER0
	default y
	depends on UART_0_NRF_HW_ASYNC_TIMER = 0 || UART_1_NRF_HW_ASYNC_TIMER = 0 || \
		   UART_3_NRF_HW_ASYNC_TIMER = 0 || UART_2_NRF_HW_ASYNC_TIMER = 0

config NRFX_TIMER1
	default y
	depends on UART_0_NRF_HW_ASYNC_TIMER = 1 || UART_1_NRF_HW_ASYNC_TIMER = 1 || \
		   UART_3_NRF_HW_ASYNC_TIMER = 1 || UART_2_NRF_HW_ASYNC_TIMER = 1

config NRFX_TIMER2
	default y
	depends on UART_0_NRF_HW_ASYNC_TIMER = 2 || UART_1_NRF_HW_ASYNC_TIMER = 2 || \
		   UART_3_NRF_HW_ASYNC_TIMER = 2 || UART_2_NRF_HW_ASYNC_TIMER = 2

config NRFX_TIMER3
	default y
	depends on UART_0_NRF_HW_ASYNC_TIMER = 3 || UART_1_NRF_HW_ASYNC_TIMER = 3 || \
		   UART_3_NRF_HW_ASYNC_TIMER = 3 || UART_2_NRF_HW_ASYNC_TIMER = 3

config NRFX_TIMER4
	default y
	depends on UART_0_NRF_HW_ASYNC_TIMER = 4 || UART_1_NRF_HW_ASYNC_TIMER = 4 || \
		   UART_3_NRF_HW_ASYNC_TIMER = 4 || UART_2_NRF_HW_ASYNC_TIMER = 4


if UART_0_NRF_HW_ASYNC || UART_1_NRF_HW_ASYNC || UART_2_NRF_HW_ASYNC || UART_3_NRF_HW_ASYNC

config NRFX_TIMER
	default y

config NRFX_PPI
	depends on HAS_HW_NRF_PPI
	default y

config NRFX_DPPI
	depends on HAS_HW_NRF_DPPIC
	default y

config UARTE_NRF_HW_ASYNC
	bool
	default y

endif

if UART_0_ENHANCED_POLL_OUT || UART_1_ENHANCED_POLL_OUT || \
	UART_2_ENHANCED_POLL_OUT || UART_3_ENHANCED_POLL_OUT

config UART_ENHANCED_POLL_OUT
	bool
	default y
	select NRFX_PPI if HAS_HW_NRF_PPI
	select NRFX_DPPI if HAS_HW_NRF_DPPIC

endif

config NRF_UART_PERIPHERAL
	bool

config NRF_UARTE_PERIPHERAL
	bool

endif # UART_NRFX