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.