quartus 10.0定时器中断问题,请高手帮忙,谢谢!
时间:10-02
整理:3721RD
点击:
不知道怎么回事,在nios ii一编译就报错,请大侠帮忙。注册中断的时候,就报错,貌似找不到这个函数,可我已经包含#include "sys/alt_irq.h"头文件了啊。alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID, TIMER_0_IRQ,
ISR_timer,
isr_context_ptr,
0);
函数如下:
#include
#include
#include "string.h"
#include
#include "../inc/IO.h"
#include "../inc/usb.h"
#include "altera_avalon_dma_regs.h"
#include "altera_avalon_spi_regs.h"
#include "altera_avalon_pio_regs.h"
#include "altera_avalon_timer_regs.h"
#include "sys/alt_irq.h"
#include "alt_types.h"
#include "system.h"
//unsigned short usbDataBuf[USB_BUF_MAX_SIZE];
int SPI_READ_DATA(void);
void init(void);
void ISR_timer(void *isr_context);
unsigned int timer_isr_context;
int main()
{
init();
while(1)
{
};
return 0;
}
void init(void)
{
void* isr_context_ptr = (void*) &timer_isr_context;
alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID,
TIMER_0_IRQ,
ISR_timer,
isr_context_ptr,
0);
IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_BASE,
ALTERA_AVALON_TIMER_CONTROL_START_MSK |// START = 1
ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |// CONT = 1
ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); // ITO = 1
}
void ISR_timer(void* timer_isr_context)
{
IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER_0_BASE,
~ ALTERA_AVALON_TIMER_STATUS_TO_MSK); // TO = 0
}
ISR_timer,
isr_context_ptr,
0);
函数如下:
#include
#include
#include "string.h"
#include
#include "../inc/IO.h"
#include "../inc/usb.h"
#include "altera_avalon_dma_regs.h"
#include "altera_avalon_spi_regs.h"
#include "altera_avalon_pio_regs.h"
#include "altera_avalon_timer_regs.h"
#include "sys/alt_irq.h"
#include "alt_types.h"
#include "system.h"
//unsigned short usbDataBuf[USB_BUF_MAX_SIZE];
int SPI_READ_DATA(void);
void init(void);
void ISR_timer(void *isr_context);
unsigned int timer_isr_context;
int main()
{
init();
while(1)
{
};
return 0;
}
void init(void)
{
void* isr_context_ptr = (void*) &timer_isr_context;
alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID,
TIMER_0_IRQ,
ISR_timer,
isr_context_ptr,
0);
IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_BASE,
ALTERA_AVALON_TIMER_CONTROL_START_MSK |// START = 1
ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |// CONT = 1
ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); // ITO = 1
}
void ISR_timer(void* timer_isr_context)
{
IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER_0_BASE,
~ ALTERA_AVALON_TIMER_STATUS_TO_MSK); // TO = 0
}
nios提示的错误
谢谢,问题已解决。