如何将数据同步发送到两个IIO通道?

huangapple go评论63阅读模式
英文:

How to send data to two iio channels syncroniously?

问题

我正在使用FMCOMMS-3板上的AD9361来控制一些光学设置。为此,我需要将一个信号发送到第一个设备(x轴声光偏转器),将另一个信号发送到第二个设备(y轴声光偏转器)。至关重要的是,xy 的信号需要同步发送。

我通过libiio操作芯片。我已经用所需的数据填充了对应于两个轴的缓冲区(有两个缓冲区对应于两个设备)。

理论上,现在我需要在两个缓冲区上调用iio_buffer_push(),但据我所知,这个函数是同步的 - 它只会在设备发送完所有数据后才返回。如何才能同时推送缓冲区到两个设备,以便传输的信号会同时发送?

英文:

I'm using AD9361 on FMCOMMS-3 board to control some optical setup. To do so I need to send one signal to the first device (x-axis acousto-optical deflector) and another signal to the second device (y-axis AOD). It is crucial, that the signals for x and y are synced (sent simultaneously).

I operate with the chip via libiio. I've filled the buffers corresponding to both axes with the desired data (there are 2 buffers corresponding to 2 devices).

In theory, now I have to call iio_buffer_push() on both buffers, but AFAIK this function is synchronous - it will return only after all the data is sent by the device. How can I push buffers to two devices, so that the transmitted signals will be sent simultaneously?

答案1

得分: 1

你可以使用 iio_buffer_set_blocking_mode() 将 iio_buffer 设置为非阻塞模式。这样,iio_buffer_push() 不会阻塞,会立即返回。例如,参见此文档

例如:

    iio_buffer_set_blocking_mode(somebuff, false); // 设置为非阻塞模式
    iio_buffer_push(somebuff); // 立即返回
    iio_buffer_push(otherbuff);
英文:

You can use iio_buffer_set_blocking_mode() to set an iio_buffer to non-blocking mode. That way, iio_buffer_push() will not block, and will return immediately. e.g. see this documentation.

e.g.

    iio_buffer_set_blocking_mode(somebuff, false); // Set non-blocking mode
    iio_buffer_push(somebuff); // Returns immediately
    iio_buffer_push(otherbuff);

huangapple
  • 本文由 发表于 2023年2月8日 21:02:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386210.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定