FreeBSD programming question

J. Seth Henry jshamlet at comcast.net
Tue Aug 5 14:30:12 PDT 2003


Not sure if this is the right list or not, but I could really use some
pointers.

How can I code trap serial port interrupts in my C program?

For example, I want to read values from a serial device every
user-specified number of seconds, calculate some stuff and then sit for
a while. Should the serial device decide it wants to send some data
unsolicited, I would like to enter an interrupt service routine, handle
the communication, and then return to the previous loop.

I can get the loop going by using sleep(n), but I don't know how to
write the ISR in C, and (additionally) make it such that it will run on
any *nix like platform. 

Any pointers, HOWTO's, or examples would be greatly appreciated!

Thanks,
Seth



More information about the freebsd-questions mailing list