1/*
2 * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <console_macros.S>
10#include <assert_macros.S>
11#include "imx_uart.h"
12
13	.globl	console_imx_uart_register
14	.globl	console_imx_uart_putc
15	.globl	console_imx_uart_getc
16	.globl	console_imx_uart_flush
17
18func console_imx_uart_register
19	push	{r4, lr}
20	mov	r4, r3
21	cmp	r4, #0
22	beq	register_fail
23	str	r0, [r4, #CONSOLE_T_BASE]
24
25	bl	console_imx_uart_core_init
26	cmp	r0, #0
27	bne	register_fail
28
29	mov	r0, r4
30	pop	{r4, lr}
31	finish_console_register imx_uart putc=1, getc=ENABLE_CONSOLE_GETC, flush=1
32
33register_fail:
34	pop	{r4, pc}
35endfunc console_imx_uart_register
36
37func console_imx_uart_putc
38	ldr	r1, [r1, #CONSOLE_T_BASE]
39	b console_imx_uart_core_putc
40endfunc console_imx_uart_putc
41
42func console_imx_uart_getc
43	ldr	r0, [r0, #CONSOLE_T_BASE]
44	b console_imx_uart_core_getc
45endfunc console_imx_uart_getc
46
47func console_imx_uart_flush
48	ldr	r0, [r0, #CONSOLE_T_BASE]
49	b console_imx_uart_core_flush
50endfunc console_imx_uart_flush
51