serial console ; speed settings ; error detection
Posted: Wed Dec 28, 2022 7:11 am
I've decided to have serial console output of my "kernel" so I can capture easily output when I'm testing stuff on actual HW. I'm starting simple - both bootloader and my kernel are just sending bytes by polling if byte can be sent via com0 serial port. My kernel init function: early_uart_init().
It does work however I wonder:
How can I detect if setting given speed is OK for remote side? Will reading LSR just after setting speed give me any information about that? Actually even int $0x14 AH=00h returns line status after attempted initialization. Can I assume 0xff as error during initialization ?
In my poll_uart_write() I set the arbitrary number to wait before I give up on sending a byte out. Some tutorials used infinite loop when waiting for it but I don't think it's a good idea. Is there a good common practice how long to wait? Can there be actually a situation when the buffer is always full ?
It does work however I wonder:
How can I detect if setting given speed is OK for remote side? Will reading LSR just after setting speed give me any information about that? Actually even int $0x14 AH=00h returns line status after attempted initialization. Can I assume 0xff as error during initialization ?
In my poll_uart_write() I set the arbitrary number to wait before I give up on sending a byte out. Some tutorials used infinite loop when waiting for it but I don't think it's a good idea. Is there a good common practice how long to wait? Can there be actually a situation when the buffer is always full ?