added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / arm-all / exec / rawputchar.c
blobe5c78c64111402c4844162d896c601ca2c758d57
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Emit one character via raw IO
6 Lang: english
7 */
9 #include <aros/config.h>
10 #include <asm/registers.h>
12 /*****i***********************************************************************
14 NAME */
15 #include <proto/exec.h>
17 AROS_LH1(void, RawPutChar,
19 /* SYNOPSIS */
20 AROS_LHA(UBYTE, chr, D0),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 86, Exec)
25 /* FUNCTION
26 Emits a single character.
28 INPUTS
29 chr - The character to emit
31 RESULT
32 None.
34 NOTES
35 This function is for very low level debugging only.
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 RawIOInit(), RawPutChar(), RawMayGetChar()
44 INTERNALS
46 HISTORY
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
51 #define DO_SERIAL_DEBUG
52 #ifdef DO_SERIAL_DEBUG
53 ULONG j = 0;
54 volatile ULONG utsr1;
55 // Disable();
56 do {
57 utsr1 = RREG_L(UTSR1);
58 j++;
59 } while ((0 == (utsr1 & 0x04)) && (j < 1000000));
60 if (chr) {
61 WREG_L(UTDR) = (ULONG)chr;
62 if ('\n' == chr) {
63 WREG_L(UTDR) = (ULONG)'\r';
65 } else {
66 WREG_L(UTDR) = '\r';
67 WREG_L(UTDR) = '\n';
69 // Enable();
70 #endif
72 AROS_LIBFUNC_EXIT
73 } /* RawPutChar */