1*4353bb20SYann Gautier/* 2*4353bb20SYann Gautier * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. 3*4353bb20SYann Gautier * 4*4353bb20SYann Gautier * SPDX-License-Identifier: BSD-3-Clause 5*4353bb20SYann Gautier */ 6*4353bb20SYann Gautier#include <asm_macros.S> 7*4353bb20SYann Gautier 8*4353bb20SYann Gautier .globl console_core_init 9*4353bb20SYann Gautier .globl console_core_putc 10*4353bb20SYann Gautier .globl console_core_getc 11*4353bb20SYann Gautier .globl console_core_flush 12*4353bb20SYann Gautier 13*4353bb20SYann Gautier /* ----------------------------------------------------------------- 14*4353bb20SYann Gautier * int console_core_init(uintptr_t base_addr, 15*4353bb20SYann Gautier * unsigned int uart_clk, 16*4353bb20SYann Gautier * unsigned int baud_rate) 17*4353bb20SYann Gautier * 18*4353bb20SYann Gautier * Function to initialize the console without a C Runtime to print 19*4353bb20SYann Gautier * debug information. This function will be accessed by console_init 20*4353bb20SYann Gautier * and crash reporting. 21*4353bb20SYann Gautier * 22*4353bb20SYann Gautier * In: r0 - console base address 23*4353bb20SYann Gautier * r1 - Uart clock in Hz 24*4353bb20SYann Gautier * r2 - Baud rate 25*4353bb20SYann Gautier * Out: return 1 on success else 0 on error 26*4353bb20SYann Gautier * Clobber list : r1, r2, r3 27*4353bb20SYann Gautier * ----------------------------------------------------------------- 28*4353bb20SYann Gautier */ 29*4353bb20SYann Gautierfunc console_core_init 30*4353bb20SYann Gautier bx lr 31*4353bb20SYann Gautierendfunc console_core_init 32*4353bb20SYann Gautier 33*4353bb20SYann Gautier /* --------------------------------------------------------------- 34*4353bb20SYann Gautier * int console_core_putc(int c, uintptr_t base_addr) 35*4353bb20SYann Gautier * 36*4353bb20SYann Gautier * Function to output a character over the console. It returns the 37*4353bb20SYann Gautier * character printed on success or -1 on error. 38*4353bb20SYann Gautier * 39*4353bb20SYann Gautier * In : r0 - character to be printed 40*4353bb20SYann Gautier * r1 - console base address 41*4353bb20SYann Gautier * Out : return -1 on error else return character. 42*4353bb20SYann Gautier * Clobber list : r2 43*4353bb20SYann Gautier * --------------------------------------------------------------- 44*4353bb20SYann Gautier */ 45*4353bb20SYann Gautierfunc console_core_putc 46*4353bb20SYann Gautier bx lr 47*4353bb20SYann Gautierendfunc console_core_putc 48*4353bb20SYann Gautier 49*4353bb20SYann Gautier /* ----------------------------------------------------------- 50*4353bb20SYann Gautier * int console_core_getc(uintptr_t base_addr) 51*4353bb20SYann Gautier * 52*4353bb20SYann Gautier * Function to get a character from the console. 53*4353bb20SYann Gautier * It returns the character grabbed on success or -1 on error. 54*4353bb20SYann Gautier * 55*4353bb20SYann Gautier * In : r0 - console base address 56*4353bb20SYann Gautier * Out : return -1. 57*4353bb20SYann Gautier * Clobber list : r0, r1 58*4353bb20SYann Gautier * ----------------------------------------------------------- 59*4353bb20SYann Gautier */ 60*4353bb20SYann Gautierfunc console_core_getc 61*4353bb20SYann Gautier /* Not supported */ 62*4353bb20SYann Gautier mov r0, #-1 63*4353bb20SYann Gautier bx lr 64*4353bb20SYann Gautierendfunc console_core_getc 65*4353bb20SYann Gautier 66*4353bb20SYann Gautier /* --------------------------------------------------------------- 67*4353bb20SYann Gautier * int console_core_flush(uintptr_t base_addr) 68*4353bb20SYann Gautier * 69*4353bb20SYann Gautier * Function to force a write of all buffered data that hasn't been 70*4353bb20SYann Gautier * output. 71*4353bb20SYann Gautier * 72*4353bb20SYann Gautier * In : r0 - console base address 73*4353bb20SYann Gautier * Out : return -1 on error else return 0. 74*4353bb20SYann Gautier * Clobber list : r0, r1 75*4353bb20SYann Gautier * --------------------------------------------------------------- 76*4353bb20SYann Gautier */ 77*4353bb20SYann Gautierfunc console_core_flush 78*4353bb20SYann Gautier bx lr 79*4353bb20SYann Gautierendfunc console_core_flush 80