Board logo

标题: ALT_IRQ_NOT_CONNECTED' undeclared (first use in this function) [打印本页]

作者: tianykun    时间: 2007-5-9 20:08     标题: ALT_IRQ_NOT_CONNECTED' undeclared (first use in this function)

我在做中断程序。
在注册函数alt_irq_register中
出现:ALT_IRQ_NOT_CONNECTED' undeclared (first use in this function)
这个错误。
但是我程序中并没有用倒这个啊。。看不倒。。为什么啊?

代码:

很简单的中断。
#include<stdio.h>
#include"alt_types.h"
#include"system.h"
#include"sys/alt_irq.h"
#include"altera_avalon_pio_regs.h"
volatile int edge_capture;
static void handle_button_interrupts(void*context,alt_u32 id)
  {
  volatile int*edge_capture_ptr=(volatile int *)context;
  *edge_capture_ptr=IORD_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE);
  IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE,0);//清边沿捕获寄存器
  }
static void init_button_pio()
 {
  void*edge_capture_ptr=(void*)&edge_capture;
  IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_BASE,0Xf);
  IOWR_ALTERA_ALALON_PIO_EDGE_CAP(BUTTON_PIO_BASE,0x0);
  alt_irq_register(BUTTON_PIO_IRQ,edge_capture_ptr,handle_button_interrupts);
 }
static void TestButtons(void)
  {
  alt_u8 buttons_tested;
  alt_u8 all_tested;
  int last_tested;
  buttons_tested=0x0;
  all_tested=0xf;
  edge_capture=0;
  last_tested=0xffff;
  prinitf("\nThe test will be end when all buttons have been pressed.\n");
  while(buttons_tested!=all_tested)
  {
  if(last_tested==edge_capture)
     {continue;}
  else
    {
    last_tested=edge_capture;
    switch(edge_capture)
      {
       case 0x1:
          printf("\nBUTTON 1 Press.\n");
          buttons_tested=buttons_tested|0x1;
          break;
        case 0x2:
          printf("\nBUTTON 2 Press.\n");
          buttons_tested=buttons_tested|0x2;
          break;
          case 0x4:
          printf("\nBUTTON 3 Press.\n");
          buttons_tested=buttons_tested|0x4;
          break;
          case 0x8:
          printf("\nBUTTON 4 Press.\n");
          buttons_tested=buttons_tested|0x8;
          break;
      }
    }
  }
  IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_BASE,0x0);
  printf("\nall button press.\n");
  usleep(2000000);
  return ;
  }
  static void MenuBegin(alt_8*title)
  {
    printf("\n \n");
    printf("------------------------------\n");
    printf("NIos ii board diagnostics\n");
    printf("------------------------------\n");
    printf("%s",title);
  }
int main()
{
MenuBegin("Main Menu:");
TestButtons();
return 0;
}


作者: tianykun    时间: 2007-5-9 20:09

但是我程序中并没有用倒这个啊。。为什么啊?




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0