Hi all,
I am using hardware asrc on imx6 ul free scale board by using linux ioctl driver calls. There are two threads in my application in which one is main thread and other one is asrc thread. In the asrc thread, I am calling ioctl asrc convert driver function. In general, once I have data I will call ioctl function, otherwise the asrc thread will go into conditional wait. The code inside the ioctl function is supposed to be light weight so that the main thread can carry other tasks while hardware asrc is converting the data. But, I see there is a serious loading happens and my main thread is running slowly. When the ioctl call in the asrc thread is switched off, the main thread runs at a faster rate which is what needed even in the presence of ioctl call. Could anyone please help to understand this behavior of ioctl call...Thanks
Hi,
Actually, there is a unit test about ASRC driver in your target image root fs, the path is "/unit_tests/mxc_asrc_test.out" , you can run it :
$ . /unit_tests/autorun-asrc.sh
And test this for check the driver if available. Otherwise, it is your thread issue.
Hi Yifang Guo,
Thanks for your suggestions... The asrc after testing independently is working fine. There is no issue with quality. My goal is to use it as a parallel resource. So, I am calling it from a separate thread. I suppose the function ioctl for asrc convert should not take much cycles from the core after it is called. Because I want to use the core for other tasks running in parallel through threading. Please correct me if there is any mistake..Thanks..
Hi ,
ASRC driver implement CONVERT by hardware module (Asynchronous Sample Rate Converter), it don't spend ARM core executing cycles when convert sample rate. You can use ARM core to deal with other task simultaneously.
You test call ioctl ASRC_CONVERT periodically in your thread. e.g:
while(1){
ioctl(fd_asrc, ASRC_CONVERT, &buf_info);
msleep(100); // escape time from this thread; then CPU can call other threads.
}
Attatched "mxc_asrc_test" source code for reference.
Hi Yifang,
Which header file has this function msleep(). Is this compulsory to keep?
#include <unistd.h>
google linux msleep function.
msleep(100); can escape time from this thread; then CPU can call other threads
Hi jimmychan,
Thanks for your reply..
The ioctl call goes as follows ..
err = ioctl(fd_asrc, ASRC_CONVERT, &buf_info);
fd_asrc is the id of the hardware asrc
ASRC_CONVERT is the command
struct asrc_convert_buffer buf_info has the details of input and output addresses with the lengths as well
This call is used in mxc_asrc driver code.. I would be looking forward for your views and suggestions.. thanks..