FreeBSD programming question
Rui Lopes
rui at ruilopes.com
Wed Aug 6 04:11:54 PDT 2003
On Ter, 2003-08-05 at 22:30, J. Seth Henry wrote:
> 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?
You can't attach to interrupts in a userland program, but you can access
serial ports by opening any of /dev/cuaaX device files.
> 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!
Take a look at these (in no particular order):
- http://www.easysw.com/~mike/serial/
"Serial Programming Guide for POSIX Operating Systems"
- http://en.tldp.org/HOWTO/Serial-Programming-HOWTO/index.html
"Serial Programming HOWTO"
- http://www.freebsd.org/handbook/serialcomms.html
"Serial Communications"
- sio(4)
Good luck!
Rui Lopes
More information about the freebsd-questions
mailing list