196b225fc45d6b8ee738aaeec755ea6714aea408
[AROS.git] / arch / ppc-sam440 / kernel / maygetchar.c
blob196b225fc45d6b8ee738aaeec755ea6714aea408
1 #include <aros/kernel.h>
3 #include <kernel_base.h>
4 #include <kernel_debug.h>
6 #include <asm/amcc440.h>
7 #include <asm/io.h>
9 /*****************************************************************************
11 NAME */
12 #include <proto/kernel.h>
14 AROS_LH0(int, KrnMayGetChar,
16 /* SYNOPSIS */
18 /* LOCATION */
19 struct KernelBase *, KernelBase, 26, Kernel)
21 /* FUNCTION
22 Read a single character from low-level debug input stream
24 INPUTS
25 None
27 RESULT
28 An ASCII code of the character or -1 if there's no character
29 available
31 NOTES
32 This function never waits. If there is no character available on
33 the stream it just returns with -1
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 ******************************************************************************/
45 AROS_LIBFUNC_INIT
47 if (inb(UART0_LSR) & UART_LSR_DR)
48 return inb(UART0_RBR);
50 return -1;
52 AROS_LIBFUNC_EXIT