Moved arch_dbg_con_init() to the end of the file.

Added the new arch_dbg_con_early_boot_message() function.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9518 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-26 23:30:51 +00:00
parent cc67a158ee
commit c32cb87156

View File

@ -1,7 +1,11 @@
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
/*
** Modified 2001/09/05 by Rob Judd<judd@ob-wan.com>
** Modified 2002/09/28 by Marcus Overhagen <marcus@overhagen.de>
@ -28,27 +32,6 @@
static const int dbg_baud_rate = 115200;
int
arch_dbg_con_init(kernel_args *ka)
{
short divisor = 115200 / dbg_baud_rate;
#if USE_COM1
out8(0x80, 0x3fb); /* set up to load divisor latch */
out8(divisor & 0xf, 0x3f8); /* LSB */
out8(divisor >> 8, 0x3f9); /* MSB */
out8(3, 0x3fb); /* 8N1 */
#else // COM2
out8(0x80, 0x2fb); /* set up to load divisor latch */
out8(divisor & 0xf, 0x2f8); /* LSB */
out8(divisor >> 8, 0x2f9); /* MSB */
out8(3, 0x2fb); /* 8N1 */
#endif
return 0;
}
char
arch_dbg_con_read(void)
{
@ -150,3 +133,34 @@ arch_dbg_con_puts(const char *s)
}
}
void
arch_dbg_con_early_boot_message(const char *string)
{
// this function will only be called in fatal situations
// ToDo: also enable output via text console?!
arch_dbg_con_init(NULL);
arch_dbg_con_puts(string);
}
status_t
arch_dbg_con_init(kernel_args *args)
{
short divisor = 115200 / dbg_baud_rate;
#if USE_COM1
out8(0x80, 0x3fb); /* set up to load divisor latch */
out8(divisor & 0xf, 0x3f8); /* LSB */
out8(divisor >> 8, 0x3f9); /* MSB */
out8(3, 0x3fb); /* 8N1 */
#else // COM2
out8(0x80, 0x2fb); /* set up to load divisor latch */
out8(divisor & 0xf, 0x2f8); /* LSB */
out8(divisor >> 8, 0x2f9); /* MSB */
out8(3, 0x2fb); /* 8N1 */
#endif
return 0;
}