I have an interrupt started with InterruptAttach(), which return a pulse when some processing have
to be done at thread level.
My question is: How do I catch this pulse in the worker thread?
Here is the code:
void* workerThread(void * arg)
{
extern struct VDCA_ISR_com_area VDCA_ISR_comBuf;
unsigned int call_counter = 0;
int channel_ID;
struct _pulse rcv_pulse;
struct _msg_info msg_info_debug;
//----- create communication channel -----
channel_ID = ChannelCreate( 0 );
if( -1 == channel_ID ){
TRACE(“workerThread: Channel creation failed: %s\n”, strerror(errno) );
return NULL;
}
//----- initialize VDCA ISR event -----
SIGEV_PULSE_INIT( VDCA_ISR_comBuf.event, channel_ID, getprio(0), eVDCA_pulseCode, eVDCA_none );
int Isr_ID = InterruptAttach( PPC85xx_INTR_IRQ0,
vdcaIsr,
&VDCA_ISR_comBuf,
sizeof(VDCA_ISR_comBuf),
_NTO_INTR_FLAGS_TRK_MSK );
if( Isr_ID != -1){
TRACE(“Interrupt attached successfully, Isr_ID = %d\n”, Isr_ID);
}
else{
TRACE(“Failled to attach interrupt: %s\n”, strerror(errno));
return NULL;
}
/**************************
-
Processing loop *
**************************/
while(1)
{
//----- wait for pulse from ISR -----
if( MsgReceive( channel_ID, &rcv_pulse, sizeof(rcv_pulse), &msg_info_debug ) >= 0 ){
=== MsgReceive NEVER UNBLOCK ===
printf("*** workerThread() got a message or a pulse ***\n");
}
}//while(1)
return NULL;
}