Mark Rages schrieb:
Hi,
I'm porting some code from IAR to mspgcc. Is there an equivalent
instruction to IAR's __even_in_range directive? This generates an
efficient lookup table for use in timer interrupt.
you can write a snippet of inline assembly for a jump table.
interrupt (TIMERA1_VECTOR) __attribute__ ((naked)) tax_int(void) {
//demux timer interrupts
asm("add %0, r0 ; TAirq# + PC"::"m" (TAIV));
asm("reti ; CCR0 - no source");
asm("jmp ccr1 ; CCR1");
asm("jmp ccr2 ; CCR2");
asm("reti ; CCR3 - no source");
asm("reti ; CCR4 - no source");
asm(" br #INT_TimerA_TAOVER ; TAOVER (follows directly)");
asm("ccr1: br #INT_TimerA_CCR1");
asm("ccr2: br #INT_TimerA_CCR2");
}
copied from old code. making one asm section with multiple strings that
the c-compiler joins and doing c //-comments per line would be nicer, i
think. like
asm(
"insns1 \n" // 1st instruction
"insns2 \n" // 2nd instruction
: outputs
: inputs
);
also, remove the naked attribute if you're putting more c code in the
same interrupt handler.
chris