2 * Copyright (C) 2011, The AROS Development Team. All rights reserved.
3 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
5 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
8 #include <hardware/intbits.h>
10 #include "amiga_hwreg.h"
15 /* Set DTR, RTS, etc */
16 volatile UBYTE
*ciab_pra
= (APTR
)0xBFD000;
17 volatile UBYTE
*ciab_ddra
= (APTR
)0xBFD200;
18 *ciab_ddra
= 0xc0; /* Only DTR and RTS are driven as outputs */
19 *ciab_pra
= 0; /* Turn on DTR and RTS */
21 /* Set the debug UART to 115200 */
22 reg_w(SERPER
, SERPER_BAUD(SERPER_BASE_PAL
, 115200));
25 int DebugPutChar(register int chr
)
30 while ((reg_r(SERDATR
) & SERDATR_TBE
) == 0);
31 reg_w(INTREQ
, INTF_TBE
);
33 /* Output a char to the debug UART */
34 reg_w(SERDAT
, SERDAT_STP8
| SERDAT_DB8(chr
));
39 int DebugMayGetChar(void)
43 if ((reg_r(SERDATR
) & SERDATR_RBF
) == 0)
46 c
= SERDATR_DB8_of(reg_r(SERDATR
));
49 reg_w(INTREQ
, INTF_RBF
);
56 void DebugPutStr(register const char *buff
)
58 for (; *buff
!= 0; buff
++)
62 void DebugPutDec(const char *what
, ULONG val
)
73 for (i
= 1000000000; i
> 0; i
/= 10) {
83 DebugPutChar("0123456789"[num
]);
89 void DebugPutHex(const char *what
, ULONG val
)
94 for (i
= 0; i
< 8; i
++) {
95 DebugPutChar("0123456789abcdef"[(val
>> (28 - (i
* 4))) & 0xf]);
100 void DebugPutHexVal(ULONG val
)
103 for (i
= 0; i
< 8; i
++) {
104 DebugPutChar("0123456789abcdef"[(val
>> (28 - (i
* 4))) & 0xf]);