MFi386: revision 1.38.

This commit is contained in:
Yoshihiro Takahashi 2004-11-29 11:54:42 +00:00
parent e354922c78
commit 028d40a592

View File

@ -1081,8 +1081,9 @@ putstr: lodsb # Load char
.set SIO_FMT,SIOFMT # 8N1
.set SIO_DIV,(115200/SIOSPD) # 115200 / SPD
/*
* void sio_init(void)
*/
sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
movb $SIO_FMT|0x80,%al # Set format
outb %al,(%dx) # and DLAB
@ -1098,15 +1099,17 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
outb %al,(%dx) # DTR
incl %edx # Line status reg
/*
* void 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
/*
* void sio_putc(int c)
*/
sio_putc: movw $SIO_PRT+0x5,%dx # Line status reg
xor %ecx,%ecx # Timeout
movb $0x40,%ch # counter
@ -1119,16 +1122,18 @@ sio_putc.1: inb (%dx),%al # Transmitter
outb %al,(%dx) # Write character
sio_putc.2: ret $0x4 # To caller
/*
* int sio_getc(void)
*/
sio_getc: call sio_ischar # Character available?
jz sio_getc # No
sio_getc.1: subb $0x5,%dl # Receiver buffer reg
inb (%dx),%al # Read character
ret # To caller
/*
* int sio_ischar(void)
*/
sio_ischar: movw $SIO_PRT+0x5,%dx # Line status register
xorl %eax,%eax # Zero
inb (%dx),%al # Received data