Senthil K
04/14/2010 11:52 AM
post51671
|
Hi,
I am using the mpc85xx Board and registered the interrupt pin 0x8 along with process.
MY interrupt handler is not getting invoked.I have pasted my code.
Please let me know incase of any mistakes..
/* OS specific Header files */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <string.h>
#include <sys/neutrino.h>
#include <sys/neutrino.h>
#include <sys/types.h>
void *int_thread (void *arg);
const struct sigevent *isr_handler (void *arg, int id);
struct sigevent event;
int main ()
{
int irid;
// enable I/O privilege
if(ThreadCtl (_NTO_TCTL_IO, NULL) == -1)
{
printf(" Permission denied\n");
return -1;
}
event.sigev_notify = SIGEV_INTR;
// attach the ISR to IRQ 8
irid = InterruptAttach_r(0x8, isr_handler, NULL, 0,_NTO_INTR_FLAGS_TRK_MSK);
if(irid == -1)
{
printf(" Interrupt Attach failed\n");
return -1;
}
while (1)
{
InterruptUnmask(0x8,irid);
InterruptWait (0, NULL);
}
InterruptDetach(irid);
return 0;
}
// this is the ISR
const struct sigevent *isr_handler (void *arg, int id)
{
printf(" INTR\n");
printf("########## ISR ##################\n");
return (&event);
}
Please help me on this..
Regards
K.Senthil
|
|
|
David Sarrazin
|
RE: ISR not getting invoked
|
David Sarrazin
04/14/2010 12:58 PM
post51675
|
RE: ISR not getting invoked
I'm not sure why the interrupt is not getting invoked, but I see a
problem with your code. You are using the InterruptAttach() function,
and providing an ISR routine, but then the rest of the code is written
as though you were using InterruptAttachEvent(). With
InterruptAttachEvent(), you must call InterruptUnmask(). With
InterruptAttach(), do not call InterruptUnmask() unless you are also
calling InterruptMask(). Next, if you continue to use
InterruptAttach(), you cannot use printfs in your ISR. Please read the
library reference, and look at the "safety" section at the bottom of
each function page. That lists where it is safe to call each function.
David
> -----Original Message-----
> From: Senthil K [mailto:community-noreply@qnx.com]
> Sent: April 14, 2010 11:53 AM
> To: ostech-core_os
> Subject: ISR not getting invoked
>
> Hi,
>
> I am using the mpc85xx Board and registered the interrupt pin
> 0x8 along with process.
>
> MY interrupt handler is not getting invoked.I have pasted my code.
> Please let me know incase of any mistakes..
>
>
> /* OS specific Header files */
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <errno.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <net/if.h>
> #include <string.h>
> #include <sys/neutrino.h>
> #include <sys/neutrino.h>
> #include <sys/types.h>
>
> void *int_thread (void *arg);
> const struct sigevent *isr_handler (void *arg, int id);
>
> struct sigevent event;
>
> int main ()
> {
> int irid;
>
>
> // enable I/O privilege
> if(ThreadCtl (_NTO_TCTL_IO, NULL) == -1)
> {
> printf(" Permission denied\n");
> return -1;
> }
>
> event.sigev_notify = SIGEV_INTR;
>
> // attach the ISR to IRQ 8
> irid = InterruptAttach_r(0x8, isr_handler, NULL,
> 0,_NTO_INTR_FLAGS_TRK_MSK);
>
> if(irid == -1)
> {
> printf(" Interrupt Attach failed\n");
> return -1;
> }
> while (1)
> {
>
> InterruptUnmask(0x8,irid);
> InterruptWait (0, NULL);
> }
> InterruptDetach(irid);
> return 0;
>
> }
>
> // this is the ISR
> const struct sigevent *isr_handler (void *arg, int id) {
> printf(" INTR\n");
> printf("########## ISR ##################\n");
>
> return (&event);
> }
>
>
> Please help me on this..
>
> Regards
> K.Senthil
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51671
>
>
|
|
|
Senthil K
|
Re: RE: ISR not getting invoked
|
Senthil K
04/14/2010 3:24 PM
post51687
|
Re: RE: ISR not getting invoked
Hi David,
Then i can remove the InterruptUnmask from my code.
and verify the code without InterruptUnmask.
printf statement i added for whether ISR getting invoked or not.
I will remove once its gets invokd.
Regards
K.Senthil
|
|
|
Gervais Mulongoy
|
Re: RE: ISR not getting invoked
|
Gervais Mulongoy
04/14/2010 3:29 PM
post51689
|
Re: RE: ISR not getting invoked
The printf will cause a kernel crash as the function is not available in
kernel space. It can not be used here.
Please see the following article for full details including sample code:
http://WWW.QNX.com/developers/docs/6.4.1/neutrino/prog/inthandler.html
Thanks,
Gervais
Senthil K <community-noreply@qnx.com> wrote:
Hi David,
Then i can remove the InterruptUnmask from my code.
and verify the code without InterruptUnmask.
printf statement i added for whether ISR getting invoked or not.
I will remove once its gets invokd.
Regards
K.Senthil
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post51687
|
|
|
Senthil K
|
Re: RE: ISR not getting invoked
|
Senthil K
04/14/2010 3:56 PM
post51698
|
Re: RE: ISR not getting invoked
Hi Greavis,
How should identify whether my ISR is invoked or not?
Regards
K.Senthil
|
|
|
Aaron Cripps
|
Re: ISR not getting invoked
|
Aaron Cripps
04/14/2010 4:00 PM
post51700
|
Re: ISR not getting invoked
On 04/14/2010 03:56 PM, Senthil K wrote:
> Hi Greavis,
>
> How should identify whether my ISR is invoked or not?
>
> Regards
> K.Senthil
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51698
>
You could use a global status variable/counter to see if/when/how many
times your ISR has been run.
-Aaron
|
|
|
David Sarrazin
|
RE: ISR not getting invoked
|
David Sarrazin
04/14/2010 4:04 PM
post51701
|
RE: ISR not getting invoked
Gotta love replies that post at the top and the bottom :)
Also, that thread which is blocked in InterruptWait() will unblock when
the interrupt triggers. You can put the printf in the thread that is
doing the InterruptWait().
8 seems like a low number for a PPC interrupt. As Colin suggested, look
in the source for your BSP (which one is it? There are three for the
MPC85XX chips), the init_intrinfo.c file will contain a function (called
init_intrinfo()! ) that fills out an array which maps physical interrupt
lines to Neutrino interrupt numbers. That mapping is also supposed to
be documented in the "build" file which ships with the BSP.
David
> -----Original Message-----
> From: Aaron Cripps [mailto:community-noreply@qnx.com]
> Sent: April 14, 2010 4:00 PM
> To: ostech-core_os
> Subject: Re: ISR not getting invoked
>
>
> On 04/14/2010 03:56 PM, Senthil K wrote:
> > Hi Greavis,
> >
> > How should identify whether my ISR is invoked or not?
> >
> > Regards
> > K.Senthil
> >
> >
> >
> > _______________________________________________
> >
> > OSTech
> > http://community.qnx.com/sf/go/post51698
> >
> You could use a global status variable/counter to see
> if/when/how many times your ISR has been run.
> -Aaron
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51700
>
>
|
|
|
Aaron Cripps
|
Re: ISR not getting invoked
|
Aaron Cripps
04/14/2010 4:06 PM
post51702
|
Re: ISR not getting invoked
On 04/14/2010 04:04 PM, David Sarrazin wrote:
> Gotta love replies that post at the top and the bottom :)
>
Sorry Dave ... force of habit ... I like the context of my replies to be
above the message ... which doesn't make as much sense on forums, does
it? ;)
|
|
|
David Sarrazin
|
RE: ISR not getting invoked
|
David Sarrazin
04/14/2010 4:10 PM
post51703
|
RE: ISR not getting invoked
Everyone has their own way of doing it. I'm not saying one's right or
wrong, and you won't be the last to post at the front/back.
I remember a clever signature block (from Malte?) along these lines, as
he hated responses at the top:
Because it breaks the natural reading order
Why shouldn't I?
Don't reply above the original message
Sorry for the Off-topic.
> -----Original Message-----
> From: Aaron Cripps [mailto:community-noreply@qnx.com]
> Sent: April 14, 2010 4:07 PM
> To: ostech-core_os
> Subject: Re: ISR not getting invoked
>
>
> On 04/14/2010 04:04 PM, David Sarrazin wrote:
> > Gotta love replies that post at the top and the bottom :)
> >
> Sorry Dave ... force of habit ... I like the context of my
> replies to be above the message ... which doesn't make as
> much sense on forums, does it? ;)
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51702
>
>
|
|
|
Colin Burgess(deleted)
|
Re: ISR not getting invoked
|
Colin Burgess(deleted)
04/14/2010 4:12 PM
post51704
|
Re: ISR not getting invoked
The baddies lose, and the guy gets the girl.
WARNING - SPOILERS BELOW!!!
On 10-04-14 4:10 PM, David Sarrazin wrote:
> Everyone has their own way of doing it. I'm not saying one's right or
> wrong, and you won't be the last to post at the front/back.
>
> I remember a clever signature block (from Malte?) along these lines, as
> he hated responses at the top:
>
> Because it breaks the natural reading order
> Why shouldn't I?
> Don't reply above the original message
>
> Sorry for the Off-topic.
>
>
>> -----Original Message-----
>> From: Aaron Cripps [mailto:community-noreply@qnx.com]
>> Sent: April 14, 2010 4:07 PM
>> To: ostech-core_os
>> Subject: Re: ISR not getting invoked
>>
>>
>> On 04/14/2010 04:04 PM, David Sarrazin wrote:
>>
>>> Gotta love replies that post at the top and the bottom :)
>>>
>>>
>> Sorry Dave ... force of habit ... I like the context of my
>> replies to be above the message ... which doesn't make as
>> much sense on forums, does it? ;)
>>
>>
>>
>> _______________________________________________
>>
>> OSTech
>> http://community.qnx.com/sf/go/post51702
>>
>>
>>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51703
>
>
--
cburgess@qnx.com
|
|
|
Colin Burgess(deleted)
|
Re: ISR not getting invoked
|
Colin Burgess(deleted)
04/14/2010 3:36 PM
post51694
|
Re: ISR not getting invoked
I suspect that the interrupt number you are passing is wrong - the
interrupt vectors are special constants
which are defined in the init_intrinfo()
On 10-04-14 11:52 AM, Senthil K wrote:
> Hi,
>
> I am using the mpc85xx Board and registered the interrupt pin 0x8 along with process.
>
> MY interrupt handler is not getting invoked.I have pasted my code.
> Please let me know incase of any mistakes..
>
>
> /* OS specific Header files */
> #include<stdio.h>
> #include<stdlib.h>
> #include<unistd.h>
> #include<sys/stat.h>
> #include<fcntl.h>
> #include<sys/ioctl.h>
> #include<errno.h>
> #include<sys/socket.h>
> #include<netinet/in.h>
> #include<net/if.h>
> #include<string.h>
> #include<sys/neutrino.h>
> #include<sys/neutrino.h>
> #include<sys/types.h>
>
> void *int_thread (void *arg);
> const struct sigevent *isr_handler (void *arg, int id);
>
> struct sigevent event;
>
> int main ()
> {
> int irid;
>
>
> // enable I/O privilege
> if(ThreadCtl (_NTO_TCTL_IO, NULL) == -1)
> {
> printf(" Permission denied\n");
> return -1;
> }
>
> event.sigev_notify = SIGEV_INTR;
>
> // attach the ISR to IRQ 8
> irid = InterruptAttach_r(0x8, isr_handler, NULL, 0,_NTO_INTR_FLAGS_TRK_MSK);
>
> if(irid == -1)
> {
> printf(" Interrupt Attach failed\n");
> return -1;
> }
> while (1)
> {
>
> InterruptUnmask(0x8,irid);
> InterruptWait (0, NULL);
> }
> InterruptDetach(irid);
> return 0;
>
> }
>
> // this is the ISR
> const struct sigevent *isr_handler (void *arg, int id)
> {
> printf(" INTR\n");
> printf("########## ISR ##################\n");
>
> return (&event);
> }
>
>
> Please help me on this..
>
> Regards
> K.Senthil
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post51671
>
>
--
cburgess@qnx.com
|
|
|
|