2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/kernel.h>
8 #include <kernel_base.h>
9 #include <kernel_debug.h>
11 /** Screen/Serial Debug **/
13 #define SERDATR_OVRUN (1 << 15) /* Overrun */
14 #define SERDATR_RBF (1 << 14) /* Rx Buffer Full */
15 #define SERDATR_TBE (1 << 13) /* Tx Buffer Empty */
16 #define SERDATR_TSRE (1 << 12) /* Tx Shift Empty */
17 #define SERDATR_RXD (1 << 11) /* Rx Pin */
18 #define SERDATR_STP9 (1 << 9) /* Stop bit (if 9 data) */
19 #define SERDATR_STP8 (1 << 8) /* Stop bit (if 8 data) */
20 #define SERDATR_DB9_of(x) ((x) & 0x1ff) /* 9-bit data */
21 #define SERDATR_DB8_of(x) ((x) & 0xff) /* 8-bit data */
23 #define SERDAT_STP9 (1 << 9)
24 #define SERDAT_STP8 (1 << 8)
25 #define SERDAT_DB9(x) ((x) & 0x1ff)
26 #define SERDAT_DB8(x) ((x) & 0xff)
28 static inline void reg_w(ULONG reg
, UWORD val
)
30 volatile UWORD
*r
= (void *)(0xdff000 + reg
);
35 static inline UWORD
reg_r(ULONG reg
)
37 volatile UWORD
*r
= (void *)(0xdff000 + reg
);
43 * KernelBase is an optional parameter here. During
44 * very early startup it can be NULL.
46 int krnPutC(int chr
, struct KernelBase
*KernelBase
)
49 krnPutC('\r', KernelBase
);
51 while ((reg_r(SERDATR
) & SERDATR_TBE
) == 0);
53 /* Output a char to the debug UART */
54 reg_w(SERDAT
, SERDAT_STP8
| SERDAT_DB8(chr
));