Can I use SPLOOP in interrupt handler when I use SPLOOP in main program?
Does C674x support nesting SPLOOPs in case of interrupt?
How deep nesting is supported?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dimitry,
I don't think you should do it. Actually, I doubt the compiler will let that happen (SPLOOP inside the ISR).
If SPLOOP is in action and is interrupted, and if SPLOOP buffer is used to process other loop in the interrupt, the previous partial loop information will be gone because there is "stack" that can back up the state of the SPLOOP buffer.
The key is to keep ISR short/brief, what do you need to do here?
regards,
Paul
Ok, it's clear.
I made FreeRTOS port for C674x. And I want to prevent SPLOOP buffer corruption in case when task, that executing SPLOOP yielded (by scheduler), and another task starts SPLOOP. The simple way is using semaphore/mutex for SPLOOPs.
If it's impossible, how can I "tell" to compiler: "Please, don't use SPLOOP in THIS task while optimization" ?
How do you solve this problem in DSP/BIOS ?
Dmitry,
I am moving this to the compiler forum regarding your question:
Dmitry said:If it's impossible, how can I "tell" to compiler: "Please, don't use SPLOOP in THIS task while optimization" ?
The rest of the BIOS related questions, please post in the BIOS forum.
regards,
Paul
Dmitry said:how can I "tell" to compiler: "Please, don't use SPLOOP in THIS task while optimization" ?
The build option --disable_software_pipeline tells the compiler not to generate any software pipeline loops. In effect, SPLOOP is not used.
But you shouldn't have to do that. The C6000 CPU User's Guide says, in the last part of the section titled Interrupt the Loop Buffer, ...
Interrupt service routines must save and restore the ITSR or NTSR, ILC, and RILC registers. A B IRP instruction copies ITSR to TSR, and a B NRP restores TSR from NTSR.
The compiler returns from an interrupt function with B IRP, so a compiler generated interrupt routine which contains SPLOOP should preserve ITSR, ILC, and RILC. It turns out interrupt code generated by the compiler does preserve ILC and RILC, but not ITSR. I filed SDSCM00042376 in the SDOWP system to get that fixed. You can track it with the SDOWP link in my sig below. I also noted a workaround for that bug in that SDOWP entry.
To sum up, a compiler generated interrupt routine can use SPLOOP. Except that, due to a bug, the ITSR register is not preserved. Fortunately, the workaround for that bug is very straightforward.
Thanks and regards,
-George
Dear Georgem, I verified your answer.
I call "DSPF_sp_fftSPxSP" (from DSPLIB, it uses SPLOOP) before start scheduler. And save FFT result (Res0).
Then I start FreeRTOS with preemption multitasking (tick time is 100 us).
I have two identical tasks, which call "DSPF_sp_fftSPxSP" on the same data. And then check output array (It has to be identic with Res0).
I checked situation, when both tasks yielded during SPLOOP (SPLX bit in ITSR was active in the entry point of "context switch interrupt").
All works perfectly. But I really can't understand why SPLOOP loop buffer does not corrupt in this situation. I have only two ideas:
1) TI have got C674x core from an Alien civilization.
2) Your developers are Aliens. :)
I can't find any rational answer in your documentation (sprufe8b.pdf).
Well, I don't understand all the details either. I know that, when the interrupt occurs, the loop is piped down. When the interrupt is over, the loop is piped back up from memory. All the state required to do that is in the ITSR, ILC, and RILC registers.
Thanks and regards,
-George