SOPC里已经正确设置
-
- #include "system.h"
- #include "altera_avalon_pio_regs.h"
- #include "alt_types.h"
- #include <stdio.h>
- #include <sys/alt_irq.h>
- #define mLED_OUT_BASE LED_OUT_BASE
- #define mINPUTSIGNAL_BASE INPUTSIGNAL_BASE
- int main (void) __attribute__ ((weak, alias ("alt_main")));
- void Initialize();
- void Ext_interrupts(void* context, alt_u32 id);
- volatile alt_u32 flag = 0;
- void alt_main (void)
- {
- // void *context;
-
- // alt_irq_register(INPUTSIGNAL_IRQ,context,Ext_interrupts); //注册中断函数
-
- Initialize();
-
- while(1)
- {
-
- if(flag == 1)
- {
- ……;
- }
- }
-
- }
- void Initialize()
- {
- IOWR_ALTERA_AVALON_PIO_IRQ_MASK(mINPUTSIGNAL_BASE, 0x01); //允许IO中断
- IOWR_ALTERA_AVALON_PIO_EDGE_CAP(mINPUTSIGNAL_BASE, 0x00); //清中断捕获寄存器
- alt_irq_register(INPUTSIGNAL_IRQ,NULL,Ext_interrupts); //注册中断函数
- }
-
- void Ext_interrupts(void* context, alt_u32 id)
- {
- IOWR_ALTERA_AVALON_PIO_EDGE_CAP(mINPUTSIGNAL_BASE, 0x00); //清中断捕获寄存器
- flag = 1;
- }
请帮我看下上面的代码有上面问题?为什么进不了中断函数?
非常急,麻烦各位了
|