[okl4-developer] About register IRQ and ISR on Iguana application

Nelson Tam nelson at ok-labs.com
Thu Feb 14 16:44:33 EST 2008


Hi Kashin,

On 05/02/2008, at 7:52 PM, kashin Lin wrote:

> 1. something we have to do in ISR (ex: clear interrupt) should be  
> placed in "//do somthing"
>     or when we call "L4_Reply(from_tid)" L4 will take care this?

It should be done in the "// do something" section.

> 2. how to create a thread which execute the function we specify?
>    (sorry that i'm not familiar with it.)


Usually the code that Carl has written would be contained in a event  
handling loop, like so:

void
event_loop(void)
{
	while (true)
	{
		L4_Wait(&from_tid);

		// check for error here

		// check if interrupt recieved
		if (L4_ThreadNo(from_tid) == irq)
		{
			// do somthing
			L4_Reply(from_tid); // ack interrupt
		}
	}
}

After you create the thread, you supply the initial instruction and  
stack pointer using
L4_ExchangeRegisters(). See functions starting with "L4_Start" in libs/ 
l4/include/thread.h.
You would put event_loop as the ip argument.

Nelson.
--
(nt)

Nelson Tam
nelson at ok-labs.com






More information about the Developer mailing list