http://d.hatena.ne.jp/seinzumtode/20180416/1523849621 のコードは引数が間違っていたので修正した
#include <stdio.h> #include "xil_types.h" #include "xtmrctr.h" #include "xparameters.h" #include "xil_io.h" #include "xil_exception.h" #include "xintc.h" #include "xgpio.h" void Timer_InterruptHandler(void *data, u8 TmrCtrNumber) { print(" Interrupt acknowledged \n \r "); } int main() { XIntc IntcInstancePtr; XTmrCtr TimerInstancePtr; int xStatus; print("##### Application Starts #####\n\r"); print("\r\n"); xStatus = XTmrCtr_Initialize(&TimerInstancePtr,XPAR_TMRCTR_1_DEVICE_ID); if(XST_SUCCESS != xStatus) print("TIMER INIT FAILED \n\r"); XTmrCtr_SetHandler(&TimerInstancePtr,Timer_InterruptHandler,&TimerInstancePtr); XTmrCtr_SetResetValue(&TimerInstancePtr,0, 0xf8000000); XTmrCtr_SetOptions(&TimerInstancePtr,0,(XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION )); xStatus = XIntc_Initialize(&IntcInstancePtr, XPAR_INTC_0_DEVICE_ID); if (xStatus != XST_SUCCESS){ print("intc init error\n\r"); return xStatus; } xStatus = XIntc_Connect(&IntcInstancePtr, XPAR_INTC_0_TMRCTR_1_VEC_ID, (XInterruptHandler)XTmrCtr_InterruptHandler, (void*)&TimerInstancePtr); if (xStatus != XST_SUCCESS){ print("connect error\n\r"); return xStatus; } xStatus = XIntc_Start(&IntcInstancePtr, XIN_REAL_MODE); if (xStatus != XST_SUCCESS){ print("intc start error\n\r"); return xStatus; } XIntc_Enable(&IntcInstancePtr, XPAR_INTC_0_TMRCTR_1_VEC_ID); microblaze_enable_interrupts(); XTmrCtr_Start(&TimerInstancePtr,0); print("timer start \n\r"); //Wait For interrupt; print("Wait for the Timer interrupt to tigger \r\n"); print("########################################\r\n"); print(" \r\n"); while(1) { } cleanup_platform(); return 0; }