Hi!
I´m having problems with the synchron channel.
The following example should work as a receiver for stream data.
When I´m starting the receiver, it always gets a pulse and writing
the data (given by the 2nd parameter from write) in the file (with
name FILE_NAME) - BUT there isn´t any transceiver process anywhere
runing.
Here my ask:
Where is the error? Why gets the MsgReceivePulse a pulse?
Lacks something?
chid = ChannelCreate( 0 );
coid = ConnectAttach( 0, 0, chid, _NTO_SIDE_CHANNEL, 0 );
fptr = creat( FILE_NAME, S_IWUSR );
most_connect(MOST_SYNC_CONNECTION, 0, &most_connector);
sync_fd = most_file_descriptor(most_connector);
SIGEV_PULSE_INIT ( &msg.event, coid, SIGEV_PULSE_PRIO_INHERIT,
MY_PULSECODE_SYNC, 0);
memset(cfg, 0, sizeof(cfg));
cfg->sync_direction = SYNC_RX;
cfg->segs = 2;
cfg->seg_size = 1024 * 64;
cfg->channels = 4;
cfg->event = msg.event;
most_stream_alloc(most_connector, cfg);
most_stream_start(most_connector, cfg);
buf_size=cfg->seg_size;
while (1)
{
if (MsgReceivePulse(chid, &pulse, sizeof(pulse), NULL) != -1)
{
printf(“streamRx → Pulse\n”);
write(fptr, &cfg->virt_addr + (pulse.value.sival_int *
buf_size), buf_size);
}
}
close( fptr );
Thanx!