summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/debug/efm32.S
blob: 5ed5028306f4a605bff81df0782e5a8346773e45 (plain)
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
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2013 Pengutronix
 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
 */

#define UARTn_CMD		0x000c
#define UARTn_CMD_TXEN			0x0004

#define	UARTn_STATUS		0x0010
#define	UARTn_STATUS_TXC		0x0020
#define	UARTn_STATUS_TXBL		0x0040

#define	UARTn_TXDATA		0x0034

		.macro	addruart, rx, tmp, tmp2
		ldr	\rx, =(CONFIG_DEBUG_UART_PHYS)

		/*
		 * enable TX. The driver might disable it to save energy. We
		 * don't care about disabling at the end as during debug power
		 * consumption isn't that important.
		 */
		ldr	\tmp, =(UARTn_CMD_TXEN)
		str	\tmp, [\rx, #UARTn_CMD]
		.endm

		.macro	senduart,rd,rx
		strb	\rd, [\rx, #UARTn_TXDATA]
		.endm

		.macro	waituart,rd,rx
1001:		ldr	\rd, [\rx, #UARTn_STATUS]
		tst	\rd, #UARTn_STATUS_TXBL
		beq	1001b
		.endm

		.macro	busyuart,rd,rx
1001:		ldr	\rd, [\rx, UARTn_STATUS]
		tst	\rd, #UARTn_STATUS_TXC
		bne	1001b
		.endm