MFi386: r241301
add detection of serial console presence to btx and boot2-like blocks
This commit is contained in:
parent
7631b580ff
commit
f34d85e0ec
@ -554,8 +554,10 @@ parse()
|
||||
}
|
||||
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
|
||||
OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
|
||||
if (ioctrl & IO_SERIAL)
|
||||
sio_init(115200 / comspeed);
|
||||
if (ioctrl & IO_SERIAL) {
|
||||
if (sio_init(115200 / comspeed) != 0)
|
||||
ioctrl &= ~IO_SERIAL;
|
||||
}
|
||||
} else {
|
||||
for (q = arg--; *q && *q != '('; q++);
|
||||
if (*q) {
|
||||
|
@ -840,7 +840,7 @@ putstr: lodsb # Load char
|
||||
.set SIO_DIV,(115200/SIOSPD) # 115200 / SPD
|
||||
|
||||
/*
|
||||
* void sio_init(void)
|
||||
* int sio_init(void)
|
||||
*/
|
||||
sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
|
||||
movb $SIO_FMT|0x80,%al # Set format
|
||||
@ -856,14 +856,19 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
|
||||
movb $0x3,%al # Set RTS,
|
||||
outb %al,(%dx) # DTR
|
||||
incl %edx # Line status reg
|
||||
call sio_getc.1 # Get character
|
||||
|
||||
/*
|
||||
* void sio_flush(void)
|
||||
* int sio_flush(void)
|
||||
*/
|
||||
sio_flush.0: call sio_getc.1 # Get character
|
||||
sio_flush: call sio_ischar # Check for character
|
||||
jnz sio_flush.0 # Till none
|
||||
ret # To caller
|
||||
sio_flush: xorl %eax,%eax # Return value
|
||||
xorl %ecx,%ecx # Timeout
|
||||
movb $0x80,%ch # counter
|
||||
sio_flush.1: call sio_ischar # Check for character
|
||||
jz sio_flush.2 # Till none
|
||||
loop sio_flush.1 # or counter is zero
|
||||
movb $1, %al # Exhausted all tries
|
||||
sio_flush.2: ret # To caller
|
||||
|
||||
/*
|
||||
* void sio_putc(int c)
|
||||
|
Loading…
Reference in New Issue
Block a user