[Suzaku:01608] Re: SZ410 FPGA側で発生させた割り込み信号がlinux側で認識できない件

mizo email@hidden
2009年 8月 18日 (火) 15:52:59 JST


溝渕です。

timer_interrupt_handler()
内に、
myprint("get irq\r\n");
と書いた場合にスイッチ押下(割り込み発生)でメッセージは表示されますか?

Miyamoto wrote:
> ちなみに、FPGA側の割り込みがlinux側で認識できるサンプルプロジェクトは無 
> いでしょうか。
> 参考にしたいので、もしあれば教えていただけるとありがたいです。

SUZAKU AVボードで割り込みを追加しています。

[SUZAKU AVボード ダウンロードページ]
http://suzaku.atmark-techno.com/series/av-board/download

対応しているドライバは、
linux-2.6.18-at[VERSION]/drivers/video/siv.c
です。

> //割り込みハンドラ
> int timer_interrupt_handler(void * baseaddr_p)
> {
> Xuint32 IntrStatus;
> 
> IntrStatus = OPB_TEST00_mReadReg(XPAR_OPB_TEST00_0_BASEADDR,
>     OPB_TEST00_INTR_ISR_OFFSET);
> slot();
> OPB_TEST00_mWriteReg(XPAR_OPB_TEST00_0_BASEADDR, 
> OPB_TEST00_INTR_ISR_OFFSET,
>       IntrStatus);
> 
> return 0;
> }
> 
> //割り込みの初期化
> void interrupt_init(void)
> {
> unsigned long index;
> 
> /*enable interrupt */
> XIntc_RegisterHandler(XPAR_SYSTEM_INTC_BASEADDR,
>         XPAR_SYSTEM_INTC_OPB_TEST00_0_IP2INTC_IRPT_INTR,
>         (XInterruptHandler)timer_interrupt_handler, (void *)0);
> 
> #ifdef __PPC__
> mtevpr(0xFFFF0000);
> for (index = XEXC_ID_FIRST; index < XEXC_ID_LAST + 1; index++)
>  XExc_RegisterHandler(index, (XExceptionHandler)NullHandler, XNULL);
> XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT,
>        (XExceptionHandler)XIntc_DeviceInterruptHandler,
>        (void*)XPAR_SYSTEM_INTC_DEVICE_ID);
> XExc_mEnableExceptions(XEXC_NON_CRITICAL);
> #else
> microblaze_enable_interrupts();
> #endif
> /* Start the interrupt controller */
> XIntc_mMasterEnable(XPAR_SYSTEM_INTC_BASEADDR);
> /* Enable timer interrupt in the interrupt controller */
> XIntc_mEnableIntr(XPAR_SYSTEM_INTC_BASEADDR,
>     XPAR_OPB_TEST00_0_IP2INTC_IRPT_MASK);
> /* start the intr sil */
> /* Enable all interrupt source from user logic.*/
> OPB_TEST00_mWriteReg(XPAR_OPB_TEST00_0_BASEADDR, 
> OPB_TEST00_INTR_IER_OFFSET,
>       0x00000001);
> /* Set global interrupt enable.*/
> OPB_TEST00_mWriteReg(XPAR_OPB_TEST00_0_BASEADDR, 
> OPB_TEST00_INTR_DGIER_OFFSET,
>       INTR_GIE_MASK);
> }
> 
> //メイン
> int main(void)
> {
> unsigned int bootloader_offset;
> char key;
> 
> LED_GPIO(LED_OFF);
> 
> #if defined(__PPC__) || defined(__powerpc__)
> XCache_DisableDCache();
> XCache_DisableICache();
> XCache_InvalidateICache();
> #ifdef SPI_REGISTER_BASEADDR
> /* phy reset */
> #ifdef XPAR_OCM_TEMAC_CNTLR_BASEADDR
> mtdcr(0x3f1, NRST_DISABLE);
> busy_wait(15000); /* about 10msec */
> mtdcr(0x3f1, NRST_ENABLE);
> busy_wait(15000); /* about 10msec */
> mtdcr(0x3f1, NRST_DISABLE);
> #else /* plb temac */
> LED_GPIO(LED_OFF | NRST_DISABLE);
> busy_wait(15000); /* about 10msec */
> LED_GPIO(LED_OFF | NRST_ENABLE);
> busy_wait(15000); /* about 10msec */
> LED_GPIO(LED_OFF | NRST_DISABLE);
> #endif
> #else
> busy_wait(15000); /* about 10msec */
> #endif
> #endif
> 
> if (get_bootloader_offset(&bootloader_offset) < 0)
>  goto halt;
> 
> if (is_autoboot_mode())
>  second_bootloader(bootloader_offset);
> 
> #ifdef XPAR_XPS_TEST00_0_BASEADDR
> interrupt_init();
> #else
> myprint("\r\n\r\n"BBOOT_NAME " v" BBOOT_VERSION " (" \
>  TARGET_CPU ") compiled at " __TIME__ ", " __DATE__ "\r\n");
> myprint("Press 'z' or 'Z' for BBoot Menu.\r\n");
> 
> /* busy loop to wait getting a char 'z' or 'Z' for about 2sec */
> busy_wait(BBOOTMENU_WAITTIME);
> if (XUartLite_mIsReceiveEmpty(UART_BASEADDR) ||
>     ((key = get_char()) != 0 && key != 'z' && key != 'Z'))
>  second_bootloader(bootloader_offset);
> #endif
> 
> /* clear for long time pushing */
> clear_rx_fifo();
> 
> myprint("\r\n\r\nPlease choose one of the following and hit enter.\r\n");
> myprint("a: activate second stage bootloader (default)\r\n");
> myprint("s: download a s-record file\r\n");
> #ifdef XPAR_XPS_TEST00_0_BASEADDR
> myprint("t: busy loop type slot-machine\r\n");
> #endif
> 
> while (1) {
>  key = get_char();
>  switch (key) {
>  case 'a': /* activate second stage bootloader */
>  case 'A':
>  case '\r':
>  case '\n':
> #ifdef XPAR_XPS_TEST00_0_BASEADDR
>   interrupt_clean();
> #endif
>   second_bootloader(bootloader_offset);
>   break;
>  case 's':
>  case 'S':
> #ifdef XPAR_XPS_TEST00_0_BASEADDR
>   interrupt_clean();
> #endif
>   myprint("Start sending S-Record!!\r\n");
>   if (download() < 0) {
>    myprint("checksum mismatch.\r\n");
>    goto halt;
>   }
>   break;
> #ifdef XPAR_XPS_TEST00_0_BASEADDR
>  case 't':
>  case 'T':
>   interrupt_clean();
>   myprint("busy loop type slot-machine\r\n");
>   while (1) {
>     busy_wait(10000);
>     slot();
>   }
>   break;
> #endif
> #ifdef UART2_BASEADDR
>  case 'u':
>  case 'U':
>   myprint("Check Uart2\n\r");
>   while (XUartLite_mIsReceiveEmpty(UART2_BASEADDR));
>   XUartLite_SendByte(UART2_BASEADDR,
>        (Xuint8)XUartLite_RecvByte(UART2_BASEADDR));
>   myprint("Done\n\r");
>   break;
> #endif
>  default:
>   myprint("Invalid selection.\r\n");
>  case 'z':
>  case 'Z':
>   clear_rx_fifo();
>   break;
>  }
> }
> 
> halt:
> myprint("Halting...\r\n");
> return 0;
> }
> 
> _______________________________________________
> suzaku mailing list
> email@hidden
> http://lists.atmark-techno.com/cgi-bin/mailman/listinfo/suzaku
> 




suzaku メーリングリストの案内