Dear TI experts,
could you help me please? Thanks so much.
MCU: TMS570LS20216, this MCU hardware not support IRQ preempt IRQ in default;
In my application, IRQs from high priority to low priority: adc1group0Interrupt, adc1group1Interrupt, adc1group2Interrupt, adc2group0Interrupt, vPreemptiveTick. vPreemptiveTick is FreeRTOS operating systems 1ms tick interrupt, I reconfigured it to IRQ VIM channel[61] which is lower priority (vimREG->CHANMAP[61]=2). The FreeRTOS is generated from HalCoGen ver2.10.
In my application, we need implement this requirement: when adc2group0Interrupt is in service, we need enable higher IRQs(adc1group0Interrupt, adc1group1Interrupt, adc1group2Interrupt) preempt this interrupt, but lower priority IRQ(vPreemptiveTick) can’t preempt this interrupt.
The following is adc2group0Interrupt() code, when using ETM trace tool, I found sometimes os task will run after entering this interrupt, I don’t know why this happens, I don’t want to os task run after entering this interrupt:
#pragma INTERRUPT(adc2Group0Interrupt, IRQ)
void adc2Group0Interrupt(void)
{
/* used to save the interrupt enable/disable settings */
uint32 interrupt_setting_1 = 0;
adcREG2->GxINTFLG[0U] = 9U;
/* save the interrupt enable/disable settings */
interrupt_setting_1 = (uint32)(vimREG->REQMASKSET1);
/*
* adc2Group0Interrupt is in VIM channel[50],
* diable all lower priority interrupts and adc2Group0Interrupt itself.
* So, only higher priority will preempt this interrupt.
*/
vimREG->REQMASKCLR1 = 0xFFFC0000;
/*
* Manually save context, and Enable IRQ interrupt.
*/
asm(" STMFD SP!, {R0-R12, LR}");/*Save R0- R12, LR_irq*/
asm(" mrs lr, spsr"); /* Copy SPSR_irq to LR */
asm(" STMFD SP!, {LR}"); /* Save SPSR_irq */
asm(" MSR CPSR_c, #0x1F"); /* Enable IRQ (Sys Mode) */
asm(" STMFD SP!, {LR}"); /* Save LR */
Rte_Run_Application_Logics();
/*
* Manually restore context, and disable IRQ.
*/
asm(" LDMFD SP!, {LR}"); /* Restore LR */
asm(" MSR CPSR_c, #0x92"); /* Disable IRQ (IRQ Mode) */
asm(" LDMFD SP!, {LR}"); /* Restore SPSR_irq to LR */
asm(" MSR SPSR_cxsf, LR"); /* Copy LR to SPSR_irq */
asm(" LDMFD SP!, {R0-R12, LR}");/* Restore LR */
/* restore the interrupt enable/disable settings */
vimREG->REQMASKSET1 = interrupt_setting_1;
}