[ECOS] How to make a Interrupt driven serial port driver?
Jonathan Larmour
jlarmour@redhat.com
Sun Oct 29 13:43:00 GMT 2000
> Ling Su wrote:
>
> Dear All,
>
> I am using a NEC VRC4373 board, as you may know, it has two serial ports.
> I use serial port 1 for GDB, and leave serial port 2 for communication
> with PC. Now I have tested all the io tests on serial port 2, so it works
> well.
Out of interest, what was the problem before?
> My question is how I can make a Interrupt driven driver from serial
> port 2. The current serial port driver in eCos supports general
> Read/Write/ioctl funtions. I don't want to waste time on constantly query
> serial port for input. The ideal method will be interrupt trigged when
> input byte coming. On this platform, only one interrupt allocated to
> UART, serial port 1 for GDB purpose, I think it will use Interrupt, too.
> Is there any general method to implement a interrupt driver for serial
> port B? Or I have to write it from scratch? Is there kernal API for me
> can register such kind of Interrupt for serial port B without producing
> conflict for serial port A?
Look at the end of the serial driver, above the DSR. Here's what it says:
// Note: This device presents a single interrupt for both channels. Thus
the
// interrupt handler has to query the device and decide which channel needs
service.
and indeed in the code:
stat = scc_read_ctl(port, R3);
if (stat & (RR3_AExt | RR3_ATxIP | RR3_ARxIP)) {
chan = vrc4373_chans[0]; // Hardware channel A
vrc4373_int(chan, stat>>3); // Handle interrupt
} else if (stat & (RR3_BExt | RR3_BTxIP | RR3_BRxIP)) {
chan = vrc4373_chans[1]; // Hardware channel A
vrc4373_int(chan, stat); // Handle interrupt
} else {
Although the second comment is wrong (it should be channel A then channel
B, not two channel A's obviously) - I'll fix that now.
So in fact it should already be interrupt driven.
Or instead are you asking for some sort of automatic notification to your
application when data arrives?
Jifl
--
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault
More information about the Ecos-discuss
mailing list