Hi:
I'm working on an audio application and I use the setitimer function to set 3 timers in different parts of my code but then when I try to open the codec server after any of the timers is initialized the server won't work. I also modified firtest.c in the iuniversal examples and was able to reproduce the problem. The problem can be seem in the remote executable and not the local executable.
What we did was create a 20msec timer with setitimer() and had a Signal Handler for SIGALARM when it expires. One guess would be that it is conflicting with the Codec Engine Signal Handler. I tried disabling the Handler by following the instructions provided in the wiki page http://processors.wiki.ti.com/index.php/DSPLink_Signal_Handling_in_Codec_Engine but had no luck in getting it built. My questions are the following:
1) should the 20msec timer be done in this way?
2) Is it ok to disable the DSP Signal Handler and are there any additional steps that need to be followed?
I'm attaching the segment of the firtest.c code where I added the timer setup to reproduce the issue:
// ======== Time Test ===========================================================
struct sigaction sig_act; // Signal
struct itimerval it_val; // for setting itimer
//---------------------------
// Set up Signal Handler
//---------------------------
sig_act.sa_handler = (void*)TIME_timerInterrupt;
sig_act.sa_flags = 0;
if(sigaction(SIGALRM, &sig_act, NULL) == (int)SIG_ERR)
{
perror("Unable to catch SIGALRM");
exit(1);
}
it_val.it_value.tv_sec = 20/1000;
it_val.it_value.tv_usec = (20*1000) % 1000000;
it_val.it_interval = it_val.it_value;
if(setitimer(ITIMER_REAL, &it_val, NULL) == -1)
{
perror("error calling setitimer()");
exit(1);
}
// ======== Time Test ===========================================================
/* Init the global quit function */
FIRTEST_getQuitFxn = getQuitFxn;
/* reset, load, and start DSP Engine */
if ((ce = Engine_open(engineName, NULL, NULL)) == NULL) {
printf("%s: error: can't open engine %s\n", progName, engineName);
goto endFailOpenEngine;
}
Regards
Diego Chaverri