xref: /rk3399_ARM-atf/lib/libc/putchar.c (revision 09d40e0e08283a249e7dce0e106c07c5141f9b7e)
161f72a34SRoberto Vargas /*
24661abc7SAntonio Nino Diaz  * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
361f72a34SRoberto Vargas  *
461f72a34SRoberto Vargas  * SPDX-License-Identifier: BSD-3-Clause
561f72a34SRoberto Vargas  */
661f72a34SRoberto Vargas 
761f72a34SRoberto Vargas #include <stdio.h>
8*09d40e0eSAntonio Nino Diaz 
9*09d40e0eSAntonio Nino Diaz #include <drivers/console.h>
1061f72a34SRoberto Vargas 
1161f72a34SRoberto Vargas int putchar(int c)
1261f72a34SRoberto Vargas {
1361f72a34SRoberto Vargas 	int res;
1461f72a34SRoberto Vargas 	if (console_putc((unsigned char)c) >= 0)
1561f72a34SRoberto Vargas 		res = c;
1661f72a34SRoberto Vargas 	else
1761f72a34SRoberto Vargas 		res = EOF;
1861f72a34SRoberto Vargas 
1961f72a34SRoberto Vargas 	return res;
2061f72a34SRoberto Vargas }
21