SHARC 中断编程
SHARC的例程都是工程级别的,也就是说没有功能划的例程,都是要去拆分工程得到的。
这次进行中断编程,硬件参考手册上的中断部分看了很多遍了,没有实际的效果。我想,毕竟是参考手册,参考手册要你掌握原理和编程方法后才有实际的作用。
void Init_PushButtons(void)
{
/* pin assignments in SRU_PIN3 (Group D) */
SRU(LOW,DAI_PB19_I); /* assign pin buffer 19 low so it is an input */
SRU(LOW,DAI_PB20_I); /* assign pin buffer 20 low so it is an input */
/* route MISCA signals in SRU_EXT_MISCA (Group E) */
SRU(DAI_PB19_O,MISCA1_I); /* route so that DAI pin buffer 19 connects to MISCA1 */
SRU(DAI_PB20_O,MISCA2_I); /* route so that DAI pin buffer 20 connects to MISCA2 */
/* pin buffer disable in SRU_PINEN0 (Group F) */
SRU(LOW,PBEN19_I); /* assign pin 19 low so it is an input */
SRU(LOW,PBEN20_I); /* assign pin 20 low so it is an input */
/* unmask individual interrupts */
(*pDAI_IRPTL_PRI) = (SRU_EXTMISCA1_INT | SRU_EXTMISCA2_INT);
/* make sure interrupts latch on the rising edge */
(*pDAI_IRPTL_RE) = (SRU_EXTMISCA1_INT | SRU_EXTMISCA2_INT);
/* clear MSEN bit for this test */
(*pSYSCTL) &= ~(MSEN);
/* setup the IRQ pins to use the pushbuttons */
(*pSYSCTL) |= (IRQ1EN | IRQ2EN);
sysreg_bit_set(sysreg_MODE2, (IRQ1E | IRQ2E) );
sysreg_bit_clr(sysreg_IRPTL, (IRQ1I | IRQ2I) );
/* enable IRQ interrupts and make DAI interrupts high priority */
sysreg_bit_set(sysreg_IMASK, (IRQ1I | IRQ2I | DAIHI) );
sysreg_bit_set(sysreg_MODE1, IRPTEN ); /* enable global interrupts */
/* register the interrut handlers */
interrupt(SIG_DAIH,SW10_SW11_DAI_handler);
interrupt(SIG_IRQ1,SW8_IRQ1_handler);
interrupt(SIG_IRQ2,SW9_IRQ2_handler);
}