#include "s5pc100.h" #include "uart.h" void key1_int(void); int main() { uart_init(); GPH0.GPH0CON = 2 << 4;//相对应的引脚设置为中断唤醒方式 VIC0VECTADDR.VIC0VECTADDR1 = (unsigned int)key1_int;//注册中断地址 VIC0INTERRUPT.VIC0INTENABLE = 0x2;//向量中断使能 WKUPCON.WKUP_INT0_7_CON = (2 << 4);//唤醒中断使能 WKUPMSK.WKUP_INT0_7_MASK &= ~0x02;//中断屏蔽取消 puts("Please press key1 down!\n"); while (1) {}; return 0; } void do_irq(void) { ((void (*)(void))VIC0ADDRESS)();//读取中断地址寄存器,执行相应的中断函数 VIC0ADDRESS = 0;//清除地址寄存器 } void key1_int(void)//中断处理函数 { puts("Key1 has been pressed!\n"); WKUPPND.WKUP_INT0_7_PEND = 0x2;//清除中断标志位 }
工程源码: http://download.csdn.net/detail/a987860319/7126461
Cortex-A8按键中断程序,布布扣,bubuko.com
原文:http://blog.csdn.net/it_liuwei/article/details/22689355