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.
}
QNX オペレーティング システム用の c で割り込みハンドラを作成しました。私の仕事:udp層にデータがあるときはいつでも、カーネルはこの割り込みハンドラを呼び出す必要があります。上記のコードで割り込みレイテンシを計算しています。CLIENT はデータを送信し、サーバー (上記のコード) はクライアントからデータを受信して応答を返します。上記のコードは、udp レイヤーでデータを受信するたびに中断されるわけではありません。上記の間違いは何ですか?? 誰かが私を助けてくれませんか??