driver/serial: disable interrupt when writing to serial

This commit is contained in:
Edgaru089 2021-11-05 15:11:58 +08:00
parent ab6737f904
commit d3c91c0048

View File

@ -39,6 +39,7 @@ bool pic_serial_Init(pic_serial_Port *port, int baudrate, int lineFlags) {
void pic_serial_Write(pic_serial_Port *port, const char *str, int n) { void pic_serial_Write(pic_serial_Port *port, const char *str, int n) {
if (port && port->ok) { if (port && port->ok) {
INTERRUPT_DISABLE;
if (n != 0) { if (n != 0) {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
while ((inb(port->port + 5) & 0x20) == 0) {} while ((inb(port->port + 5) & 0x20) == 0) {}
@ -51,5 +52,6 @@ void pic_serial_Write(pic_serial_Port *port, const char *str, int n) {
str++; str++;
} }
} }
INTERRUPT_RESTORE;
} }
} }