Re: Interrupt handling

Sergio Ruocco <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Organization School of Computer Science and Engineering
Message-ID <[email protected]>

Christian, Martin, OPEE45 wrote:
> Hi,
> this time I've got a problem with interrupt handling in Pistachio. ;-)

Hi Christian

> Thread which echoes character back on serial line:
> 
> void echo_server (void)
> {
> 	L4_MsgTag_t tag;
> 	char c;
> 
> 	while ( true )
> 	{
> 		/* wait for ipc */
> 		tag = L4_Receive( hwint_tid );
> 		c = inc();

My wild guess is that, after having read the byte from the serial input data
port, you should clear the relevant interrupt bit in the serial device, to let
the device know that you handled the interrupt it triggered. This code is
missing here.

> 		if ( c )
> 			outc( c );

> 		L4_Reply( hwint_tid );

This reply should be right after the ACK (in turn after then inc() ) for a 
number of reasons. First, you may forget it, or delete it accidentally later. 
Second, the ability of the CPU of receiving input device interrupts becomes 
bound by the output device speed; moreover, if you add more code besides outc() 
the interrupt stays disabled even longer; and for some devices this may be critical


> 	}
> }
> 
> What happens is this:
> 
> Enable MPSC_INT_RCC    -> only one interrupt active at the moment
> Disable MPSC_INT_RCC   -> interrupt received and masked
> ACK MPSC_INT_RCC
> 
> The interrupt isn't enabled again. How should that happen? I thought a
> reply to the interrupt IPC automatically triggers the kernel unmask the
> interrupt again?!

Yes, but only in the CPU. Typically the device needs to be "told" that you 
handled the interrupt it raised before raising another one. Check the docs for 
your device.

> 
> Thanks,
> 
> Martin.

	Sergio

-- 

--

http://www.cse.unsw.edu.au/~sruocco/
ERTOS Researcher                                              Lecturer
National ICT Australia Ltd.              University of New South Wales

This email and any attachments are confidential. They may contain
legally privileged information or copyright material. You should not
read, copy, use or disclose them without authorisation.  If you are
not an intended recipient, please contact us at once by return email
and then delete both messages.  We do not accept liability in
connection with computer virus, data corruption, delay, interruption,
unauthorised access or unauthorised amendment.  This notice should not
be removed.
sruocco.vcf (text/x-vcard, 107 B)
begin:vcard
fn:Sergio Ruocco
n:Ruocco;Sergio
email;internet:[email protected]
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.