Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - InterruptAttachEvent: (4 Items)
   
InterruptAttachEvent  
Hello,

I am using the InterruptAttachEvent () API as follows

void thread_func()
{
	
	cout <<"HI, I am a thread" << endl;
	ThreadCtl ( _NTO_TCTL_IO, NULL);
	
                struct sigevent sEvent;
	
	InterruptAttachEvent (10, &sEvent, 0);
	
	while (1)
	{
		InterruptWait (NULL, NULL);
	}
}

Is this the correct way of using the InterruptAttachEvent API?

If yes how do we raise this event so that the InterruptWait (NULL, NULL); call unblocks?

Regards,
Lakshmi.
Re: InterruptAttachEvent  
You need to initialise sEvent first -

SIGEV_INTR(&sEvent)

Also note that the interrupt will remain masked when InterruptWait
returns - so you will need to call InterruptUnmask() on it
in order to receive any more interrupts on that level.

Lakshmi Narasaiah wrote:
> Hello,
> 
> I am using the InterruptAttachEvent () API as follows
> 
> void thread_func()
> {
>        
>         cout <<"HI, I am a thread" << endl;
>         ThreadCtl ( _NTO_TCTL_IO, NULL);
>        
>                 struct sigevent sEvent;
>        
>         InterruptAttachEvent (10, &sEvent, 0);
>        
>         while (1)
>         {
>                 InterruptWait (NULL, NULL);
>         }
> }
> 
> Is this the correct way of using the InterruptAttachEvent API?
> 
> If yes how do we raise this event so that the InterruptWait (NULL, 
> NULL); call unblocks?
> 
> Regards,
> Lakshmi.
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post7088
> 

-- 
cburgess@qnx.com
Re: InterruptAttachEvent  
> You need to initialise sEvent first -
> 
> SIGEV_INTR(&sEvent)
> 
> Also note that the interrupt will remain masked when InterruptWait
> returns - so you will need to call InterruptUnmask() on it
> in order to receive any more interrupts on that level.
> 
> Lakshmi Narasaiah wrote:
> > Hello,
> > 
> > I am using the InterruptAttachEvent () API as follows
> > 
> > void thread_func()
> > {
> >        
> >         cout <<"HI, I am a thread" << endl;
> >         ThreadCtl ( _NTO_TCTL_IO, NULL);
> >        
> >                 struct sigevent sEvent;
> >        
> >         InterruptAttachEvent (10, &sEvent, 0);
> >        
> >         while (1)
> >         {
> >                 InterruptWait (NULL, NULL);
> >         }
> > }
> > 
> > Is this the correct way of using the InterruptAttachEvent API?
> > 
> > If yes how do we raise this event so that the InterruptWait (NULL, 
> > NULL); call unblocks?
> > 
> > Regards,
> > Lakshmi.
> > 
> > _______________________________________________
> > General
> > http://community.qnx.com/sf/go/post7088
> > 
> 
> -- 
> cburgess@qnx.com


Hi Colin,

Thanks for the input,

How can we simulate the raising of an Hardware Interrupt?

Regards,
Lakshmi.
Re: InterruptAttachEvent  
> > You need to initialise sEvent first -
> > 
> > SIGEV_INTR(&sEvent)
> > 
> > Also note that the interrupt will remain masked when InterruptWait
> > returns - so you will need to call InterruptUnmask() on it
> > in order to receive any more interrupts on that level.
> > 
> > Lakshmi Narasaiah wrote:
> > > Hello,
> > > 
> > > I am using the InterruptAttachEvent () API as follows
> > > 
> > > void thread_func()
> > > {
> > >        
> > >         cout <<"HI, I am a thread" << endl;
> > >         ThreadCtl ( _NTO_TCTL_IO, NULL);
> > >        
> > >                 struct sigevent sEvent;
> > >        
> > >         InterruptAttachEvent (10, &sEvent, 0);
> > >        
> > >         while (1)
> > >         {
> > >                 InterruptWait (NULL, NULL);
> > >         }
> > > }
> > > 
> > > Is this the correct way of using the InterruptAttachEvent API?
> > > 
> > > If yes how do we raise this event so that the InterruptWait (NULL, 
> > > NULL); call unblocks?
> > > 
> > > Regards,
> > > Lakshmi.
> > > 
> > > _______________________________________________
> > > General
> > > http://community.qnx.com/sf/go/post7088
> > > 
> > 
> > -- 
> > cburgess@qnx.com
> 
> 
> Hi Colin,
> 
> Thanks for the input,
> 
> How can we simulate the raising of an Hardware Interrupt?
> 
> Regards,
> Lakshmi.

You could use a timer like the sample here

http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/t/timer_create.html

shows.

Hope  this helps.
Jeevan