const struct sigevent *intHandler(void *arg, int id)
{
start_clock = ClockCycles();
//printf("start clock: %lld\n", start_clock);
return(&event);
}
int ConfigureISR()
{
// Get IO privilege
//
ThreadCtl( _NTO_TCTL_IO, 0 );
//
// Setup COID and event
chid = ChannelCreate( 0 );
SIGEV_INTR_INIT( &event);
interruptID = InterruptAttach(7, intHandler, NULL, 0, 0);
if (interruptID == -1)
{
fprintf(stderr, "can't attach to IRQ\n");
perror (NULL);
exit (EXIT_FAILURE);
}
InterruptWait(0, NULL);
end_clock = ClockCycles();
// printf("end clock: %lld\n", end_clock);
//microseconds
InterruptLatency = (uint32) ((end_clock - start_clock)*1000000/(SYSPAGE_ENTRY(qtime)->cycles_per_sec));
printf("microseconds: %ld\n", InterruptLatency);
measurements[17] = InterruptLatency;
return (EXIT_SUCCESS);
}
int main()
{
ConfigureISR();
// my socket code here to receive data from client.
}
我在c中为QNX操作系统创建了一个中断处理程序。 我的任务:只要udp层上有数据,内核就应该调用这个中断处理程序。我正在计算上面代码中的中断延迟。 CLIENT正在发送数据,服务器(上面的代码)正在从客户端接收数据并发回响应。 当它在udp层上接收数据时,上述代码不会每次都被中断。上面的错误可能是什么?有人可以帮助我吗?