Communication via serial port
Posted: Thu May 10, 2018 8:47 am
Hello,
I have developed a small driver that can transmit information via the COM1 port between a small kernel and a host machine.
By telling Bochs to record what comes out of the serial port from the kernel, it works fine (so with bochs set to com1: enabled=1, mode=file, dev=serial.txt).
My goal now is to transmit information from my host machine to the kernel. I tried to write to the file without too much hope, I then tested with the use of a pipe but it just doesn't seem possible under Linux... someone to confirm? If so, is there another way? (I tested with this but strangely no error, nothing happens... com1: enabled=1, mode=pipe, dev=/tmp/myfifo).
I also checked the pic's configuration, the COM1 interrupt shouldn't be masked :
I checked my IDT, and I found the adress of the function that should be executed (at least, a default routine could be executed... but nothing happens...) :
Have a nice day
Edit : I tried with qemu : I managed to receive a message from my kernel in my pipe, but I'm still not able to send bytes to my kernel from the host by using this same pipe...
(here is the command I used to launch qemu : qemu-system-i386 -boot a -fda floppyA -serial pipe:/tmp/myfifo)
I have developed a small driver that can transmit information via the COM1 port between a small kernel and a host machine.
By telling Bochs to record what comes out of the serial port from the kernel, it works fine (so with bochs set to com1: enabled=1, mode=file, dev=serial.txt).
My goal now is to transmit information from my host machine to the kernel. I tried to write to the file without too much hope, I then tested with the use of a pipe but it just doesn't seem possible under Linux... someone to confirm? If so, is there another way? (I tested with this but strangely no error, nothing happens... com1: enabled=1, mode=pipe, dev=/tmp/myfifo).
I also checked the pic's configuration, the COM1 interrupt shouldn't be masked :
Code: Select all
mov al, 0xEC ; ; clock, keyboard and COM1
out 0x21, al
Code: Select all
IDT[0x20]=32-Bit Interrupt Gate target=0x0008:0x000016b0, DPL=0 // clock (IRQ0)
IDT[0x21]=32-Bit Interrupt Gate target=0x0008:0x000016d0, DPL=0 // keyboard (IRQ1)
IDT[0x22]=32-Bit Interrupt Gate target=0x0008:0x00001690, DPL=0 // default routine
IDT[0x23]=32-Bit Interrupt Gate target=0x0008:0x00001690, DPL=0
IDT[0x24]=32-Bit Interrupt Gate target=0x0008:0x000016f0, DPL=0 // COM1 port (IRQ4)
IDT[0x25]=32-Bit Interrupt Gate target=0x0008:0x00001690, DPL=0
Edit : I tried with qemu : I managed to receive a message from my kernel in my pipe, but I'm still not able to send bytes to my kernel from the host by using this same pipe...
(here is the command I used to launch qemu : qemu-system-i386 -boot a -fda floppyA -serial pipe:/tmp/myfifo)