how to talk to the serial and parallel ports through a C

Malcolm Kay malcolm.kay at
Wed Jun 11 04:53:51 PDT 2003

On Wed, 11 Jun 2003 08:15, Bernard Dugas wrote:
> Hi,
> I also did some programming on serial port to control pins with a c
> program under linux, but I didn't found any simple way to port it under
> freebsd. Any hint ?
> For instance, I need the equivalent of :
> inb(adr)
> outb(val,adr)
> iopl(n)
> ioperm(adr)
> from <sys/io.h> and <stdio.h> in linux.

The i/o space in FreeBSD is normally reserved for management 
by the kernel. In my opinion this makes it a real hosted OS rather
than some mickey mouse thing.

However if a process run by root opens /dev/io then while it is
held open the process can make direct access to i/o ports. Nice
for experimenting with software, but for production it is better to
write a kernel module for special driver requirements.

Are you sure the standard serial driver interfaces are not suitable 
for your needs -- they are very flexible.


More information about the freebsd-questions mailing list