Skip navigation.
Home
The QNX Community Portal

View topic - how to handle the interrupt from client ??

how to handle the interrupt from client ??

For discussion of realtime and/or embedded programming.

how to handle the interrupt from client ??

Postby hemanth » Tue May 06, 2014 10:22 am

I am having a client and server. client will send the data to the server. The server is the embedded pc target (X86). whenever client sends the data the server wants to handle the interrupt and calcualte the time at which the interrupt occurs. I know how to get the timestamp. But someone please help me in writing a C code to handle interrupts from client ?? I am analyzing the time at which the interrupt occurs and time at which handler starts executing. PLEASE someone help me .


const struct sigevent *ISR(void *area, int id1)
{


EndInterruptTime = GetTimeStamp();

InterruptLatency = EndInterruptTime - StartInterruptTime;

measurements[17] = InterruptLatency;


return 0;

}



volatile int id1; //variables used in the isr should be volatile
struct sigevent event;

int ConfigureISR(void) //void *ISR (void *arg)
{
/* the software must tell the OS that it wishes to associate the ISR with a particular source of interrupts.
* On x86 platforms, there are generally 16 hardware Interrupt Request lines (IRQs) */


StartInterruptTime = GetTimeStamp(); //startTime of the interrupt

volatile int irq = 7; //0 : A clock that runs at the resolution set by ClockPeriod()

ThreadCtl (_NTO_TCTL_IO, NULL); // enables the hardware interrupt
// Initialize event structure
event.sigev_notify = SIGEV_INTR;

id1 = InterruptAttach(irq, &ISR, NULL, 0, 0); // ISR is the interrupt service routine


InterruptDetach(id1);

return 0;
}

I tried writing a code like above but while debugging it is terminating at the interrupt attach api . PLEASE someone help me.
hemanth
Active Member
 
Posts: 20
Joined: Mon Dec 23, 2013 11:14 pm

Re: how to handle the interrupt from client ??

Postby mario » Tue May 06, 2014 5:48 pm

Post the content of GetTimeStamp().

Note that StartInterruptTime is not the start time at all. Even if your program worked, this will not measure what you trying to mesure.

Why don't you use the system profiler. That will tell you all you want to know and even more precisely then your solution.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: how to handle the interrupt from client ??

Postby hemanth » Tue May 06, 2014 9:03 pm

oh sorry. I did not post the code of GetTimeStamp. I created a free running timer, If I call that anywhere in my program to get the timestamp. I saw you replying regarding handling interrupts and interrupt latency.

I am also calculating interrupt latency.
requirement : Client is sending data to embedded pc (server : FIT PC2 with QNX RTOS). when server receives an interrupt then I have to get the timestamp. How to handle the interrupt on the server side ??
hemanth
Active Member
 
Posts: 20
Joined: Mon Dec 23, 2013 11:14 pm

Re: how to handle the interrupt from client ??

Postby hemanth » Tue May 06, 2014 9:10 pm

I cant use system profiler because I (server) am calculating the timestamp, when the interrupt occurs and storing in a memory. Later sending the timestamp back to client.

my question : How to handle the interrupt from client on the server side ??
could you please give me a small example ??
hemanth
Active Member
 
Posts: 20
Joined: Mon Dec 23, 2013 11:14 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: Bing [Bot] and 2 guests