On Wed, Oct 8, 2008 at 8:56 PM, Rafal Brodewicz <[EMAIL PROTECTED]> wrote: > Hello. > > I need to write program (in C) for my classes to communicate two PC's through > RS232C interface > using hardware registers. > > I'm mostly interested how to get to these registers. > Can someone guide my, or give some point from which should I start? > Maybe some relevant book? > By the way, is it easy to accomplish this with OpenBSD OS? > > Thanks for any help. > -- > Rafal Brodewicz > >
The generic rs232 controller on x86 is composed of 8 registers. In general the com1 starts at the addr 0x3f8 and the com2 at 0x2f8 (on new hardware you can get the different serial base addresses over the LPC bus connected on the PCI bus). If you want to work on the rs232 registers you must be in ring0. If you want to do it on OpenBSD you can do it with a kernel Module. I think it could be a good idea to recompile your kernel without the support of com before. You can have access to the rs232 registers with bus_space_read_1 or bus_space_write_1 function present in arch/i386/include/bus.h or with inb and outb function present in arch/i386/include/pio.h and used by bus_space_XXX. These functions allow you to read or write on the rs232 registers. If you want the details of the rs232 registers you can go there : http://www.beyondlogic.org/serial/serial.htm. Cheers, -- Gallon sylvestre OpenBSD fan | Rathaxes Core Developper LSE researcher | kernel developer for adeneo http://devsyl.blogspot.com/ | www.rathaxes.org