/* This is an application defined callback function used to clear whichever interrupt was installed by the the vApplicationSetupTimerInterrupt() callback function - in this case the interrupt generated by the AXI timer. It is provided as an application callback because the kernel will run on lots of different MicroBlaze and FPGA configurations - not all of which will have the same timer peripherals defined or available. This example uses the AXI Timer 0. If that is available on your hardware platform then this example callback implementation should not require modification provided the example definition of vApplicationSetupTimerInterrupt() is also not modified. */ void vApplicationClearTimerInterrupt( void ) { unsigned long ulCSR; /* Clear the timer interrupt */ ulCSR = XTmrCtr_GetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0 ); XTmrCtr_SetControlStatusReg( XPAR_AXI_TIMER_0_BASEADDR, 0, ulCSR ); }
void timer_int_handler(void * baseaddr_p) { unsigned int csr; int num; unsigned int MskAnodes; csr = XTmrCtr_GetControlStatusReg(XPAR_XPS_TIMER_0_BASEADDR, 0); if (csr & XTC_CSR_INT_OCCURED_MASK && win_flag==0) { count++; if (count%2==0) { MskAnodes=0x00000D00; num=(TIME_LIMIT-time0)/10; } else { MskAnodes=0x00000E00; num=(TIME_LIMIT-time0)%10; } ssBuf = MskAnodes | rgfsNumMap[num]; Xil_Out32(XPAR_SEVSEG_DISP_12BITS_BASEADDR, ssBuf); } if (count==200) { count=0; time0++; DrawBack(3,1119,EMPTY); DrawTime(88, EMPTY); if (time0>20) DrawTime(TIME_LIMIT-time0, CURSOR); else DrawTime(TIME_LIMIT-time0, turn); } if (time0>TIME_LIMIT) { time0=0; if (turn==HUMAN_PLAYER) { turn=COMPUTER_PLAYER; xil_printf("\r\nComputer Player's turn!\r\n"); } else { turn=HUMAN_PLAYER; xil_printf("\r\nHuman Player's turn!\r\n"); } } XTmrCtr_SetControlStatusReg(XPAR_XPS_TIMER_0_BASEADDR, 0, csr); }