Re: Re: off topic - Assembler using GCC
Quoting MallarJ@aol.com (MallarJ@aol.com):
> I suppose there are cases where this is valid, but for my original point about
> communciations - it just isn't feasible to use IRQ4 (the first comm port) by
> more than one program concurrently, is it?
>
> In my case, I had reprogrammed IRQ4 so when a char came in from the modem, I
> could stuff it to a buffer for use later on, and send data to the buffer (and
> ultimately use the IRQ to send it back out again when the buffer was full)
> when I had my reply ready. I certainly wouldn't want another program taking
> chars from my modem while I'm using it.
And that's just what the kernel can enforce through its privilege.
> How would you accomplish the same in Linux without using interrupt routines?
Take a look at /usr/src/linux/drivers/char/serial.c for how linux
does it. It's not that linux doesn't use interrupt routines,
it's just that you (as a user in a user process) don't run them
directly. You (as a kernel hacker) can do it in kernel-space
within a device driver, like serial.c.
If you take the kernel source as a model, it's not that difficult
to write a simple device driver for a simple device, like, for
example, a card I have for driving a motorised specimen stage.
You just have to stick to the rules when interacting with the
kernel. It's also about the only C programming I've ever bothered
with.
Cheers,
--
Email: d.wright@open.ac.uk Tel: +44 1908 653 739 Fax: +44 1908 655 151
Snail: David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer: These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.
Reply to: