Hi Community !!!
why this code witch InterruptAttachEvent() works only just once a time and not quite often???
[color=green]#include <stdio.h>
#include <stdlib.h> /* for EXIT_* /
#include <stdint.h> / for uintptr_t /
#include <sys/neutrino.h> / for ThreadCtl() */
define IRQ 0
int
main( void )
{
int privity_err;
struct sigevent event;
int intr_id;
int i;
/* Give this thread root permissions to access the hardware */
privity_err = ThreadCtl( _NTO_TCTL_IO, NULL );
if ( privity_err == -1 )
{
printf( "Can't get root permissions\n" );
return -1;
}
/* Tell the kernel to attach an interrupt signal event to this thread */
event.sigev_notify = SIGEV_INTR;
intr_id = InterruptAttachEvent( IRQ, &event, 0 );
if ( intr_id == -1 )
{
printf( "Couldn't attach event to IRQ %d\n", Timer IRQ );
return EXIT_FAILURE;
}
for ( i = 0; i < 10; i++ )
{
/* Sleep until the next interrupt */
InterruptWait( 0, NULL );
printf("Interrupt \n");
/* Reenable this interrupt */
InterruptUnmask( IRQ, intr_id );
}
/* Remove the attachment from this thread */
InterruptDetach( intr_id );
return EXIT_SUCCESS;
}
Thank you !!!