Ying-Chun Liu (PaulLiu) | 26ca4f5 | 2019-02-12 18:33:04 +0800 | [diff] [blame] | 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> |
Ying-Chun Liu (PaulLiu) | 26ca4f5 | 2019-02-12 18:33:04 +0800 | [diff] [blame] | 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 | |
| 18 | func 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_DRVDATA] |
| 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=1, flush=1 |
| 32 | |
| 33 | register_fail: |
| 34 | pop {r4, pc} |
| 35 | endfunc console_imx_uart_register |
| 36 | |
| 37 | func console_imx_uart_putc |
| 38 | ldr r1, [r1, #CONSOLE_T_DRVDATA] |
| 39 | b console_imx_uart_core_putc |
| 40 | endfunc console_imx_uart_putc |
| 41 | |
| 42 | func console_imx_uart_getc |
| 43 | ldr r0, [r0, #CONSOLE_T_DRVDATA] |
| 44 | b console_imx_uart_core_getc |
| 45 | endfunc console_imx_uart_getc |
| 46 | |
| 47 | func console_imx_uart_flush |
| 48 | ldr r0, [r0, #CONSOLE_T_DRVDATA] |
| 49 | b console_imx_uart_core_flush |
| 50 | endfunc console_imx_uart_flush |